Merge pull request #128 from TheBlueMatt/main
[ldk-java] / ts / bindings.c
1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include "js-wasm.h"
4 #include <stdatomic.h>
5 #include <lightning.h>
6
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
11
12 extern void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14         if (!expression) { abort(); }
15 }
16
17 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
18         return val == 0xdeadbeef0badf00dULL;
19 }
20
21
22 void *malloc(size_t size);
23 void free(void *ptr);
24
25 #define MALLOC(a, _) malloc(a)
26 #define do_MALLOC(a, _b, _c) malloc(a)
27 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
28 #define DO_ASSERT(a) (void)(a)
29 #define CHECK(a)
30 #define CHECK_ACCESS(p)
31 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
32
33 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
34 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
36 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
37
38 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
39
40 #define DECL_ARR_TYPE(ty, name) \
41         struct name##array { \
42                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
43                 ty elems[]; \
44         }; \
45         typedef struct name##array * name##Array; \
46         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
47                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
48                 arr->arr_len = arr_len; \
49                 return arr; \
50         }
51
52 DECL_ARR_TYPE(int64_t, int64_t);
53 DECL_ARR_TYPE(uint64_t, uint64_t);
54 DECL_ARR_TYPE(int8_t, int8_t);
55 DECL_ARR_TYPE(int16_t, int16_t);
56 DECL_ARR_TYPE(uint32_t, uint32_t);
57 DECL_ARR_TYPE(void*, ptr);
58 DECL_ARR_TYPE(char, char);
59 typedef charArray jstring;
60
61 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
62         charArray arr = init_charArray(len, __LINE__);
63         memcpy(arr->elems, chars, len);
64         return arr;
65 }
66 static inline LDKStr str_ref_to_owned_c(const jstring str) {
67         char* newchars = MALLOC(str->arr_len + 1, "String chars");
68         memcpy(newchars, str->elems, str->arr_len);
69         newchars[str->arr_len] = 0;
70         LDKStr res = {
71                 .chars = newchars,
72                 .len = str->arr_len,
73                 .chars_is_owned = true
74         };
75         return res;
76 }
77
78 typedef bool jboolean;
79
80 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
81         return (uint32_t)MALLOC(size, "JS-Called malloc");
82 }
83 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
84         FREE((void*)ptr);
85 }
86
87 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
88         const char *res = check_get_ldk_bindings_version();
89         if (res == NULL) return NULL;
90         return str_ref_to_ts(res, strlen(res));
91 }
92 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
93         const char *res = check_get_ldk_version();
94         if (res == NULL) return NULL;
95         return str_ref_to_ts(res, strlen(res));
96 }
97 #include "version.c"
98 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
99
100 static inline void* untag_ptr(uint64_t ptr) {
101         if (ptr < 4096) return (void*)ptr;
102         if (sizeof(void*) == 4) {
103                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
104                 return (void*)(uintptr_t)ptr;
105         } else {
106                 // For 64-bit systems, assume the top byte is used for tagging, then
107                 // use bit 9 ^ bit 10.
108                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
109                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
110 #ifdef LDK_DEBUG_BUILD
111                 // On debug builds we also use the 11th bit as a debug flag
112                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
113                 CHECK(tenth_bit != eleventh_bit);
114                 p ^= 1ULL << 53;
115 #endif
116                 return (void*)p;
117         }
118 }
119 static inline bool ptr_is_owned(uint64_t ptr) {
120         if(ptr < 4096) return true;
121         if (sizeof(void*) == 4) {
122                 return ptr & (1ULL << 32);
123         } else {
124                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
125                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
126 #ifdef LDK_DEBUG_BUILD
127                 // On debug builds we also use the 11th bit as a debug flag
128                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
129                 CHECK(tenth_bit != eleventh_bit);
130 #endif
131                 return (ninth_bit ^ tenth_bit) ? true : false;
132         }
133 }
134 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
135         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
136         if (sizeof(void*) == 4) {
137                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
138         } else {
139                 CHECK(sizeof(uintptr_t) == 8);
140                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
141                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
142 #ifdef LDK_DEBUG_BUILD
143                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
144                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
145                 CHECK(ninth_bit == tenth_bit);
146                 CHECK(ninth_bit == eleventh_bit);
147                 t ^= 1ULL << 53;
148 #endif
149                 CHECK(ptr_is_owned(t) == is_owned);
150                 CHECK(untag_ptr(t) == ptr);
151                 return t;
152         }
153 }
154
155 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
156         switch (ord) {
157                 case 0: return LDKCOption_NoneZ_Some;
158                 case 1: return LDKCOption_NoneZ_None;
159         }
160         abort();
161 }
162 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
163         switch (val) {
164                 case LDKCOption_NoneZ_Some: return 0;
165                 case LDKCOption_NoneZ_None: return 1;
166                 default: abort();
167         }
168 }
169 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
170         switch (ord) {
171                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
172                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
173                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
174         }
175         abort();
176 }
177 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
178         switch (val) {
179                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
180                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
181                 case LDKChannelMonitorUpdateStatus_PermanentFailure: return 2;
182                 default: abort();
183         }
184 }
185 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
186         switch (ord) {
187                 case 0: return LDKConfirmationTarget_Background;
188                 case 1: return LDKConfirmationTarget_Normal;
189                 case 2: return LDKConfirmationTarget_HighPriority;
190         }
191         abort();
192 }
193 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
194         switch (val) {
195                 case LDKConfirmationTarget_Background: return 0;
196                 case LDKConfirmationTarget_Normal: return 1;
197                 case LDKConfirmationTarget_HighPriority: return 2;
198                 default: abort();
199         }
200 }
201 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
202         switch (ord) {
203                 case 0: return LDKCreationError_DescriptionTooLong;
204                 case 1: return LDKCreationError_RouteTooLong;
205                 case 2: return LDKCreationError_TimestampOutOfBounds;
206                 case 3: return LDKCreationError_InvalidAmount;
207                 case 4: return LDKCreationError_MissingRouteHints;
208                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
209         }
210         abort();
211 }
212 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
213         switch (val) {
214                 case LDKCreationError_DescriptionTooLong: return 0;
215                 case LDKCreationError_RouteTooLong: return 1;
216                 case LDKCreationError_TimestampOutOfBounds: return 2;
217                 case LDKCreationError_InvalidAmount: return 3;
218                 case LDKCreationError_MissingRouteHints: return 4;
219                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
220                 default: abort();
221         }
222 }
223 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
224         switch (ord) {
225                 case 0: return LDKCurrency_Bitcoin;
226                 case 1: return LDKCurrency_BitcoinTestnet;
227                 case 2: return LDKCurrency_Regtest;
228                 case 3: return LDKCurrency_Simnet;
229                 case 4: return LDKCurrency_Signet;
230         }
231         abort();
232 }
233 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
234         switch (val) {
235                 case LDKCurrency_Bitcoin: return 0;
236                 case LDKCurrency_BitcoinTestnet: return 1;
237                 case LDKCurrency_Regtest: return 2;
238                 case LDKCurrency_Simnet: return 3;
239                 case LDKCurrency_Signet: return 4;
240                 default: abort();
241         }
242 }
243 static inline LDKFailureCode LDKFailureCode_from_js(int32_t ord) {
244         switch (ord) {
245                 case 0: return LDKFailureCode_TemporaryNodeFailure;
246                 case 1: return LDKFailureCode_RequiredNodeFeatureMissing;
247                 case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails;
248         }
249         abort();
250 }
251 static inline int32_t LDKFailureCode_to_js(LDKFailureCode val) {
252         switch (val) {
253                 case LDKFailureCode_TemporaryNodeFailure: return 0;
254                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
255                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
256                 default: abort();
257         }
258 }
259 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
260         switch (ord) {
261                 case 0: return LDKHTLCClaim_OfferedTimeout;
262                 case 1: return LDKHTLCClaim_OfferedPreimage;
263                 case 2: return LDKHTLCClaim_AcceptedTimeout;
264                 case 3: return LDKHTLCClaim_AcceptedPreimage;
265                 case 4: return LDKHTLCClaim_Revocation;
266         }
267         abort();
268 }
269 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
270         switch (val) {
271                 case LDKHTLCClaim_OfferedTimeout: return 0;
272                 case LDKHTLCClaim_OfferedPreimage: return 1;
273                 case LDKHTLCClaim_AcceptedTimeout: return 2;
274                 case LDKHTLCClaim_AcceptedPreimage: return 3;
275                 case LDKHTLCClaim_Revocation: return 4;
276                 default: abort();
277         }
278 }
279 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
280         switch (ord) {
281                 case 0: return LDKIOError_NotFound;
282                 case 1: return LDKIOError_PermissionDenied;
283                 case 2: return LDKIOError_ConnectionRefused;
284                 case 3: return LDKIOError_ConnectionReset;
285                 case 4: return LDKIOError_ConnectionAborted;
286                 case 5: return LDKIOError_NotConnected;
287                 case 6: return LDKIOError_AddrInUse;
288                 case 7: return LDKIOError_AddrNotAvailable;
289                 case 8: return LDKIOError_BrokenPipe;
290                 case 9: return LDKIOError_AlreadyExists;
291                 case 10: return LDKIOError_WouldBlock;
292                 case 11: return LDKIOError_InvalidInput;
293                 case 12: return LDKIOError_InvalidData;
294                 case 13: return LDKIOError_TimedOut;
295                 case 14: return LDKIOError_WriteZero;
296                 case 15: return LDKIOError_Interrupted;
297                 case 16: return LDKIOError_Other;
298                 case 17: return LDKIOError_UnexpectedEof;
299         }
300         abort();
301 }
302 static inline int32_t LDKIOError_to_js(LDKIOError val) {
303         switch (val) {
304                 case LDKIOError_NotFound: return 0;
305                 case LDKIOError_PermissionDenied: return 1;
306                 case LDKIOError_ConnectionRefused: return 2;
307                 case LDKIOError_ConnectionReset: return 3;
308                 case LDKIOError_ConnectionAborted: return 4;
309                 case LDKIOError_NotConnected: return 5;
310                 case LDKIOError_AddrInUse: return 6;
311                 case LDKIOError_AddrNotAvailable: return 7;
312                 case LDKIOError_BrokenPipe: return 8;
313                 case LDKIOError_AlreadyExists: return 9;
314                 case LDKIOError_WouldBlock: return 10;
315                 case LDKIOError_InvalidInput: return 11;
316                 case LDKIOError_InvalidData: return 12;
317                 case LDKIOError_TimedOut: return 13;
318                 case LDKIOError_WriteZero: return 14;
319                 case LDKIOError_Interrupted: return 15;
320                 case LDKIOError_Other: return 16;
321                 case LDKIOError_UnexpectedEof: return 17;
322                 default: abort();
323         }
324 }
325 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
326         switch (ord) {
327                 case 0: return LDKLevel_Gossip;
328                 case 1: return LDKLevel_Trace;
329                 case 2: return LDKLevel_Debug;
330                 case 3: return LDKLevel_Info;
331                 case 4: return LDKLevel_Warn;
332                 case 5: return LDKLevel_Error;
333         }
334         abort();
335 }
336 static inline int32_t LDKLevel_to_js(LDKLevel val) {
337         switch (val) {
338                 case LDKLevel_Gossip: return 0;
339                 case LDKLevel_Trace: return 1;
340                 case LDKLevel_Debug: return 2;
341                 case LDKLevel_Info: return 3;
342                 case LDKLevel_Warn: return 4;
343                 case LDKLevel_Error: return 5;
344                 default: abort();
345         }
346 }
347 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
348         switch (ord) {
349                 case 0: return LDKNetwork_Bitcoin;
350                 case 1: return LDKNetwork_Testnet;
351                 case 2: return LDKNetwork_Regtest;
352                 case 3: return LDKNetwork_Signet;
353         }
354         abort();
355 }
356 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
357         switch (val) {
358                 case LDKNetwork_Bitcoin: return 0;
359                 case LDKNetwork_Testnet: return 1;
360                 case LDKNetwork_Regtest: return 2;
361                 case LDKNetwork_Signet: return 3;
362                 default: abort();
363         }
364 }
365 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
366         switch (ord) {
367                 case 0: return LDKPaymentFailureReason_RecipientRejected;
368                 case 1: return LDKPaymentFailureReason_UserAbandoned;
369                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
370                 case 3: return LDKPaymentFailureReason_PaymentExpired;
371                 case 4: return LDKPaymentFailureReason_RouteNotFound;
372                 case 5: return LDKPaymentFailureReason_UnexpectedError;
373         }
374         abort();
375 }
376 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
377         switch (val) {
378                 case LDKPaymentFailureReason_RecipientRejected: return 0;
379                 case LDKPaymentFailureReason_UserAbandoned: return 1;
380                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
381                 case LDKPaymentFailureReason_PaymentExpired: return 3;
382                 case LDKPaymentFailureReason_RouteNotFound: return 4;
383                 case LDKPaymentFailureReason_UnexpectedError: return 5;
384                 default: abort();
385         }
386 }
387 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
388         switch (ord) {
389                 case 0: return LDKRecipient_Node;
390                 case 1: return LDKRecipient_PhantomNode;
391         }
392         abort();
393 }
394 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
395         switch (val) {
396                 case LDKRecipient_Node: return 0;
397                 case LDKRecipient_PhantomNode: return 1;
398                 default: abort();
399         }
400 }
401 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
402         switch (ord) {
403                 case 0: return LDKRetryableSendFailure_PaymentExpired;
404                 case 1: return LDKRetryableSendFailure_RouteNotFound;
405                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
406         }
407         abort();
408 }
409 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
410         switch (val) {
411                 case LDKRetryableSendFailure_PaymentExpired: return 0;
412                 case LDKRetryableSendFailure_RouteNotFound: return 1;
413                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
414                 default: abort();
415         }
416 }
417 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
418         switch (ord) {
419                 case 0: return LDKSecp256k1Error_IncorrectSignature;
420                 case 1: return LDKSecp256k1Error_InvalidMessage;
421                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
422                 case 3: return LDKSecp256k1Error_InvalidSignature;
423                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
424                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
425                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
426                 case 7: return LDKSecp256k1Error_InvalidTweak;
427                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
428                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
429                 case 10: return LDKSecp256k1Error_InvalidParityValue;
430         }
431         abort();
432 }
433 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
434         switch (val) {
435                 case LDKSecp256k1Error_IncorrectSignature: return 0;
436                 case LDKSecp256k1Error_InvalidMessage: return 1;
437                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
438                 case LDKSecp256k1Error_InvalidSignature: return 3;
439                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
440                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
441                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
442                 case LDKSecp256k1Error_InvalidTweak: return 7;
443                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
444                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
445                 case LDKSecp256k1Error_InvalidParityValue: return 10;
446                 default: abort();
447         }
448 }
449 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
450         switch (ord) {
451                 case 0: return LDKSemanticError_NoPaymentHash;
452                 case 1: return LDKSemanticError_MultiplePaymentHashes;
453                 case 2: return LDKSemanticError_NoDescription;
454                 case 3: return LDKSemanticError_MultipleDescriptions;
455                 case 4: return LDKSemanticError_NoPaymentSecret;
456                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
457                 case 6: return LDKSemanticError_InvalidFeatures;
458                 case 7: return LDKSemanticError_InvalidRecoveryId;
459                 case 8: return LDKSemanticError_InvalidSignature;
460                 case 9: return LDKSemanticError_ImpreciseAmount;
461         }
462         abort();
463 }
464 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
465         switch (val) {
466                 case LDKSemanticError_NoPaymentHash: return 0;
467                 case LDKSemanticError_MultiplePaymentHashes: return 1;
468                 case LDKSemanticError_NoDescription: return 2;
469                 case LDKSemanticError_MultipleDescriptions: return 3;
470                 case LDKSemanticError_NoPaymentSecret: return 4;
471                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
472                 case LDKSemanticError_InvalidFeatures: return 6;
473                 case LDKSemanticError_InvalidRecoveryId: return 7;
474                 case LDKSemanticError_InvalidSignature: return 8;
475                 case LDKSemanticError_ImpreciseAmount: return 9;
476                 default: abort();
477         }
478 }
479 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
480         switch (ord) {
481                 case 0: return LDKSiPrefix_Milli;
482                 case 1: return LDKSiPrefix_Micro;
483                 case 2: return LDKSiPrefix_Nano;
484                 case 3: return LDKSiPrefix_Pico;
485         }
486         abort();
487 }
488 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
489         switch (val) {
490                 case LDKSiPrefix_Milli: return 0;
491                 case LDKSiPrefix_Micro: return 1;
492                 case LDKSiPrefix_Nano: return 2;
493                 case LDKSiPrefix_Pico: return 3;
494                 default: abort();
495         }
496 }
497 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
498         switch (ord) {
499                 case 0: return LDKUtxoLookupError_UnknownChain;
500                 case 1: return LDKUtxoLookupError_UnknownTx;
501         }
502         abort();
503 }
504 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
505         switch (val) {
506                 case LDKUtxoLookupError_UnknownChain: return 0;
507                 case LDKUtxoLookupError_UnknownTx: return 1;
508                 default: abort();
509         }
510 }
511 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
512         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
513         return ret;
514 }
515 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
516         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
517         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
518         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
519         return ret_arr;
520 }
521
522 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
523 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
524         if (!ptr_is_owned(thing)) return;
525         void* thing_ptr = untag_ptr(thing);
526         CHECK_ACCESS(thing_ptr);
527         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
528         FREE(untag_ptr(thing));
529         BigEndianScalar_free(thing_conv);
530 }
531
532 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
533         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
534         switch(obj->tag) {
535                 case LDKBech32Error_MissingSeparator: return 0;
536                 case LDKBech32Error_InvalidChecksum: return 1;
537                 case LDKBech32Error_InvalidLength: return 2;
538                 case LDKBech32Error_InvalidChar: return 3;
539                 case LDKBech32Error_InvalidData: return 4;
540                 case LDKBech32Error_InvalidPadding: return 5;
541                 case LDKBech32Error_MixedCase: return 6;
542                 default: abort();
543         }
544 }
545 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
546         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
547         assert(obj->tag == LDKBech32Error_InvalidChar);
548                         int32_t invalid_char_conv = obj->invalid_char;
549         return invalid_char_conv;
550 }
551 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
552         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
553         assert(obj->tag == LDKBech32Error_InvalidData);
554                         int8_t invalid_data_conv = obj->invalid_data;
555         return invalid_data_conv;
556 }
557 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
558         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
559         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
560         return ret;
561 }
562 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) {
563         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
564         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
565         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
566         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
567         CVec_u8Z_free(ret_var);
568         return ret_arr;
569 }
570
571 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) {
572         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
573         int64_t ret_conv = TxOut_get_value(thing_conv);
574         return ret_conv;
575 }
576
577 uint32_t __attribute__((export_name("TS_LDKCOption_DurationZ_ty_from_ptr"))) TS_LDKCOption_DurationZ_ty_from_ptr(uint64_t ptr) {
578         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
579         switch(obj->tag) {
580                 case LDKCOption_DurationZ_Some: return 0;
581                 case LDKCOption_DurationZ_None: return 1;
582                 default: abort();
583         }
584 }
585 int64_t __attribute__((export_name("TS_LDKCOption_DurationZ_Some_get_some"))) TS_LDKCOption_DurationZ_Some_get_some(uint64_t ptr) {
586         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
587         assert(obj->tag == LDKCOption_DurationZ_Some);
588                         int64_t some_conv = obj->some;
589         return some_conv;
590 }
591 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
592         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
593         for (size_t i = 0; i < ret.datalen; i++) {
594                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
595         }
596         return ret;
597 }
598 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
599         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
600         switch(obj->tag) {
601                 case LDKCOption_u64Z_Some: return 0;
602                 case LDKCOption_u64Z_None: return 1;
603                 default: abort();
604         }
605 }
606 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
607         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
608         assert(obj->tag == LDKCOption_u64Z_Some);
609                         int64_t some_conv = obj->some;
610         return some_conv;
611 }
612 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
613         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
614         switch(obj->tag) {
615                 case LDKAPIError_APIMisuseError: return 0;
616                 case LDKAPIError_FeeRateTooHigh: return 1;
617                 case LDKAPIError_InvalidRoute: return 2;
618                 case LDKAPIError_ChannelUnavailable: return 3;
619                 case LDKAPIError_MonitorUpdateInProgress: return 4;
620                 case LDKAPIError_IncompatibleShutdownScript: return 5;
621                 default: abort();
622         }
623 }
624 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
625         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
626         assert(obj->tag == LDKAPIError_APIMisuseError);
627                         LDKStr err_str = obj->api_misuse_error.err;
628                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
629         return err_conv;
630 }
631 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
632         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
633         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
634                         LDKStr err_str = obj->fee_rate_too_high.err;
635                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
636         return err_conv;
637 }
638 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
639         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
640         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
641                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
642         return feerate_conv;
643 }
644 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
645         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
646         assert(obj->tag == LDKAPIError_InvalidRoute);
647                         LDKStr err_str = obj->invalid_route.err;
648                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
649         return err_conv;
650 }
651 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
652         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
653         assert(obj->tag == LDKAPIError_ChannelUnavailable);
654                         LDKStr err_str = obj->channel_unavailable.err;
655                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
656         return err_conv;
657 }
658 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
659         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
660         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
661                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
662                         uint64_t script_ref = 0;
663                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
664                         script_ref = tag_ptr(script_var.inner, false);
665         return script_ref;
666 }
667 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
668 CHECK(owner->result_ok);
669         return *owner->contents.result;
670 }
671 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
672         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
673         CResult_NoneAPIErrorZ_get_ok(owner_conv);
674 }
675
676 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
677 CHECK(!owner->result_ok);
678         return APIError_clone(&*owner->contents.err);
679 }
680 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
681         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
682         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
683         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
684         uint64_t ret_ref = tag_ptr(ret_copy, true);
685         return ret_ref;
686 }
687
688 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
689         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
690         for (size_t i = 0; i < ret.datalen; i++) {
691                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
692         }
693         return ret;
694 }
695 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
696         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
697         for (size_t i = 0; i < ret.datalen; i++) {
698                 ret.data[i] = APIError_clone(&orig->data[i]);
699         }
700         return ret;
701 }
702 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
703         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
704         switch(obj->tag) {
705                 case LDKCOption_CVec_u8ZZ_Some: return 0;
706                 case LDKCOption_CVec_u8ZZ_None: return 1;
707                 default: abort();
708         }
709 }
710 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
711         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
712         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
713                         LDKCVec_u8Z some_var = obj->some;
714                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
715                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
716         return some_arr;
717 }
718 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
719         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
720         switch(obj->tag) {
721                 case LDKDecodeError_UnknownVersion: return 0;
722                 case LDKDecodeError_UnknownRequiredFeature: return 1;
723                 case LDKDecodeError_InvalidValue: return 2;
724                 case LDKDecodeError_ShortRead: return 3;
725                 case LDKDecodeError_BadLengthDescriptor: return 4;
726                 case LDKDecodeError_Io: return 5;
727                 case LDKDecodeError_UnsupportedCompression: return 6;
728                 default: abort();
729         }
730 }
731 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
732         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
733         assert(obj->tag == LDKDecodeError_Io);
734                         uint32_t io_conv = LDKIOError_to_js(obj->io);
735         return io_conv;
736 }
737 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
738         LDKRecipientOnionFields ret = *owner->contents.result;
739         ret.is_owned = false;
740         return ret;
741 }
742 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
743         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
744         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
745         uint64_t ret_ref = 0;
746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
748         return ret_ref;
749 }
750
751 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
752 CHECK(!owner->result_ok);
753         return DecodeError_clone(&*owner->contents.err);
754 }
755 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
756         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
757         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
758         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
759         uint64_t ret_ref = tag_ptr(ret_copy, true);
760         return ret_ref;
761 }
762
763 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
764         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
765         switch(obj->tag) {
766                 case LDKCOption_HTLCClaimZ_Some: return 0;
767                 case LDKCOption_HTLCClaimZ_None: return 1;
768                 default: abort();
769         }
770 }
771 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
772         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
773         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
774                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
775         return some_conv;
776 }
777 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
778 CHECK(owner->result_ok);
779         return *owner->contents.result;
780 }
781 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
782         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
783         CResult_NoneNoneZ_get_ok(owner_conv);
784 }
785
786 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
787 CHECK(!owner->result_ok);
788         return *owner->contents.err;
789 }
790 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
791         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
792         CResult_NoneNoneZ_get_err(owner_conv);
793 }
794
795 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
796         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
797         ret.is_owned = false;
798         return ret;
799 }
800 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
801         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
802         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
803         uint64_t ret_ref = 0;
804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
806         return ret_ref;
807 }
808
809 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
810 CHECK(!owner->result_ok);
811         return DecodeError_clone(&*owner->contents.err);
812 }
813 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
814         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
815         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
816         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
817         uint64_t ret_ref = tag_ptr(ret_copy, true);
818         return ret_ref;
819 }
820
821 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
822         LDKTxCreationKeys ret = *owner->contents.result;
823         ret.is_owned = false;
824         return ret;
825 }
826 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
827         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
828         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
829         uint64_t ret_ref = 0;
830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
832         return ret_ref;
833 }
834
835 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
836 CHECK(!owner->result_ok);
837         return DecodeError_clone(&*owner->contents.err);
838 }
839 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
840         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
841         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
842         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
843         uint64_t ret_ref = tag_ptr(ret_copy, true);
844         return ret_ref;
845 }
846
847 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
848         LDKChannelPublicKeys ret = *owner->contents.result;
849         ret.is_owned = false;
850         return ret;
851 }
852 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
853         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
854         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
855         uint64_t ret_ref = 0;
856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
858         return ret_ref;
859 }
860
861 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
862 CHECK(!owner->result_ok);
863         return DecodeError_clone(&*owner->contents.err);
864 }
865 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
866         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
867         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
868         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
869         uint64_t ret_ref = tag_ptr(ret_copy, true);
870         return ret_ref;
871 }
872
873 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
874         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
875         switch(obj->tag) {
876                 case LDKCOption_u32Z_Some: return 0;
877                 case LDKCOption_u32Z_None: return 1;
878                 default: abort();
879         }
880 }
881 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
882         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
883         assert(obj->tag == LDKCOption_u32Z_Some);
884                         int32_t some_conv = obj->some;
885         return some_conv;
886 }
887 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
888         LDKHTLCOutputInCommitment ret = *owner->contents.result;
889         ret.is_owned = false;
890         return ret;
891 }
892 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
893         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
894         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
895         uint64_t ret_ref = 0;
896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
898         return ret_ref;
899 }
900
901 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
902 CHECK(!owner->result_ok);
903         return DecodeError_clone(&*owner->contents.err);
904 }
905 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
906         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
907         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
908         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
909         uint64_t ret_ref = tag_ptr(ret_copy, true);
910         return ret_ref;
911 }
912
913 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
914         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
915         ret.is_owned = false;
916         return ret;
917 }
918 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
919         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
920         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
921         uint64_t ret_ref = 0;
922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
924         return ret_ref;
925 }
926
927 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
928 CHECK(!owner->result_ok);
929         return DecodeError_clone(&*owner->contents.err);
930 }
931 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
932         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
933         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
934         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
935         uint64_t ret_ref = tag_ptr(ret_copy, true);
936         return ret_ref;
937 }
938
939 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
940         LDKChannelTransactionParameters ret = *owner->contents.result;
941         ret.is_owned = false;
942         return ret;
943 }
944 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
945         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
946         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
947         uint64_t ret_ref = 0;
948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
950         return ret_ref;
951 }
952
953 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
954 CHECK(!owner->result_ok);
955         return DecodeError_clone(&*owner->contents.err);
956 }
957 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
958         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
959         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
960         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
961         uint64_t ret_ref = tag_ptr(ret_copy, true);
962         return ret_ref;
963 }
964
965 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
966         LDKHolderCommitmentTransaction ret = *owner->contents.result;
967         ret.is_owned = false;
968         return ret;
969 }
970 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
971         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
972         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
973         uint64_t ret_ref = 0;
974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
976         return ret_ref;
977 }
978
979 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
980 CHECK(!owner->result_ok);
981         return DecodeError_clone(&*owner->contents.err);
982 }
983 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
984         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
985         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
986         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
987         uint64_t ret_ref = tag_ptr(ret_copy, true);
988         return ret_ref;
989 }
990
991 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
992         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
993         ret.is_owned = false;
994         return ret;
995 }
996 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
997         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
998         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
999         uint64_t ret_ref = 0;
1000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1002         return ret_ref;
1003 }
1004
1005 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1006 CHECK(!owner->result_ok);
1007         return DecodeError_clone(&*owner->contents.err);
1008 }
1009 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1010         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1012         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1013         uint64_t ret_ref = tag_ptr(ret_copy, true);
1014         return ret_ref;
1015 }
1016
1017 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1018         LDKTrustedClosingTransaction ret = *owner->contents.result;
1019         ret.is_owned = false;
1020         return ret;
1021 }
1022 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
1023         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1024         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1025         uint64_t ret_ref = 0;
1026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1028         return ret_ref;
1029 }
1030
1031 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1032 CHECK(!owner->result_ok);
1033         return *owner->contents.err;
1034 }
1035 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
1036         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1037         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1038 }
1039
1040 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1041         LDKCommitmentTransaction ret = *owner->contents.result;
1042         ret.is_owned = false;
1043         return ret;
1044 }
1045 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
1046         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1047         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1048         uint64_t ret_ref = 0;
1049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1051         return ret_ref;
1052 }
1053
1054 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1055 CHECK(!owner->result_ok);
1056         return DecodeError_clone(&*owner->contents.err);
1057 }
1058 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1059         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1060         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1061         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1062         uint64_t ret_ref = tag_ptr(ret_copy, true);
1063         return ret_ref;
1064 }
1065
1066 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1067         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
1068         ret.is_owned = false;
1069         return ret;
1070 }
1071 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
1072         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1073         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1074         uint64_t ret_ref = 0;
1075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1077         return ret_ref;
1078 }
1079
1080 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1081 CHECK(!owner->result_ok);
1082         return *owner->contents.err;
1083 }
1084 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
1085         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1086         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1087 }
1088
1089 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1090 CHECK(owner->result_ok);
1091         return *owner->contents.result;
1092 }
1093 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
1094         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1095         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1096         ptrArray ret_arr = NULL;
1097         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1098         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1099         for (size_t m = 0; m < ret_var.datalen; m++) {
1100                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1101                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1102                 ret_arr_ptr[m] = ret_conv_12_arr;
1103         }
1104         
1105         return ret_arr;
1106 }
1107
1108 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1109 CHECK(!owner->result_ok);
1110         return *owner->contents.err;
1111 }
1112 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
1113         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1114         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1115 }
1116
1117 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1118         LDKShutdownScript ret = *owner->contents.result;
1119         ret.is_owned = false;
1120         return ret;
1121 }
1122 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1123         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1124         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1125         uint64_t ret_ref = 0;
1126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1128         return ret_ref;
1129 }
1130
1131 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1132 CHECK(!owner->result_ok);
1133         return DecodeError_clone(&*owner->contents.err);
1134 }
1135 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1136         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1137         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1138         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1139         uint64_t ret_ref = tag_ptr(ret_copy, true);
1140         return ret_ref;
1141 }
1142
1143 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1144         LDKShutdownScript ret = *owner->contents.result;
1145         ret.is_owned = false;
1146         return ret;
1147 }
1148 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1149         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1150         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1151         uint64_t ret_ref = 0;
1152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1154         return ret_ref;
1155 }
1156
1157 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1158         LDKInvalidShutdownScript ret = *owner->contents.err;
1159         ret.is_owned = false;
1160         return ret;
1161 }
1162 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1163         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1164         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1165         uint64_t ret_ref = 0;
1166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1168         return ret_ref;
1169 }
1170
1171 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1172         LDKBlindedPayInfo ret = *owner->contents.result;
1173         ret.is_owned = false;
1174         return ret;
1175 }
1176 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1177         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1178         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1179         uint64_t ret_ref = 0;
1180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1182         return ret_ref;
1183 }
1184
1185 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1186 CHECK(!owner->result_ok);
1187         return DecodeError_clone(&*owner->contents.err);
1188 }
1189 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1190         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1191         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1192         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1193         uint64_t ret_ref = tag_ptr(ret_copy, true);
1194         return ret_ref;
1195 }
1196
1197 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1198         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1199         for (size_t i = 0; i < ret.datalen; i++) {
1200                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1201         }
1202         return ret;
1203 }
1204 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1205         LDKRoute ret = *owner->contents.result;
1206         ret.is_owned = false;
1207         return ret;
1208 }
1209 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1210         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1211         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1212         uint64_t ret_ref = 0;
1213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1215         return ret_ref;
1216 }
1217
1218 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1219         LDKLightningError ret = *owner->contents.err;
1220         ret.is_owned = false;
1221         return ret;
1222 }
1223 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1224         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1225         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1226         uint64_t ret_ref = 0;
1227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1229         return ret_ref;
1230 }
1231
1232 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1233         LDKInFlightHtlcs ret = *owner->contents.result;
1234         ret.is_owned = false;
1235         return ret;
1236 }
1237 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
1238         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1239         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
1240         uint64_t ret_ref = 0;
1241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1243         return ret_ref;
1244 }
1245
1246 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1247 CHECK(!owner->result_ok);
1248         return DecodeError_clone(&*owner->contents.err);
1249 }
1250 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
1251         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1252         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1253         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
1254         uint64_t ret_ref = tag_ptr(ret_copy, true);
1255         return ret_ref;
1256 }
1257
1258 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1259         LDKRouteHop ret = *owner->contents.result;
1260         ret.is_owned = false;
1261         return ret;
1262 }
1263 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1264         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1265         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1266         uint64_t ret_ref = 0;
1267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1269         return ret_ref;
1270 }
1271
1272 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1273 CHECK(!owner->result_ok);
1274         return DecodeError_clone(&*owner->contents.err);
1275 }
1276 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1277         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1278         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1279         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1280         uint64_t ret_ref = tag_ptr(ret_copy, true);
1281         return ret_ref;
1282 }
1283
1284 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
1285         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
1286         for (size_t i = 0; i < ret.datalen; i++) {
1287                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
1288         }
1289         return ret;
1290 }
1291 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
1292         LDKBlindedTail ret = *owner->contents.result;
1293         ret.is_owned = false;
1294         return ret;
1295 }
1296 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
1297         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
1298         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
1299         uint64_t ret_ref = 0;
1300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1302         return ret_ref;
1303 }
1304
1305 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
1306 CHECK(!owner->result_ok);
1307         return DecodeError_clone(&*owner->contents.err);
1308 }
1309 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
1310         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
1311         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1312         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
1313         uint64_t ret_ref = tag_ptr(ret_copy, true);
1314         return ret_ref;
1315 }
1316
1317 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1318         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1319         for (size_t i = 0; i < ret.datalen; i++) {
1320                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1321         }
1322         return ret;
1323 }
1324 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
1325         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
1326         for (size_t i = 0; i < ret.datalen; i++) {
1327                 ret.data[i] = Path_clone(&orig->data[i]);
1328         }
1329         return ret;
1330 }
1331 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1332         LDKRoute ret = *owner->contents.result;
1333         ret.is_owned = false;
1334         return ret;
1335 }
1336 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1337         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1338         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1339         uint64_t ret_ref = 0;
1340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1342         return ret_ref;
1343 }
1344
1345 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1346 CHECK(!owner->result_ok);
1347         return DecodeError_clone(&*owner->contents.err);
1348 }
1349 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1350         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1351         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1352         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1353         uint64_t ret_ref = tag_ptr(ret_copy, true);
1354         return ret_ref;
1355 }
1356
1357 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1358         LDKRouteParameters ret = *owner->contents.result;
1359         ret.is_owned = false;
1360         return ret;
1361 }
1362 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1363         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1364         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1365         uint64_t ret_ref = 0;
1366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1368         return ret_ref;
1369 }
1370
1371 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1372 CHECK(!owner->result_ok);
1373         return DecodeError_clone(&*owner->contents.err);
1374 }
1375 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1376         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1377         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1378         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1379         uint64_t ret_ref = tag_ptr(ret_copy, true);
1380         return ret_ref;
1381 }
1382
1383 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1384         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1385         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1386         return ret;
1387 }
1388 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1389         LDKPaymentParameters ret = *owner->contents.result;
1390         ret.is_owned = false;
1391         return ret;
1392 }
1393 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1394         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1395         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1396         uint64_t ret_ref = 0;
1397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1399         return ret_ref;
1400 }
1401
1402 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1403 CHECK(!owner->result_ok);
1404         return DecodeError_clone(&*owner->contents.err);
1405 }
1406 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1407         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1408         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1409         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1410         uint64_t ret_ref = tag_ptr(ret_copy, true);
1411         return ret_ref;
1412 }
1413
1414 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
1415         LDKBlindedPayInfo ret = owner->a;
1416         ret.is_owned = false;
1417         return ret;
1418 }
1419 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
1420         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
1421         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
1422         uint64_t ret_ref = 0;
1423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1425         return ret_ref;
1426 }
1427
1428 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
1429         LDKBlindedPath ret = owner->b;
1430         ret.is_owned = false;
1431         return ret;
1432 }
1433 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
1434         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
1435         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
1436         uint64_t ret_ref = 0;
1437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1439         return ret_ref;
1440 }
1441
1442 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
1443         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
1444         for (size_t i = 0; i < ret.datalen; i++) {
1445                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
1446         }
1447         return ret;
1448 }
1449 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1450         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1451         for (size_t i = 0; i < ret.datalen; i++) {
1452                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1453         }
1454         return ret;
1455 }
1456 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1457         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1458         for (size_t i = 0; i < ret.datalen; i++) {
1459                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1460         }
1461         return ret;
1462 }
1463 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1464         LDKRouteHint ret = *owner->contents.result;
1465         ret.is_owned = false;
1466         return ret;
1467 }
1468 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1469         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1470         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1471         uint64_t ret_ref = 0;
1472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1474         return ret_ref;
1475 }
1476
1477 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1478 CHECK(!owner->result_ok);
1479         return DecodeError_clone(&*owner->contents.err);
1480 }
1481 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1482         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1483         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1484         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1485         uint64_t ret_ref = tag_ptr(ret_copy, true);
1486         return ret_ref;
1487 }
1488
1489 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1490         LDKRouteHintHop ret = *owner->contents.result;
1491         ret.is_owned = false;
1492         return ret;
1493 }
1494 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1495         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1496         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1497         uint64_t ret_ref = 0;
1498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1500         return ret_ref;
1501 }
1502
1503 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1504 CHECK(!owner->result_ok);
1505         return DecodeError_clone(&*owner->contents.err);
1506 }
1507 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1508         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1509         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1510         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1511         uint64_t ret_ref = tag_ptr(ret_copy, true);
1512         return ret_ref;
1513 }
1514
1515 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1516         return owner->a;
1517 }
1518 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
1519         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
1520         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1521         return ret_conv;
1522 }
1523
1524 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1525         return owner->b;
1526 }
1527 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
1528         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
1529         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1530         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1531         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1532         return ret_arr;
1533 }
1534
1535 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1536         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1537         for (size_t i = 0; i < ret.datalen; i++) {
1538                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1539         }
1540         return ret;
1541 }
1542 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_a(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
1543         return ThirtyTwoBytes_clone(&owner->a);
1544 }
1545 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_a"))) TS_C2Tuple_TxidBlockHashZ_get_a(uint64_t owner) {
1546         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
1547         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1548         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_a(owner_conv).data, 32);
1549         return ret_arr;
1550 }
1551
1552 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_b(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
1553         return ThirtyTwoBytes_clone(&owner->b);
1554 }
1555 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_b"))) TS_C2Tuple_TxidBlockHashZ_get_b(uint64_t owner) {
1556         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
1557         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1558         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_b(owner_conv).data, 32);
1559         return ret_arr;
1560 }
1561
1562 static inline LDKCVec_C2Tuple_TxidBlockHashZZ CVec_C2Tuple_TxidBlockHashZZ_clone(const LDKCVec_C2Tuple_TxidBlockHashZZ *orig) {
1563         LDKCVec_C2Tuple_TxidBlockHashZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ) * orig->datalen, "LDKCVec_C2Tuple_TxidBlockHashZZ clone bytes"), .datalen = orig->datalen };
1564         for (size_t i = 0; i < ret.datalen; i++) {
1565                 ret.data[i] = C2Tuple_TxidBlockHashZ_clone(&orig->data[i]);
1566         }
1567         return ret;
1568 }
1569 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
1570         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1571         switch(obj->tag) {
1572                 case LDKMonitorEvent_HTLCEvent: return 0;
1573                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
1574                 case LDKMonitorEvent_Completed: return 2;
1575                 case LDKMonitorEvent_UpdateFailed: return 3;
1576                 default: abort();
1577         }
1578 }
1579 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
1580         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1581         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
1582                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1583                         uint64_t htlc_event_ref = 0;
1584                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1585                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
1586         return htlc_event_ref;
1587 }
1588 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
1589         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1590         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
1591                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1592                         uint64_t commitment_tx_confirmed_ref = 0;
1593                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1594                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
1595         return commitment_tx_confirmed_ref;
1596 }
1597 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
1598         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1599         assert(obj->tag == LDKMonitorEvent_Completed);
1600                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
1601                         uint64_t funding_txo_ref = 0;
1602                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1603                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
1604         return funding_txo_ref;
1605 }
1606 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
1607         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1608         assert(obj->tag == LDKMonitorEvent_Completed);
1609                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
1610         return monitor_update_id_conv;
1611 }
1612 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
1613         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1614         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
1615                         LDKOutPoint update_failed_var = obj->update_failed;
1616                         uint64_t update_failed_ref = 0;
1617                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1618                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
1619         return update_failed_ref;
1620 }
1621 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1622         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1623         for (size_t i = 0; i < ret.datalen; i++) {
1624                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1625         }
1626         return ret;
1627 }
1628 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
1629         LDKOutPoint ret = owner->a;
1630         ret.is_owned = false;
1631         return ret;
1632 }
1633 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
1634         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
1635         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
1636         uint64_t ret_ref = 0;
1637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1639         return ret_ref;
1640 }
1641
1642 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
1643         return CVec_MonitorEventZ_clone(&owner->b);
1644 }
1645 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
1646         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
1647         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
1648         uint64_tArray ret_arr = NULL;
1649         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
1650         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
1651         for (size_t o = 0; o < ret_var.datalen; o++) {
1652                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
1653                 *ret_conv_14_copy = ret_var.data[o];
1654                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
1655                 ret_arr_ptr[o] = ret_conv_14_ref;
1656         }
1657         
1658         FREE(ret_var.data);
1659         return ret_arr;
1660 }
1661
1662 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
1663         return owner->c;
1664 }
1665 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
1666         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
1667         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1668         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
1669         return ret_arr;
1670 }
1671
1672 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
1673         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
1674         for (size_t i = 0; i < ret.datalen; i++) {
1675                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
1676         }
1677         return ret;
1678 }
1679 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
1680         LDKFixedPenaltyScorer ret = *owner->contents.result;
1681         ret.is_owned = false;
1682         return ret;
1683 }
1684 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
1685         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
1686         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
1687         uint64_t ret_ref = 0;
1688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1690         return ret_ref;
1691 }
1692
1693 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
1694 CHECK(!owner->result_ok);
1695         return DecodeError_clone(&*owner->contents.err);
1696 }
1697 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
1698         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
1699         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1700         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
1701         uint64_t ret_ref = tag_ptr(ret_copy, true);
1702         return ret_ref;
1703 }
1704
1705 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
1706         return owner->a;
1707 }
1708 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
1709         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
1710         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
1711         return ret_conv;
1712 }
1713
1714 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
1715         return owner->b;
1716 }
1717 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
1718         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
1719         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
1720         return ret_conv;
1721 }
1722
1723 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
1724         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
1725         switch(obj->tag) {
1726                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
1727                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
1728                 default: abort();
1729         }
1730 }
1731 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
1732         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
1733         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
1734                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1735                         *some_conv = obj->some;
1736                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
1737         return tag_ptr(some_conv, true);
1738 }
1739 static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
1740         return owner->a;
1741 }
1742 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
1743         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
1744         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
1745         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 8 * 2);
1746         return ret_arr;
1747 }
1748
1749 static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
1750         return owner->b;
1751 }
1752 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
1753         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
1754         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
1755         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 8 * 2);
1756         return ret_arr;
1757 }
1758
1759 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
1760         return owner->a;
1761 }
1762 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_a"))) TS_C2Tuple__u168_u168Z_get_a(uint64_t owner) {
1763         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
1764         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
1765         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_a(owner_conv).data, 8 * 2);
1766         return ret_arr;
1767 }
1768
1769 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
1770         return owner->b;
1771 }
1772 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_b"))) TS_C2Tuple__u168_u168Z_get_b(uint64_t owner) {
1773         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
1774         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
1775         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_b(owner_conv).data, 8 * 2);
1776         return ret_arr;
1777 }
1778
1779 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr(uint64_t ptr) {
1780         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
1781         switch(obj->tag) {
1782                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: return 0;
1783                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: return 1;
1784                 default: abort();
1785         }
1786 }
1787 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some(uint64_t ptr) {
1788         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
1789         assert(obj->tag == LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some);
1790                         LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
1791                         *some_conv = obj->some;
1792                         *some_conv = C2Tuple__u168_u168Z_clone(some_conv);
1793         return tag_ptr(some_conv, true);
1794 }
1795 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
1796         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
1797         for (size_t i = 0; i < ret.datalen; i++) {
1798                 ret.data[i] = NodeId_clone(&orig->data[i]);
1799         }
1800         return ret;
1801 }
1802 typedef struct LDKLogger_JCalls {
1803         atomic_size_t refcnt;
1804         uint32_t instance_ptr;
1805 } LDKLogger_JCalls;
1806 static void LDKLogger_JCalls_free(void* this_arg) {
1807         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1808         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1809                 FREE(j_calls);
1810         }
1811 }
1812 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
1813         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1814         LDKRecord record_var = *record;
1815         uint64_t record_ref = 0;
1816         record_var = Record_clone(&record_var);
1817         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
1818         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
1819         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
1820 }
1821 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
1822         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
1823         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1824 }
1825 static inline LDKLogger LDKLogger_init (JSValue o) {
1826         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1827         atomic_init(&calls->refcnt, 1);
1828         calls->instance_ptr = o;
1829
1830         LDKLogger ret = {
1831                 .this_arg = (void*) calls,
1832                 .log = log_LDKLogger_jcall,
1833                 .free = LDKLogger_JCalls_free,
1834         };
1835         return ret;
1836 }
1837 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
1838         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1839         *res_ptr = LDKLogger_init(o);
1840         return tag_ptr(res_ptr, true);
1841 }
1842 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
1843         LDKProbabilisticScorer ret = *owner->contents.result;
1844         ret.is_owned = false;
1845         return ret;
1846 }
1847 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
1848         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
1849         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
1850         uint64_t ret_ref = 0;
1851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1853         return ret_ref;
1854 }
1855
1856 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
1857 CHECK(!owner->result_ok);
1858         return DecodeError_clone(&*owner->contents.err);
1859 }
1860 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
1861         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
1862         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1863         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
1864         uint64_t ret_ref = tag_ptr(ret_copy, true);
1865         return ret_ref;
1866 }
1867
1868 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
1869         LDKInitFeatures ret = *owner->contents.result;
1870         ret.is_owned = false;
1871         return ret;
1872 }
1873 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1874         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
1875         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
1876         uint64_t ret_ref = 0;
1877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1879         return ret_ref;
1880 }
1881
1882 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
1883 CHECK(!owner->result_ok);
1884         return DecodeError_clone(&*owner->contents.err);
1885 }
1886 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1887         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
1888         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1889         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
1890         uint64_t ret_ref = tag_ptr(ret_copy, true);
1891         return ret_ref;
1892 }
1893
1894 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
1895         LDKChannelFeatures ret = *owner->contents.result;
1896         ret.is_owned = false;
1897         return ret;
1898 }
1899 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1900         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
1901         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
1902         uint64_t ret_ref = 0;
1903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1905         return ret_ref;
1906 }
1907
1908 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
1909 CHECK(!owner->result_ok);
1910         return DecodeError_clone(&*owner->contents.err);
1911 }
1912 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1913         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
1914         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1915         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
1916         uint64_t ret_ref = tag_ptr(ret_copy, true);
1917         return ret_ref;
1918 }
1919
1920 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
1921         LDKNodeFeatures ret = *owner->contents.result;
1922         ret.is_owned = false;
1923         return ret;
1924 }
1925 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1926         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
1927         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
1928         uint64_t ret_ref = 0;
1929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1931         return ret_ref;
1932 }
1933
1934 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
1935 CHECK(!owner->result_ok);
1936         return DecodeError_clone(&*owner->contents.err);
1937 }
1938 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1939         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
1940         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1941         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
1942         uint64_t ret_ref = tag_ptr(ret_copy, true);
1943         return ret_ref;
1944 }
1945
1946 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
1947         LDKInvoiceFeatures ret = *owner->contents.result;
1948         ret.is_owned = false;
1949         return ret;
1950 }
1951 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1952         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
1953         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
1954         uint64_t ret_ref = 0;
1955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1957         return ret_ref;
1958 }
1959
1960 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
1961 CHECK(!owner->result_ok);
1962         return DecodeError_clone(&*owner->contents.err);
1963 }
1964 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1965         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
1966         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1967         *ret_copy = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
1968         uint64_t ret_ref = tag_ptr(ret_copy, true);
1969         return ret_ref;
1970 }
1971
1972 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
1973         LDKBlindedHopFeatures ret = *owner->contents.result;
1974         ret.is_owned = false;
1975         return ret;
1976 }
1977 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1978         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
1979         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
1980         uint64_t ret_ref = 0;
1981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1983         return ret_ref;
1984 }
1985
1986 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
1987 CHECK(!owner->result_ok);
1988         return DecodeError_clone(&*owner->contents.err);
1989 }
1990 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1991         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
1992         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1993         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
1994         uint64_t ret_ref = tag_ptr(ret_copy, true);
1995         return ret_ref;
1996 }
1997
1998 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
1999         LDKChannelTypeFeatures ret = *owner->contents.result;
2000         ret.is_owned = false;
2001         return ret;
2002 }
2003 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2004         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2005         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2006         uint64_t ret_ref = 0;
2007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2009         return ret_ref;
2010 }
2011
2012 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2013 CHECK(!owner->result_ok);
2014         return DecodeError_clone(&*owner->contents.err);
2015 }
2016 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2017         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2018         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2019         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2020         uint64_t ret_ref = tag_ptr(ret_copy, true);
2021         return ret_ref;
2022 }
2023
2024 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
2025         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2026         switch(obj->tag) {
2027                 case LDKPaymentPurpose_InvoicePayment: return 0;
2028                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
2029                 default: abort();
2030         }
2031 }
2032 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
2033         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2034         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
2035                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
2036                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
2037         return payment_preimage_arr;
2038 }
2039 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
2040         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2041         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
2042                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
2043                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
2044         return payment_secret_arr;
2045 }
2046 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
2047         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2048         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
2049                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
2050                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
2051         return spontaneous_payment_arr;
2052 }
2053 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
2054 CHECK(owner->result_ok);
2055         return PaymentPurpose_clone(&*owner->contents.result);
2056 }
2057 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
2058         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
2059         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
2060         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
2061         uint64_t ret_ref = tag_ptr(ret_copy, true);
2062         return ret_ref;
2063 }
2064
2065 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
2066 CHECK(!owner->result_ok);
2067         return DecodeError_clone(&*owner->contents.err);
2068 }
2069 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
2070         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
2071         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2072         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
2073         uint64_t ret_ref = tag_ptr(ret_copy, true);
2074         return ret_ref;
2075 }
2076
2077 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
2078         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2079         switch(obj->tag) {
2080                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
2081                 case LDKNetworkUpdate_ChannelFailure: return 1;
2082                 case LDKNetworkUpdate_NodeFailure: return 2;
2083                 default: abort();
2084         }
2085 }
2086 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
2087         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2088         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
2089                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2090                         uint64_t msg_ref = 0;
2091                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2092                         msg_ref = tag_ptr(msg_var.inner, false);
2093         return msg_ref;
2094 }
2095 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
2096         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2097         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
2098                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2099         return short_channel_id_conv;
2100 }
2101 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
2102         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2103         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
2104                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2105         return is_permanent_conv;
2106 }
2107 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
2108         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2109         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
2110                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2111                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
2112         return node_id_arr;
2113 }
2114 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
2115         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2116         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
2117                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
2118         return is_permanent_conv;
2119 }
2120 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
2121         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
2122         switch(obj->tag) {
2123                 case LDKCOption_NetworkUpdateZ_Some: return 0;
2124                 case LDKCOption_NetworkUpdateZ_None: return 1;
2125                 default: abort();
2126         }
2127 }
2128 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
2129         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
2130         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
2131                         uint64_t some_ref = tag_ptr(&obj->some, false);
2132         return some_ref;
2133 }
2134 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
2135         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
2136         switch(obj->tag) {
2137                 case LDKPathFailure_InitialSend: return 0;
2138                 case LDKPathFailure_OnPath: return 1;
2139                 default: abort();
2140         }
2141 }
2142 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
2143         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
2144         assert(obj->tag == LDKPathFailure_InitialSend);
2145                         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
2146         return err_ref;
2147 }
2148 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
2149         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
2150         assert(obj->tag == LDKPathFailure_OnPath);
2151                         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
2152         return network_update_ref;
2153 }
2154 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
2155         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
2156         switch(obj->tag) {
2157                 case LDKCOption_PathFailureZ_Some: return 0;
2158                 case LDKCOption_PathFailureZ_None: return 1;
2159                 default: abort();
2160         }
2161 }
2162 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
2163         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
2164         assert(obj->tag == LDKCOption_PathFailureZ_Some);
2165                         uint64_t some_ref = tag_ptr(&obj->some, false);
2166         return some_ref;
2167 }
2168 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
2169 CHECK(owner->result_ok);
2170         return COption_PathFailureZ_clone(&*owner->contents.result);
2171 }
2172 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
2173         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
2174         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
2175         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
2176         uint64_t ret_ref = tag_ptr(ret_copy, true);
2177         return ret_ref;
2178 }
2179
2180 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
2181 CHECK(!owner->result_ok);
2182         return DecodeError_clone(&*owner->contents.err);
2183 }
2184 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
2185         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
2186         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2187         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
2188         uint64_t ret_ref = tag_ptr(ret_copy, true);
2189         return ret_ref;
2190 }
2191
2192 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
2193         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
2194         switch(obj->tag) {
2195                 case LDKClosureReason_CounterpartyForceClosed: return 0;
2196                 case LDKClosureReason_HolderForceClosed: return 1;
2197                 case LDKClosureReason_CooperativeClosure: return 2;
2198                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
2199                 case LDKClosureReason_FundingTimedOut: return 4;
2200                 case LDKClosureReason_ProcessingError: return 5;
2201                 case LDKClosureReason_DisconnectedPeer: return 6;
2202                 case LDKClosureReason_OutdatedChannelManager: return 7;
2203                 default: abort();
2204         }
2205 }
2206 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
2207         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
2208         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
2209                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
2210                         uint64_t peer_msg_ref = 0;
2211                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
2212                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
2213         return peer_msg_ref;
2214 }
2215 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
2216         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
2217         assert(obj->tag == LDKClosureReason_ProcessingError);
2218                         LDKStr err_str = obj->processing_error.err;
2219                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2220         return err_conv;
2221 }
2222 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
2223         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
2224         switch(obj->tag) {
2225                 case LDKCOption_ClosureReasonZ_Some: return 0;
2226                 case LDKCOption_ClosureReasonZ_None: return 1;
2227                 default: abort();
2228         }
2229 }
2230 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
2231         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
2232         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
2233                         uint64_t some_ref = tag_ptr(&obj->some, false);
2234         return some_ref;
2235 }
2236 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2237 CHECK(owner->result_ok);
2238         return COption_ClosureReasonZ_clone(&*owner->contents.result);
2239 }
2240 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
2241         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2242         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2243         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2244         uint64_t ret_ref = tag_ptr(ret_copy, true);
2245         return ret_ref;
2246 }
2247
2248 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2249 CHECK(!owner->result_ok);
2250         return DecodeError_clone(&*owner->contents.err);
2251 }
2252 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
2253         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2254         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2255         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2256         uint64_t ret_ref = tag_ptr(ret_copy, true);
2257         return ret_ref;
2258 }
2259
2260 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
2261         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2262         switch(obj->tag) {
2263                 case LDKHTLCDestination_NextHopChannel: return 0;
2264                 case LDKHTLCDestination_UnknownNextHop: return 1;
2265                 case LDKHTLCDestination_InvalidForward: return 2;
2266                 case LDKHTLCDestination_FailedPayment: return 3;
2267                 default: abort();
2268         }
2269 }
2270 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
2271         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2272         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
2273                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2274                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
2275         return node_id_arr;
2276 }
2277 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
2278         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2279         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
2280                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2281                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
2282         return channel_id_arr;
2283 }
2284 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
2285         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2286         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
2287                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
2288         return requested_forward_scid_conv;
2289 }
2290 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
2291         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2292         assert(obj->tag == LDKHTLCDestination_InvalidForward);
2293                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
2294         return requested_forward_scid_conv;
2295 }
2296 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
2297         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2298         assert(obj->tag == LDKHTLCDestination_FailedPayment);
2299                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2300                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
2301         return payment_hash_arr;
2302 }
2303 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
2304         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
2305         switch(obj->tag) {
2306                 case LDKCOption_HTLCDestinationZ_Some: return 0;
2307                 case LDKCOption_HTLCDestinationZ_None: return 1;
2308                 default: abort();
2309         }
2310 }
2311 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
2312         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
2313         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
2314                         uint64_t some_ref = tag_ptr(&obj->some, false);
2315         return some_ref;
2316 }
2317 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2318 CHECK(owner->result_ok);
2319         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
2320 }
2321 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
2322         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2323         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
2324         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
2325         uint64_t ret_ref = tag_ptr(ret_copy, true);
2326         return ret_ref;
2327 }
2328
2329 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2330 CHECK(!owner->result_ok);
2331         return DecodeError_clone(&*owner->contents.err);
2332 }
2333 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
2334         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2335         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2336         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
2337         uint64_t ret_ref = tag_ptr(ret_copy, true);
2338         return ret_ref;
2339 }
2340
2341 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
2342 CHECK(owner->result_ok);
2343         return PaymentFailureReason_clone(&*owner->contents.result);
2344 }
2345 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
2346         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
2347         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
2348         return ret_conv;
2349 }
2350
2351 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
2352 CHECK(!owner->result_ok);
2353         return DecodeError_clone(&*owner->contents.err);
2354 }
2355 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
2356         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
2357         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2358         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
2359         uint64_t ret_ref = tag_ptr(ret_copy, true);
2360         return ret_ref;
2361 }
2362
2363 uint32_t __attribute__((export_name("TS_LDKCOption_u128Z_ty_from_ptr"))) TS_LDKCOption_u128Z_ty_from_ptr(uint64_t ptr) {
2364         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
2365         switch(obj->tag) {
2366                 case LDKCOption_u128Z_Some: return 0;
2367                 case LDKCOption_u128Z_None: return 1;
2368                 default: abort();
2369         }
2370 }
2371 int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS_LDKCOption_u128Z_Some_get_some(uint64_t ptr) {
2372         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
2373         assert(obj->tag == LDKCOption_u128Z_Some);
2374                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
2375                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
2376         return some_arr;
2377 }
2378 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
2379         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
2380         switch(obj->tag) {
2381                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
2382                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
2383                 default: abort();
2384         }
2385 }
2386 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
2387         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
2388         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
2389                         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
2390         return some_conv;
2391 }
2392 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
2393         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2394         switch(obj->tag) {
2395                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
2396                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
2397                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
2398                 default: abort();
2399         }
2400 }
2401 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
2402         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2403         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
2404                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2405                         uint64_t outpoint_ref = 0;
2406                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2407                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2408         return outpoint_ref;
2409 }
2410 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
2411         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2412         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
2413                         LDKTxOut* output_ref = &obj->static_output.output;
2414         return tag_ptr(output_ref, false);
2415 }
2416 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
2417         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2418         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
2419                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2420                         uint64_t delayed_payment_output_ref = 0;
2421                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2422                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2423         return delayed_payment_output_ref;
2424 }
2425 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
2426         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2427         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
2428                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2429                         uint64_t static_payment_output_ref = 0;
2430                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2431                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2432         return static_payment_output_ref;
2433 }
2434 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2435         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2436         for (size_t i = 0; i < ret.datalen; i++) {
2437                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2438         }
2439         return ret;
2440 }
2441 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
2442         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2443         switch(obj->tag) {
2444                 case LDKEvent_FundingGenerationReady: return 0;
2445                 case LDKEvent_PaymentClaimable: return 1;
2446                 case LDKEvent_PaymentClaimed: return 2;
2447                 case LDKEvent_PaymentSent: return 3;
2448                 case LDKEvent_PaymentFailed: return 4;
2449                 case LDKEvent_PaymentPathSuccessful: return 5;
2450                 case LDKEvent_PaymentPathFailed: return 6;
2451                 case LDKEvent_ProbeSuccessful: return 7;
2452                 case LDKEvent_ProbeFailed: return 8;
2453                 case LDKEvent_PendingHTLCsForwardable: return 9;
2454                 case LDKEvent_HTLCIntercepted: return 10;
2455                 case LDKEvent_SpendableOutputs: return 11;
2456                 case LDKEvent_PaymentForwarded: return 12;
2457                 case LDKEvent_ChannelPending: return 13;
2458                 case LDKEvent_ChannelReady: return 14;
2459                 case LDKEvent_ChannelClosed: return 15;
2460                 case LDKEvent_DiscardFunding: return 16;
2461                 case LDKEvent_OpenChannelRequest: return 17;
2462                 case LDKEvent_HTLCHandlingFailed: return 18;
2463                 default: abort();
2464         }
2465 }
2466 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
2467         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2468         assert(obj->tag == LDKEvent_FundingGenerationReady);
2469                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2470                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
2471         return temporary_channel_id_arr;
2472 }
2473 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
2474         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2475         assert(obj->tag == LDKEvent_FundingGenerationReady);
2476                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2477                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
2478         return counterparty_node_id_arr;
2479 }
2480 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
2481         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2482         assert(obj->tag == LDKEvent_FundingGenerationReady);
2483                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
2484         return channel_value_satoshis_conv;
2485 }
2486 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
2487         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2488         assert(obj->tag == LDKEvent_FundingGenerationReady);
2489                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2490                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
2491                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
2492         return output_script_arr;
2493 }
2494 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
2495         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2496         assert(obj->tag == LDKEvent_FundingGenerationReady);
2497                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2498                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
2499         return user_channel_id_arr;
2500 }
2501 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
2502         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2503         assert(obj->tag == LDKEvent_PaymentClaimable);
2504                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
2505                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
2506         return receiver_node_id_arr;
2507 }
2508 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
2509         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2510         assert(obj->tag == LDKEvent_PaymentClaimable);
2511                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2512                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
2513         return payment_hash_arr;
2514 }
2515 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
2516         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2517         assert(obj->tag == LDKEvent_PaymentClaimable);
2518                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
2519                         uint64_t onion_fields_ref = 0;
2520                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
2521                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
2522         return onion_fields_ref;
2523 }
2524 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
2525         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2526         assert(obj->tag == LDKEvent_PaymentClaimable);
2527                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
2528         return amount_msat_conv;
2529 }
2530 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
2531         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2532         assert(obj->tag == LDKEvent_PaymentClaimable);
2533                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
2534         return purpose_ref;
2535 }
2536 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
2537         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2538         assert(obj->tag == LDKEvent_PaymentClaimable);
2539                         int8_tArray via_channel_id_arr = init_int8_tArray(32, __LINE__);
2540                         memcpy(via_channel_id_arr->elems, obj->payment_claimable.via_channel_id.data, 32);
2541         return via_channel_id_arr;
2542 }
2543 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
2544         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2545         assert(obj->tag == LDKEvent_PaymentClaimable);
2546                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
2547         return via_user_channel_id_ref;
2548 }
2549 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
2550         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2551         assert(obj->tag == LDKEvent_PaymentClaimable);
2552                         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
2553         return claim_deadline_ref;
2554 }
2555 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
2556         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2557         assert(obj->tag == LDKEvent_PaymentClaimed);
2558                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
2559                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
2560         return receiver_node_id_arr;
2561 }
2562 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
2563         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2564         assert(obj->tag == LDKEvent_PaymentClaimed);
2565                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2566                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
2567         return payment_hash_arr;
2568 }
2569 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
2570         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2571         assert(obj->tag == LDKEvent_PaymentClaimed);
2572                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
2573         return amount_msat_conv;
2574 }
2575 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
2576         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2577         assert(obj->tag == LDKEvent_PaymentClaimed);
2578                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
2579         return purpose_ref;
2580 }
2581 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
2582         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2583         assert(obj->tag == LDKEvent_PaymentSent);
2584                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2585                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
2586         return payment_id_arr;
2587 }
2588 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
2589         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2590         assert(obj->tag == LDKEvent_PaymentSent);
2591                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
2592                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
2593         return payment_preimage_arr;
2594 }
2595 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
2596         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2597         assert(obj->tag == LDKEvent_PaymentSent);
2598                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2599                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
2600         return payment_hash_arr;
2601 }
2602 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
2603         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2604         assert(obj->tag == LDKEvent_PaymentSent);
2605                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
2606         return fee_paid_msat_ref;
2607 }
2608 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
2609         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2610         assert(obj->tag == LDKEvent_PaymentFailed);
2611                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2612                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
2613         return payment_id_arr;
2614 }
2615 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
2616         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2617         assert(obj->tag == LDKEvent_PaymentFailed);
2618                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2619                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
2620         return payment_hash_arr;
2621 }
2622 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
2623         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2624         assert(obj->tag == LDKEvent_PaymentFailed);
2625                         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
2626         return reason_ref;
2627 }
2628 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
2629         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2630         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
2631                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2632                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
2633         return payment_id_arr;
2634 }
2635 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
2636         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2637         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
2638                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2639                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
2640         return payment_hash_arr;
2641 }
2642 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
2643         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2644         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
2645                         LDKPath path_var = obj->payment_path_successful.path;
2646                         uint64_t path_ref = 0;
2647                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2648                         path_ref = tag_ptr(path_var.inner, false);
2649         return path_ref;
2650 }
2651 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
2652         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2653         assert(obj->tag == LDKEvent_PaymentPathFailed);
2654                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2655                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
2656         return payment_id_arr;
2657 }
2658 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
2659         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2660         assert(obj->tag == LDKEvent_PaymentPathFailed);
2661                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2662                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
2663         return payment_hash_arr;
2664 }
2665 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
2666         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2667         assert(obj->tag == LDKEvent_PaymentPathFailed);
2668                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
2669         return payment_failed_permanently_conv;
2670 }
2671 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
2672         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2673         assert(obj->tag == LDKEvent_PaymentPathFailed);
2674                         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
2675         return failure_ref;
2676 }
2677 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
2678         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2679         assert(obj->tag == LDKEvent_PaymentPathFailed);
2680                         LDKPath path_var = obj->payment_path_failed.path;
2681                         uint64_t path_ref = 0;
2682                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2683                         path_ref = tag_ptr(path_var.inner, false);
2684         return path_ref;
2685 }
2686 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
2687         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2688         assert(obj->tag == LDKEvent_PaymentPathFailed);
2689                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
2690         return short_channel_id_ref;
2691 }
2692 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
2693         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2694         assert(obj->tag == LDKEvent_ProbeSuccessful);
2695                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2696                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
2697         return payment_id_arr;
2698 }
2699 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
2700         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2701         assert(obj->tag == LDKEvent_ProbeSuccessful);
2702                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2703                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
2704         return payment_hash_arr;
2705 }
2706 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
2707         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2708         assert(obj->tag == LDKEvent_ProbeSuccessful);
2709                         LDKPath path_var = obj->probe_successful.path;
2710                         uint64_t path_ref = 0;
2711                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2712                         path_ref = tag_ptr(path_var.inner, false);
2713         return path_ref;
2714 }
2715 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
2716         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2717         assert(obj->tag == LDKEvent_ProbeFailed);
2718                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2719                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
2720         return payment_id_arr;
2721 }
2722 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
2723         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2724         assert(obj->tag == LDKEvent_ProbeFailed);
2725                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2726                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
2727         return payment_hash_arr;
2728 }
2729 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
2730         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2731         assert(obj->tag == LDKEvent_ProbeFailed);
2732                         LDKPath path_var = obj->probe_failed.path;
2733                         uint64_t path_ref = 0;
2734                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2735                         path_ref = tag_ptr(path_var.inner, false);
2736         return path_ref;
2737 }
2738 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
2739         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2740         assert(obj->tag == LDKEvent_ProbeFailed);
2741                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
2742         return short_channel_id_ref;
2743 }
2744 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
2745         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2746         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
2747                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2748         return time_forwardable_conv;
2749 }
2750 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
2751         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2752         assert(obj->tag == LDKEvent_HTLCIntercepted);
2753                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
2754                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
2755         return intercept_id_arr;
2756 }
2757 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
2758         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2759         assert(obj->tag == LDKEvent_HTLCIntercepted);
2760                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
2761         return requested_next_hop_scid_conv;
2762 }
2763 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
2764         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2765         assert(obj->tag == LDKEvent_HTLCIntercepted);
2766                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2767                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
2768         return payment_hash_arr;
2769 }
2770 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
2771         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2772         assert(obj->tag == LDKEvent_HTLCIntercepted);
2773                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
2774         return inbound_amount_msat_conv;
2775 }
2776 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
2777         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2778         assert(obj->tag == LDKEvent_HTLCIntercepted);
2779                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
2780         return expected_outbound_amount_msat_conv;
2781 }
2782 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
2783         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2784         assert(obj->tag == LDKEvent_SpendableOutputs);
2785                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2786                         uint64_tArray outputs_arr = NULL;
2787                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
2788                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
2789                         for (size_t b = 0; b < outputs_var.datalen; b++) {
2790                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
2791                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
2792                         }
2793                         
2794         return outputs_arr;
2795 }
2796 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
2797         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2798         assert(obj->tag == LDKEvent_PaymentForwarded);
2799                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2800                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
2801         return prev_channel_id_arr;
2802 }
2803 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
2804         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2805         assert(obj->tag == LDKEvent_PaymentForwarded);
2806                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
2807                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
2808         return next_channel_id_arr;
2809 }
2810 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
2811         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2812         assert(obj->tag == LDKEvent_PaymentForwarded);
2813                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
2814         return fee_earned_msat_ref;
2815 }
2816 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
2817         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2818         assert(obj->tag == LDKEvent_PaymentForwarded);
2819                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2820         return claim_from_onchain_tx_conv;
2821 }
2822 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
2823         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2824         assert(obj->tag == LDKEvent_PaymentForwarded);
2825                         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
2826         return outbound_amount_forwarded_msat_ref;
2827 }
2828 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
2829         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2830         assert(obj->tag == LDKEvent_ChannelPending);
2831                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2832                         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
2833         return channel_id_arr;
2834 }
2835 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
2836         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2837         assert(obj->tag == LDKEvent_ChannelPending);
2838                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2839                         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
2840         return user_channel_id_arr;
2841 }
2842 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
2843         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2844         assert(obj->tag == LDKEvent_ChannelPending);
2845                         int8_tArray former_temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2846                         memcpy(former_temporary_channel_id_arr->elems, obj->channel_pending.former_temporary_channel_id.data, 32);
2847         return former_temporary_channel_id_arr;
2848 }
2849 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
2850         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2851         assert(obj->tag == LDKEvent_ChannelPending);
2852                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2853                         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
2854         return counterparty_node_id_arr;
2855 }
2856 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
2857         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2858         assert(obj->tag == LDKEvent_ChannelPending);
2859                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
2860                         uint64_t funding_txo_ref = 0;
2861                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2862                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2863         return funding_txo_ref;
2864 }
2865 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
2866         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2867         assert(obj->tag == LDKEvent_ChannelReady);
2868                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2869                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
2870         return channel_id_arr;
2871 }
2872 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
2873         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2874         assert(obj->tag == LDKEvent_ChannelReady);
2875                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2876                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
2877         return user_channel_id_arr;
2878 }
2879 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
2880         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2881         assert(obj->tag == LDKEvent_ChannelReady);
2882                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2883                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
2884         return counterparty_node_id_arr;
2885 }
2886 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
2887         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2888         assert(obj->tag == LDKEvent_ChannelReady);
2889                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
2890                         uint64_t channel_type_ref = 0;
2891                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2892                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2893         return channel_type_ref;
2894 }
2895 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
2896         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2897         assert(obj->tag == LDKEvent_ChannelClosed);
2898                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2899                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
2900         return channel_id_arr;
2901 }
2902 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
2903         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2904         assert(obj->tag == LDKEvent_ChannelClosed);
2905                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2906                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
2907         return user_channel_id_arr;
2908 }
2909 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
2910         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2911         assert(obj->tag == LDKEvent_ChannelClosed);
2912                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
2913         return reason_ref;
2914 }
2915 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
2916         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2917         assert(obj->tag == LDKEvent_DiscardFunding);
2918                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2919                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
2920         return channel_id_arr;
2921 }
2922 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
2923         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2924         assert(obj->tag == LDKEvent_DiscardFunding);
2925                         LDKTransaction transaction_var = obj->discard_funding.transaction;
2926                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
2927                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
2928         return transaction_arr;
2929 }
2930 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
2931         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2932         assert(obj->tag == LDKEvent_OpenChannelRequest);
2933                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2934                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
2935         return temporary_channel_id_arr;
2936 }
2937 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
2938         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2939         assert(obj->tag == LDKEvent_OpenChannelRequest);
2940                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2941                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
2942         return counterparty_node_id_arr;
2943 }
2944 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
2945         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2946         assert(obj->tag == LDKEvent_OpenChannelRequest);
2947                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2948         return funding_satoshis_conv;
2949 }
2950 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
2951         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2952         assert(obj->tag == LDKEvent_OpenChannelRequest);
2953                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2954         return push_msat_conv;
2955 }
2956 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
2957         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2958         assert(obj->tag == LDKEvent_OpenChannelRequest);
2959                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2960                         uint64_t channel_type_ref = 0;
2961                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2962                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2963         return channel_type_ref;
2964 }
2965 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2966         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2967         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2968                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2969                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2970         return prev_channel_id_arr;
2971 }
2972 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2973         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2974         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2975                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2976         return failed_next_destination_ref;
2977 }
2978 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2979         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2980         switch(obj->tag) {
2981                 case LDKCOption_EventZ_Some: return 0;
2982                 case LDKCOption_EventZ_None: return 1;
2983                 default: abort();
2984         }
2985 }
2986 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2987         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2988         assert(obj->tag == LDKCOption_EventZ_Some);
2989                         uint64_t some_ref = tag_ptr(&obj->some, false);
2990         return some_ref;
2991 }
2992 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2993 CHECK(owner->result_ok);
2994         return COption_EventZ_clone(&*owner->contents.result);
2995 }
2996 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2997         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2998         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2999         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
3000         uint64_t ret_ref = tag_ptr(ret_copy, true);
3001         return ret_ref;
3002 }
3003
3004 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3005 CHECK(!owner->result_ok);
3006         return DecodeError_clone(&*owner->contents.err);
3007 }
3008 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
3009         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
3010         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3011         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
3012         uint64_t ret_ref = tag_ptr(ret_copy, true);
3013         return ret_ref;
3014 }
3015
3016 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
3017         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3018         switch(obj->tag) {
3019                 case LDKErrorAction_DisconnectPeer: return 0;
3020                 case LDKErrorAction_IgnoreError: return 1;
3021                 case LDKErrorAction_IgnoreAndLog: return 2;
3022                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
3023                 case LDKErrorAction_SendErrorMessage: return 4;
3024                 case LDKErrorAction_SendWarningMessage: return 5;
3025                 default: abort();
3026         }
3027 }
3028 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
3029         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3030         assert(obj->tag == LDKErrorAction_DisconnectPeer);
3031                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3032                         uint64_t msg_ref = 0;
3033                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3034                         msg_ref = tag_ptr(msg_var.inner, false);
3035         return msg_ref;
3036 }
3037 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
3038         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3039         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
3040                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
3041         return ignore_and_log_conv;
3042 }
3043 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
3044         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3045         assert(obj->tag == LDKErrorAction_SendErrorMessage);
3046                         LDKErrorMessage msg_var = obj->send_error_message.msg;
3047                         uint64_t msg_ref = 0;
3048                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3049                         msg_ref = tag_ptr(msg_var.inner, false);
3050         return msg_ref;
3051 }
3052 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
3053         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3054         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3055                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3056                         uint64_t msg_ref = 0;
3057                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3058                         msg_ref = tag_ptr(msg_var.inner, false);
3059         return msg_ref;
3060 }
3061 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
3062         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3063         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3064                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
3065         return log_level_conv;
3066 }
3067 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
3068         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3069         switch(obj->tag) {
3070                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
3071                 case LDKMessageSendEvent_SendOpenChannel: return 1;
3072                 case LDKMessageSendEvent_SendFundingCreated: return 2;
3073                 case LDKMessageSendEvent_SendFundingSigned: return 3;
3074                 case LDKMessageSendEvent_SendChannelReady: return 4;
3075                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
3076                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
3077                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
3078                 case LDKMessageSendEvent_SendClosingSigned: return 8;
3079                 case LDKMessageSendEvent_SendShutdown: return 9;
3080                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
3081                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
3082                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
3083                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
3084                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 14;
3085                 case LDKMessageSendEvent_SendChannelUpdate: return 15;
3086                 case LDKMessageSendEvent_HandleError: return 16;
3087                 case LDKMessageSendEvent_SendChannelRangeQuery: return 17;
3088                 case LDKMessageSendEvent_SendShortIdsQuery: return 18;
3089                 case LDKMessageSendEvent_SendReplyChannelRange: return 19;
3090                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 20;
3091                 default: abort();
3092         }
3093 }
3094 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
3095         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3096         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3097                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3098                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
3099         return node_id_arr;
3100 }
3101 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
3102         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3103         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3104                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3105                         uint64_t msg_ref = 0;
3106                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3107                         msg_ref = tag_ptr(msg_var.inner, false);
3108         return msg_ref;
3109 }
3110 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
3111         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3112         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3113                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3114                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
3115         return node_id_arr;
3116 }
3117 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
3118         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3119         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3120                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3121                         uint64_t msg_ref = 0;
3122                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3123                         msg_ref = tag_ptr(msg_var.inner, false);
3124         return msg_ref;
3125 }
3126 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
3127         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3128         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3129                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3130                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
3131         return node_id_arr;
3132 }
3133 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
3134         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3135         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3136                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3137                         uint64_t msg_ref = 0;
3138                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3139                         msg_ref = tag_ptr(msg_var.inner, false);
3140         return msg_ref;
3141 }
3142 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
3143         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3144         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3145                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3146                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
3147         return node_id_arr;
3148 }
3149 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
3150         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3151         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3152                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3153                         uint64_t msg_ref = 0;
3154                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3155                         msg_ref = tag_ptr(msg_var.inner, false);
3156         return msg_ref;
3157 }
3158 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
3159         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3160         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3161                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3162                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
3163         return node_id_arr;
3164 }
3165 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
3166         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3167         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3168                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
3169                         uint64_t msg_ref = 0;
3170                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3171                         msg_ref = tag_ptr(msg_var.inner, false);
3172         return msg_ref;
3173 }
3174 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
3175         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3176         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3177                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3178                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
3179         return node_id_arr;
3180 }
3181 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
3182         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3183         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3184                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3185                         uint64_t msg_ref = 0;
3186                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3187                         msg_ref = tag_ptr(msg_var.inner, false);
3188         return msg_ref;
3189 }
3190 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
3191         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3192         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3193                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3194                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
3195         return node_id_arr;
3196 }
3197 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
3198         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3199         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3200                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3201                         uint64_t updates_ref = 0;
3202                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3203                         updates_ref = tag_ptr(updates_var.inner, false);
3204         return updates_ref;
3205 }
3206 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
3207         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3208         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3209                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3210                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
3211         return node_id_arr;
3212 }
3213 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
3214         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3215         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3216                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3217                         uint64_t msg_ref = 0;
3218                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3219                         msg_ref = tag_ptr(msg_var.inner, false);
3220         return msg_ref;
3221 }
3222 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
3223         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3224         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3225                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3226                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
3227         return node_id_arr;
3228 }
3229 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
3230         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3231         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3232                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3233                         uint64_t msg_ref = 0;
3234                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3235                         msg_ref = tag_ptr(msg_var.inner, false);
3236         return msg_ref;
3237 }
3238 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
3239         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3240         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3241                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3242                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
3243         return node_id_arr;
3244 }
3245 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
3246         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3247         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3248                         LDKShutdown msg_var = obj->send_shutdown.msg;
3249                         uint64_t msg_ref = 0;
3250                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3251                         msg_ref = tag_ptr(msg_var.inner, false);
3252         return msg_ref;
3253 }
3254 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
3255         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3256         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3257                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3258                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
3259         return node_id_arr;
3260 }
3261 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
3262         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3263         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3264                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3265                         uint64_t msg_ref = 0;
3266                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3267                         msg_ref = tag_ptr(msg_var.inner, false);
3268         return msg_ref;
3269 }
3270 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
3271         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3272         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3273                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3274                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
3275         return node_id_arr;
3276 }
3277 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
3278         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3279         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3280                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
3281                         uint64_t msg_ref = 0;
3282                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3283                         msg_ref = tag_ptr(msg_var.inner, false);
3284         return msg_ref;
3285 }
3286 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
3287         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3288         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3289                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
3290                         uint64_t update_msg_ref = 0;
3291                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3292                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
3293         return update_msg_ref;
3294 }
3295 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
3296         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3297         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3298                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3299                         uint64_t msg_ref = 0;
3300                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3301                         msg_ref = tag_ptr(msg_var.inner, false);
3302         return msg_ref;
3303 }
3304 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
3305         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3306         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3307                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
3308                         uint64_t update_msg_ref = 0;
3309                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3310                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
3311         return update_msg_ref;
3312 }
3313 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
3314         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3315         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
3316                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
3317                         uint64_t msg_ref = 0;
3318                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3319                         msg_ref = tag_ptr(msg_var.inner, false);
3320         return msg_ref;
3321 }
3322 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
3323         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3324         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
3325                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
3326                         uint64_t msg_ref = 0;
3327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3328                         msg_ref = tag_ptr(msg_var.inner, false);
3329         return msg_ref;
3330 }
3331 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
3332         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3333         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
3334                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3335                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
3336         return node_id_arr;
3337 }
3338 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
3339         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3340         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
3341                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
3342                         uint64_t msg_ref = 0;
3343                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3344                         msg_ref = tag_ptr(msg_var.inner, false);
3345         return msg_ref;
3346 }
3347 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
3348         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3349         assert(obj->tag == LDKMessageSendEvent_HandleError);
3350                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3351                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
3352         return node_id_arr;
3353 }
3354 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
3355         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3356         assert(obj->tag == LDKMessageSendEvent_HandleError);
3357                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
3358         return action_ref;
3359 }
3360 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
3361         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3362         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
3363                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3364                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
3365         return node_id_arr;
3366 }
3367 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
3368         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3369         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
3370                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3371                         uint64_t msg_ref = 0;
3372                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3373                         msg_ref = tag_ptr(msg_var.inner, false);
3374         return msg_ref;
3375 }
3376 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
3377         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3378         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
3379                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3380                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
3381         return node_id_arr;
3382 }
3383 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
3384         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3385         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
3386                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3387                         uint64_t msg_ref = 0;
3388                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3389                         msg_ref = tag_ptr(msg_var.inner, false);
3390         return msg_ref;
3391 }
3392 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
3393         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3394         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
3395                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3396                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
3397         return node_id_arr;
3398 }
3399 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
3400         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3401         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
3402                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3403                         uint64_t msg_ref = 0;
3404                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3405                         msg_ref = tag_ptr(msg_var.inner, false);
3406         return msg_ref;
3407 }
3408 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
3409         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3410         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
3411                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3412                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
3413         return node_id_arr;
3414 }
3415 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
3416         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3417         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
3418                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3419                         uint64_t msg_ref = 0;
3420                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3421                         msg_ref = tag_ptr(msg_var.inner, false);
3422         return msg_ref;
3423 }
3424 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3425         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3426         for (size_t i = 0; i < ret.datalen; i++) {
3427                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3428         }
3429         return ret;
3430 }
3431 static inline LDKCVec_ChainHashZ CVec_ChainHashZ_clone(const LDKCVec_ChainHashZ *orig) {
3432         LDKCVec_ChainHashZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ChainHashZ clone bytes"), .datalen = orig->datalen };
3433         for (size_t i = 0; i < ret.datalen; i++) {
3434                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3435         }
3436         return ret;
3437 }
3438 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
3439 CHECK(owner->result_ok);
3440         return *owner->contents.result;
3441 }
3442 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
3443         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
3444         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3445         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
3446         return ret_arr;
3447 }
3448
3449 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
3450 CHECK(!owner->result_ok);
3451         return *owner->contents.err;
3452 }
3453 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
3454         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
3455         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
3456         return ret_conv;
3457 }
3458
3459 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3460         LDKNodeId ret = *owner->contents.result;
3461         ret.is_owned = false;
3462         return ret;
3463 }
3464 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3465         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3466         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3467         uint64_t ret_ref = 0;
3468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3470         return ret_ref;
3471 }
3472
3473 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3474 CHECK(!owner->result_ok);
3475         return DecodeError_clone(&*owner->contents.err);
3476 }
3477 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3478         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3479         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3480         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3481         uint64_t ret_ref = tag_ptr(ret_copy, true);
3482         return ret_ref;
3483 }
3484
3485 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3486 CHECK(owner->result_ok);
3487         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3488 }
3489 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3490         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3491         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3492         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3493         uint64_t ret_ref = tag_ptr(ret_copy, true);
3494         return ret_ref;
3495 }
3496
3497 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3498 CHECK(!owner->result_ok);
3499         return DecodeError_clone(&*owner->contents.err);
3500 }
3501 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3502         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3503         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3504         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3505         uint64_t ret_ref = tag_ptr(ret_copy, true);
3506         return ret_ref;
3507 }
3508
3509 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3510 CHECK(owner->result_ok);
3511         return TxOut_clone(&*owner->contents.result);
3512 }
3513 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3514         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3515         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3516         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3517         return tag_ptr(ret_ref, true);
3518 }
3519
3520 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3521 CHECK(!owner->result_ok);
3522         return UtxoLookupError_clone(&*owner->contents.err);
3523 }
3524 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3525         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3526         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3527         return ret_conv;
3528 }
3529
3530 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3531         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3532         switch(obj->tag) {
3533                 case LDKUtxoResult_Sync: return 0;
3534                 case LDKUtxoResult_Async: return 1;
3535                 default: abort();
3536         }
3537 }
3538 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3539         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3540         assert(obj->tag == LDKUtxoResult_Sync);
3541                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3542                         *sync_conv = obj->sync;
3543                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3544         return tag_ptr(sync_conv, true);
3545 }
3546 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3547         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3548         assert(obj->tag == LDKUtxoResult_Async);
3549                         LDKUtxoFuture async_var = obj->async;
3550                         uint64_t async_ref = 0;
3551                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3552                         async_ref = tag_ptr(async_var.inner, false);
3553         return async_ref;
3554 }
3555 typedef struct LDKUtxoLookup_JCalls {
3556         atomic_size_t refcnt;
3557         uint32_t instance_ptr;
3558 } LDKUtxoLookup_JCalls;
3559 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3560         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3561         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3562                 FREE(j_calls);
3563         }
3564 }
3565 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3566         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3567         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3568         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3569         int64_t short_channel_id_conv = short_channel_id;
3570         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);
3571         void* ret_ptr = untag_ptr(ret);
3572         CHECK_ACCESS(ret_ptr);
3573         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3574         FREE(untag_ptr(ret));
3575         return ret_conv;
3576 }
3577 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3578         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3579         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3580 }
3581 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3582         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3583         atomic_init(&calls->refcnt, 1);
3584         calls->instance_ptr = o;
3585
3586         LDKUtxoLookup ret = {
3587                 .this_arg = (void*) calls,
3588                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3589                 .free = LDKUtxoLookup_JCalls_free,
3590         };
3591         return ret;
3592 }
3593 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3594         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3595         *res_ptr = LDKUtxoLookup_init(o);
3596         return tag_ptr(res_ptr, true);
3597 }
3598 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) {
3599         void* this_arg_ptr = untag_ptr(this_arg);
3600         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3601         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3602         uint8_t genesis_hash_arr[32];
3603         CHECK(genesis_hash->arr_len == 32);
3604         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3605         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
3606         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3607         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3608         uint64_t ret_ref = tag_ptr(ret_copy, true);
3609         return ret_ref;
3610 }
3611
3612 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3613         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3614         switch(obj->tag) {
3615                 case LDKCOption_UtxoLookupZ_Some: return 0;
3616                 case LDKCOption_UtxoLookupZ_None: return 1;
3617                 default: abort();
3618         }
3619 }
3620 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3621         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3622         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3623                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3624                         *some_ret = obj->some;
3625                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3626                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3627                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3628                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3629                         }
3630         return tag_ptr(some_ret, true);
3631 }
3632 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3633 CHECK(owner->result_ok);
3634         return *owner->contents.result;
3635 }
3636 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3637         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3638         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3639         return ret_conv;
3640 }
3641
3642 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3643         LDKLightningError ret = *owner->contents.err;
3644         ret.is_owned = false;
3645         return ret;
3646 }
3647 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3648         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3649         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3650         uint64_t ret_ref = 0;
3651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3653         return ret_ref;
3654 }
3655
3656 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3657         LDKChannelAnnouncement ret = owner->a;
3658         ret.is_owned = false;
3659         return ret;
3660 }
3661 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3662         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3663         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3664         uint64_t ret_ref = 0;
3665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3667         return ret_ref;
3668 }
3669
3670 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3671         LDKChannelUpdate ret = owner->b;
3672         ret.is_owned = false;
3673         return ret;
3674 }
3675 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3676         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3677         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3678         uint64_t ret_ref = 0;
3679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3681         return ret_ref;
3682 }
3683
3684 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3685         LDKChannelUpdate ret = owner->c;
3686         ret.is_owned = false;
3687         return ret;
3688 }
3689 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3690         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3691         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3692         uint64_t ret_ref = 0;
3693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3695         return ret_ref;
3696 }
3697
3698 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3699         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3700         switch(obj->tag) {
3701                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3702                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3703                 default: abort();
3704         }
3705 }
3706 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3707         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3708         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3709                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3710                         *some_conv = obj->some;
3711                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3712         return tag_ptr(some_conv, true);
3713 }
3714 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3715 CHECK(owner->result_ok);
3716         return *owner->contents.result;
3717 }
3718 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3719         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3720         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3721 }
3722
3723 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3724         LDKLightningError ret = *owner->contents.err;
3725         ret.is_owned = false;
3726         return ret;
3727 }
3728 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3729         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3730         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3731         uint64_t ret_ref = 0;
3732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3734         return ret_ref;
3735 }
3736
3737 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3738         LDKChannelUpdateInfo ret = *owner->contents.result;
3739         ret.is_owned = false;
3740         return ret;
3741 }
3742 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3743         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3744         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3745         uint64_t ret_ref = 0;
3746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3748         return ret_ref;
3749 }
3750
3751 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3752 CHECK(!owner->result_ok);
3753         return DecodeError_clone(&*owner->contents.err);
3754 }
3755 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3756         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3757         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3758         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3759         uint64_t ret_ref = tag_ptr(ret_copy, true);
3760         return ret_ref;
3761 }
3762
3763 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3764         LDKChannelInfo ret = *owner->contents.result;
3765         ret.is_owned = false;
3766         return ret;
3767 }
3768 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3769         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3770         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3771         uint64_t ret_ref = 0;
3772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3774         return ret_ref;
3775 }
3776
3777 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3778 CHECK(!owner->result_ok);
3779         return DecodeError_clone(&*owner->contents.err);
3780 }
3781 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3782         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3783         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3784         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3785         uint64_t ret_ref = tag_ptr(ret_copy, true);
3786         return ret_ref;
3787 }
3788
3789 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3790         LDKRoutingFees ret = *owner->contents.result;
3791         ret.is_owned = false;
3792         return ret;
3793 }
3794 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3795         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3796         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3797         uint64_t ret_ref = 0;
3798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3800         return ret_ref;
3801 }
3802
3803 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3804 CHECK(!owner->result_ok);
3805         return DecodeError_clone(&*owner->contents.err);
3806 }
3807 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3808         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3809         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3810         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3811         uint64_t ret_ref = tag_ptr(ret_copy, true);
3812         return ret_ref;
3813 }
3814
3815 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3816         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3817         switch(obj->tag) {
3818                 case LDKNetAddress_IPv4: return 0;
3819                 case LDKNetAddress_IPv6: return 1;
3820                 case LDKNetAddress_OnionV2: return 2;
3821                 case LDKNetAddress_OnionV3: return 3;
3822                 case LDKNetAddress_Hostname: return 4;
3823                 default: abort();
3824         }
3825 }
3826 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3827         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3828         assert(obj->tag == LDKNetAddress_IPv4);
3829                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3830                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3831         return addr_arr;
3832 }
3833 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3834         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3835         assert(obj->tag == LDKNetAddress_IPv4);
3836                         int16_t port_conv = obj->i_pv4.port;
3837         return port_conv;
3838 }
3839 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3840         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3841         assert(obj->tag == LDKNetAddress_IPv6);
3842                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3843                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3844         return addr_arr;
3845 }
3846 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3847         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3848         assert(obj->tag == LDKNetAddress_IPv6);
3849                         int16_t port_conv = obj->i_pv6.port;
3850         return port_conv;
3851 }
3852 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3853         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3854         assert(obj->tag == LDKNetAddress_OnionV2);
3855                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3856                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3857         return onion_v2_arr;
3858 }
3859 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3860         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3861         assert(obj->tag == LDKNetAddress_OnionV3);
3862                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3863                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3864         return ed25519_pubkey_arr;
3865 }
3866 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3867         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3868         assert(obj->tag == LDKNetAddress_OnionV3);
3869                         int16_t checksum_conv = obj->onion_v3.checksum;
3870         return checksum_conv;
3871 }
3872 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3873         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3874         assert(obj->tag == LDKNetAddress_OnionV3);
3875                         int8_t version_conv = obj->onion_v3.version;
3876         return version_conv;
3877 }
3878 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3879         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3880         assert(obj->tag == LDKNetAddress_OnionV3);
3881                         int16_t port_conv = obj->onion_v3.port;
3882         return port_conv;
3883 }
3884 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3885         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3886         assert(obj->tag == LDKNetAddress_Hostname);
3887                         LDKHostname hostname_var = obj->hostname.hostname;
3888                         uint64_t hostname_ref = 0;
3889                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3890                         hostname_ref = tag_ptr(hostname_var.inner, false);
3891         return hostname_ref;
3892 }
3893 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3894         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3895         assert(obj->tag == LDKNetAddress_Hostname);
3896                         int16_t port_conv = obj->hostname.port;
3897         return port_conv;
3898 }
3899 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3900         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3901         for (size_t i = 0; i < ret.datalen; i++) {
3902                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3903         }
3904         return ret;
3905 }
3906 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3907         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3908         ret.is_owned = false;
3909         return ret;
3910 }
3911 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3912         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3913         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3914         uint64_t ret_ref = 0;
3915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3917         return ret_ref;
3918 }
3919
3920 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3921 CHECK(!owner->result_ok);
3922         return DecodeError_clone(&*owner->contents.err);
3923 }
3924 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3925         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3926         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3927         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3928         uint64_t ret_ref = tag_ptr(ret_copy, true);
3929         return ret_ref;
3930 }
3931
3932 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3933         LDKNodeAlias ret = *owner->contents.result;
3934         ret.is_owned = false;
3935         return ret;
3936 }
3937 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3938         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3939         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3940         uint64_t ret_ref = 0;
3941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3943         return ret_ref;
3944 }
3945
3946 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3947 CHECK(!owner->result_ok);
3948         return DecodeError_clone(&*owner->contents.err);
3949 }
3950 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3951         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3953         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3954         uint64_t ret_ref = tag_ptr(ret_copy, true);
3955         return ret_ref;
3956 }
3957
3958 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3959         LDKNodeInfo ret = *owner->contents.result;
3960         ret.is_owned = false;
3961         return ret;
3962 }
3963 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3964         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3965         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3966         uint64_t ret_ref = 0;
3967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3969         return ret_ref;
3970 }
3971
3972 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3973 CHECK(!owner->result_ok);
3974         return DecodeError_clone(&*owner->contents.err);
3975 }
3976 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3977         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3978         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3979         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3980         uint64_t ret_ref = tag_ptr(ret_copy, true);
3981         return ret_ref;
3982 }
3983
3984 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3985         LDKNetworkGraph ret = *owner->contents.result;
3986         ret.is_owned = false;
3987         return ret;
3988 }
3989 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3990         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3991         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3992         uint64_t ret_ref = 0;
3993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3995         return ret_ref;
3996 }
3997
3998 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3999 CHECK(!owner->result_ok);
4000         return DecodeError_clone(&*owner->contents.err);
4001 }
4002 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
4003         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4004         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4005         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4006         uint64_t ret_ref = tag_ptr(ret_copy, true);
4007         return ret_ref;
4008 }
4009
4010 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
4011         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
4012         switch(obj->tag) {
4013                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
4014                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
4015                 default: abort();
4016         }
4017 }
4018 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
4019         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
4020         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
4021                         LDKCVec_NetAddressZ some_var = obj->some;
4022                         uint64_tArray some_arr = NULL;
4023                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
4024                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
4025                         for (size_t m = 0; m < some_var.datalen; m++) {
4026                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
4027                                 some_arr_ptr[m] = some_conv_12_ref;
4028                         }
4029                         
4030         return some_arr;
4031 }
4032 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4033         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
4034         ret.is_owned = false;
4035         return ret;
4036 }
4037 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
4038         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4039         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4040         uint64_t ret_ref = 0;
4041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4043         return ret_ref;
4044 }
4045
4046 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4047 CHECK(!owner->result_ok);
4048         return DecodeError_clone(&*owner->contents.err);
4049 }
4050 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
4051         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4052         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4053         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4054         uint64_t ret_ref = tag_ptr(ret_copy, true);
4055         return ret_ref;
4056 }
4057
4058 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4059         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
4060         ret.is_owned = false;
4061         return ret;
4062 }
4063 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
4064         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4065         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4066         uint64_t ret_ref = 0;
4067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4069         return ret_ref;
4070 }
4071
4072 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4073 CHECK(!owner->result_ok);
4074         return DecodeError_clone(&*owner->contents.err);
4075 }
4076 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
4077         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4078         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4079         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4080         uint64_t ret_ref = tag_ptr(ret_copy, true);
4081         return ret_ref;
4082 }
4083
4084 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4085 CHECK(owner->result_ok);
4086         return SpendableOutputDescriptor_clone(&*owner->contents.result);
4087 }
4088 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
4089         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4090         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4091         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4092         uint64_t ret_ref = tag_ptr(ret_copy, true);
4093         return ret_ref;
4094 }
4095
4096 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4097 CHECK(!owner->result_ok);
4098         return DecodeError_clone(&*owner->contents.err);
4099 }
4100 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
4101         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4102         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4103         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4104         uint64_t ret_ref = tag_ptr(ret_copy, true);
4105         return ret_ref;
4106 }
4107
4108 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4109         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4110         for (size_t i = 0; i < ret.datalen; i++) {
4111                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4112         }
4113         return ret;
4114 }
4115 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4116         return owner->a;
4117 }
4118 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
4119         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4120         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
4121         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
4122         return ret_arr;
4123 }
4124
4125 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4126         return owner->b;
4127 }
4128 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
4129         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4130         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4131         ptrArray ret_arr = NULL;
4132         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4133         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4134         for (size_t m = 0; m < ret_var.datalen; m++) {
4135                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
4136                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
4137                 ret_arr_ptr[m] = ret_conv_12_arr;
4138         }
4139         
4140         return ret_arr;
4141 }
4142
4143 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4144 CHECK(owner->result_ok);
4145         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
4146 }
4147 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
4148         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4149         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4150         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
4151         return tag_ptr(ret_conv, true);
4152 }
4153
4154 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4155 CHECK(!owner->result_ok);
4156         return *owner->contents.err;
4157 }
4158 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
4159         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4160         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
4161 }
4162
4163 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4164 CHECK(owner->result_ok);
4165         return *owner->contents.result;
4166 }
4167 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
4168         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4169         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
4170         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
4171         return ret_arr;
4172 }
4173
4174 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4175 CHECK(!owner->result_ok);
4176         return *owner->contents.err;
4177 }
4178 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
4179         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4180         CResult_SignatureNoneZ_get_err(owner_conv);
4181 }
4182
4183 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
4184 CHECK(owner->result_ok);
4185         return *owner->contents.result;
4186 }
4187 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
4188         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
4189         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4190         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
4191         return ret_arr;
4192 }
4193
4194 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
4195 CHECK(!owner->result_ok);
4196         return *owner->contents.err;
4197 }
4198 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
4199         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
4200         CResult_PublicKeyNoneZ_get_err(owner_conv);
4201 }
4202
4203 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
4204         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
4205         switch(obj->tag) {
4206                 case LDKCOption_ScalarZ_Some: return 0;
4207                 case LDKCOption_ScalarZ_None: return 1;
4208                 default: abort();
4209         }
4210 }
4211 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
4212         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
4213         assert(obj->tag == LDKCOption_ScalarZ_Some);
4214                         LDKBigEndianScalar* some_ref = &obj->some;
4215         return tag_ptr(some_ref, false);
4216 }
4217 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
4218 CHECK(owner->result_ok);
4219         return ThirtyTwoBytes_clone(&*owner->contents.result);
4220 }
4221 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
4222         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
4223         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4224         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
4225         return ret_arr;
4226 }
4227
4228 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
4229 CHECK(!owner->result_ok);
4230         return *owner->contents.err;
4231 }
4232 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
4233         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
4234         CResult_SharedSecretNoneZ_get_err(owner_conv);
4235 }
4236
4237 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4238 CHECK(owner->result_ok);
4239         return *owner->contents.result;
4240 }
4241 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4242         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4243         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4244         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4245         return ret_arr;
4246 }
4247
4248 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4249 CHECK(!owner->result_ok);
4250         return *owner->contents.err;
4251 }
4252 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4253         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4254         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4255 }
4256
4257 typedef struct LDKChannelSigner_JCalls {
4258         atomic_size_t refcnt;
4259         uint32_t instance_ptr;
4260 } LDKChannelSigner_JCalls;
4261 static void LDKChannelSigner_JCalls_free(void* this_arg) {
4262         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4263         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4264                 FREE(j_calls);
4265         }
4266 }
4267 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
4268         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4269         int64_t idx_conv = idx;
4270         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
4271         LDKPublicKey ret_ref;
4272         CHECK(ret->arr_len == 33);
4273         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
4274         return ret_ref;
4275 }
4276 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
4277         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4278         int64_t idx_conv = idx;
4279         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
4280         LDKThirtyTwoBytes ret_ref;
4281         CHECK(ret->arr_len == 32);
4282         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4283         return ret_ref;
4284 }
4285 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4286         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4287         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4288         uint64_t holder_tx_ref = 0;
4289         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4290         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4291         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
4292         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4293         ptrArray preimages_arr = NULL;
4294         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
4295         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
4296         for (size_t m = 0; m < preimages_var.datalen; m++) {
4297                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4298                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4299                 preimages_arr_ptr[m] = preimages_conv_12_arr;
4300         }
4301         
4302         FREE(preimages_var.data);
4303         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
4304         void* ret_ptr = untag_ptr(ret);
4305         CHECK_ACCESS(ret_ptr);
4306         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4307         FREE(untag_ptr(ret));
4308         return ret_conv;
4309 }
4310 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
4311         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4312         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
4313         LDKThirtyTwoBytes ret_ref;
4314         CHECK(ret->arr_len == 32);
4315         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4316         return ret_ref;
4317 }
4318 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4319         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4320         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4321         uint64_t channel_parameters_ref = 0;
4322         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4323         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4324         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
4325         js_invoke_function_buuuuu(j_calls->instance_ptr, 6, channel_parameters_ref, 0, 0, 0, 0, 0);
4326 }
4327 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
4328         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
4329         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4330 }
4331 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
4332         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
4333         atomic_init(&calls->refcnt, 1);
4334         calls->instance_ptr = o;
4335
4336         LDKChannelPublicKeys pubkeys_conv;
4337         pubkeys_conv.inner = untag_ptr(pubkeys);
4338         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4339         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4340
4341         LDKChannelSigner ret = {
4342                 .this_arg = (void*) calls,
4343                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
4344                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
4345                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
4346                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
4347                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
4348                 .free = LDKChannelSigner_JCalls_free,
4349                 .pubkeys = pubkeys_conv,
4350                 .set_pubkeys = NULL,
4351         };
4352         return ret;
4353 }
4354 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
4355         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
4356         *res_ptr = LDKChannelSigner_init(o, pubkeys);
4357         return tag_ptr(res_ptr, true);
4358 }
4359 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
4360         void* this_arg_ptr = untag_ptr(this_arg);
4361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4362         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4363         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4364         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
4365         return ret_arr;
4366 }
4367
4368 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
4369         void* this_arg_ptr = untag_ptr(this_arg);
4370         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4371         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4372         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4373         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
4374         return ret_arr;
4375 }
4376
4377 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) {
4378         void* this_arg_ptr = untag_ptr(this_arg);
4379         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4380         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4381         LDKHolderCommitmentTransaction holder_tx_conv;
4382         holder_tx_conv.inner = untag_ptr(holder_tx);
4383         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4384         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4385         holder_tx_conv.is_owned = false;
4386         LDKCVec_PaymentPreimageZ preimages_constr;
4387         preimages_constr.datalen = preimages->arr_len;
4388         if (preimages_constr.datalen > 0)
4389                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4390         else
4391                 preimages_constr.data = NULL;
4392         int8_tArray* preimages_vals = (void*) preimages->elems;
4393         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4394                 int8_tArray preimages_conv_12 = preimages_vals[m];
4395                 LDKThirtyTwoBytes preimages_conv_12_ref;
4396                 CHECK(preimages_conv_12->arr_len == 32);
4397                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4398                 preimages_constr.data[m] = preimages_conv_12_ref;
4399         }
4400         FREE(preimages);
4401         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4402         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4403         return tag_ptr(ret_conv, true);
4404 }
4405
4406 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
4407         void* this_arg_ptr = untag_ptr(this_arg);
4408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4409         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4410         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4411         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4412         return ret_arr;
4413 }
4414
4415 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
4416         void* this_arg_ptr = untag_ptr(this_arg);
4417         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4418         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4419         LDKChannelTransactionParameters channel_parameters_conv;
4420         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4421         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4422         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4423         channel_parameters_conv.is_owned = false;
4424         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
4425 }
4426
4427 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
4428         if (this_arg->set_pubkeys != NULL)
4429                 this_arg->set_pubkeys(this_arg);
4430         return this_arg->pubkeys;
4431 }
4432 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
4433         void* this_arg_ptr = untag_ptr(this_arg);
4434         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4435         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4436         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
4437         uint64_t ret_ref = 0;
4438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4440         return ret_ref;
4441 }
4442
4443 typedef struct LDKEcdsaChannelSigner_JCalls {
4444         atomic_size_t refcnt;
4445         uint32_t instance_ptr;
4446         LDKChannelSigner_JCalls* ChannelSigner;
4447 } LDKEcdsaChannelSigner_JCalls;
4448 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
4449         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4450         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4451                 FREE(j_calls);
4452         }
4453 }
4454 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4455         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4456         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4457         uint64_t commitment_tx_ref = 0;
4458         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4459         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4460         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4461         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4462         ptrArray preimages_arr = NULL;
4463         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
4464         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
4465         for (size_t m = 0; m < preimages_var.datalen; m++) {
4466                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4467                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4468                 preimages_arr_ptr[m] = preimages_conv_12_arr;
4469         }
4470         
4471         FREE(preimages_var.data);
4472         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
4473         void* ret_ptr = untag_ptr(ret);
4474         CHECK_ACCESS(ret_ptr);
4475         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4476         FREE(untag_ptr(ret));
4477         return ret_conv;
4478 }
4479 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4480         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4481         int64_t idx_conv = idx;
4482         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
4483         memcpy(secret_arr->elems, *secret, 32);
4484         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
4485         void* ret_ptr = untag_ptr(ret);
4486         CHECK_ACCESS(ret_ptr);
4487         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4488         FREE(untag_ptr(ret));
4489         return ret_conv;
4490 }
4491 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4492         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4493         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4494         uint64_t commitment_tx_ref = 0;
4495         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4496         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4497         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4498         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 9, commitment_tx_ref, 0, 0, 0, 0, 0);
4499         void* ret_ptr = untag_ptr(ret);
4500         CHECK_ACCESS(ret_ptr);
4501         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4502         FREE(untag_ptr(ret));
4503         return ret_conv;
4504 }
4505 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]) {
4506         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4507         LDKTransaction justice_tx_var = justice_tx;
4508         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4509         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4510         Transaction_free(justice_tx_var);
4511         uint32_t input_conv = input;
4512         int64_t amount_conv = amount;
4513         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4514         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4515         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);
4516         void* ret_ptr = untag_ptr(ret);
4517         CHECK_ACCESS(ret_ptr);
4518         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4519         FREE(untag_ptr(ret));
4520         return ret_conv;
4521 }
4522 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) {
4523         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4524         LDKTransaction justice_tx_var = justice_tx;
4525         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4526         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4527         Transaction_free(justice_tx_var);
4528         uint32_t input_conv = input;
4529         int64_t amount_conv = amount;
4530         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4531         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4532         LDKHTLCOutputInCommitment htlc_var = *htlc;
4533         uint64_t htlc_ref = 0;
4534         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4535         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4536         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4537         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);
4538         void* ret_ptr = untag_ptr(ret);
4539         CHECK_ACCESS(ret_ptr);
4540         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4541         FREE(untag_ptr(ret));
4542         return ret_conv;
4543 }
4544 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) {
4545         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4546         LDKTransaction htlc_tx_var = htlc_tx;
4547         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
4548         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
4549         Transaction_free(htlc_tx_var);
4550         uint32_t input_conv = input;
4551         int64_t amount_conv = amount;
4552         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
4553         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
4554         LDKHTLCOutputInCommitment htlc_var = *htlc;
4555         uint64_t htlc_ref = 0;
4556         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4557         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4558         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4559         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);
4560         void* ret_ptr = untag_ptr(ret);
4561         CHECK_ACCESS(ret_ptr);
4562         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4563         FREE(untag_ptr(ret));
4564         return ret_conv;
4565 }
4566 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4567         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4568         LDKClosingTransaction closing_tx_var = *closing_tx;
4569         uint64_t closing_tx_ref = 0;
4570         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4571         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4572         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
4573         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 13, closing_tx_ref, 0, 0, 0, 0, 0);
4574         void* ret_ptr = untag_ptr(ret);
4575         CHECK_ACCESS(ret_ptr);
4576         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4577         FREE(untag_ptr(ret));
4578         return ret_conv;
4579 }
4580 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
4581         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4582         LDKTransaction anchor_tx_var = anchor_tx;
4583         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
4584         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
4585         Transaction_free(anchor_tx_var);
4586         uint32_t input_conv = input;
4587         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 14, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
4588         void* ret_ptr = untag_ptr(ret);
4589         CHECK_ACCESS(ret_ptr);
4590         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4591         FREE(untag_ptr(ret));
4592         return ret_conv;
4593 }
4594 LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4595         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4596         LDKUnsignedChannelAnnouncement msg_var = *msg;
4597         uint64_t msg_ref = 0;
4598         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4599         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4600         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
4601         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 15, msg_ref, 0, 0, 0, 0, 0);
4602         void* ret_ptr = untag_ptr(ret);
4603         CHECK_ACCESS(ret_ptr);
4604         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4605         FREE(untag_ptr(ret));
4606         return ret_conv;
4607 }
4608 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
4609         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
4610         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4611         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
4612 }
4613 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
4614         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
4615         atomic_init(&calls->refcnt, 1);
4616         calls->instance_ptr = o;
4617
4618         LDKChannelPublicKeys pubkeys_conv;
4619         pubkeys_conv.inner = untag_ptr(pubkeys);
4620         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4621         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4622
4623         LDKEcdsaChannelSigner ret = {
4624                 .this_arg = (void*) calls,
4625                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
4626                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
4627                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
4628                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
4629                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
4630                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
4631                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
4632                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
4633                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
4634                 .free = LDKEcdsaChannelSigner_JCalls_free,
4635                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
4636         };
4637         calls->ChannelSigner = ret.ChannelSigner.this_arg;
4638         return ret;
4639 }
4640 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
4641         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
4642         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
4643         return tag_ptr(res_ptr, true);
4644 }
4645 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) {
4646         void* this_arg_ptr = untag_ptr(this_arg);
4647         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4648         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4649         LDKCommitmentTransaction commitment_tx_conv;
4650         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4651         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4652         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4653         commitment_tx_conv.is_owned = false;
4654         LDKCVec_PaymentPreimageZ preimages_constr;
4655         preimages_constr.datalen = preimages->arr_len;
4656         if (preimages_constr.datalen > 0)
4657                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4658         else
4659                 preimages_constr.data = NULL;
4660         int8_tArray* preimages_vals = (void*) preimages->elems;
4661         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4662                 int8_tArray preimages_conv_12 = preimages_vals[m];
4663                 LDKThirtyTwoBytes preimages_conv_12_ref;
4664                 CHECK(preimages_conv_12->arr_len == 32);
4665                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4666                 preimages_constr.data[m] = preimages_conv_12_ref;
4667         }
4668         FREE(preimages);
4669         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4670         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4671         return tag_ptr(ret_conv, true);
4672 }
4673
4674 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) {
4675         void* this_arg_ptr = untag_ptr(this_arg);
4676         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4677         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4678         uint8_t secret_arr[32];
4679         CHECK(secret->arr_len == 32);
4680         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4681         uint8_t (*secret_ref)[32] = &secret_arr;
4682         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4683         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4684         return tag_ptr(ret_conv, true);
4685 }
4686
4687 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) {
4688         void* this_arg_ptr = untag_ptr(this_arg);
4689         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4690         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4691         LDKHolderCommitmentTransaction commitment_tx_conv;
4692         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4693         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4694         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4695         commitment_tx_conv.is_owned = false;
4696         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4697         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4698         return tag_ptr(ret_conv, true);
4699 }
4700
4701 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) {
4702         void* this_arg_ptr = untag_ptr(this_arg);
4703         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4704         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4705         LDKTransaction justice_tx_ref;
4706         justice_tx_ref.datalen = justice_tx->arr_len;
4707         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4708         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4709         justice_tx_ref.data_is_owned = true;
4710         uint8_t per_commitment_key_arr[32];
4711         CHECK(per_commitment_key->arr_len == 32);
4712         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4713         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4714         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4715         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4716         return tag_ptr(ret_conv, true);
4717 }
4718
4719 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) {
4720         void* this_arg_ptr = untag_ptr(this_arg);
4721         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4722         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4723         LDKTransaction justice_tx_ref;
4724         justice_tx_ref.datalen = justice_tx->arr_len;
4725         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4726         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4727         justice_tx_ref.data_is_owned = true;
4728         uint8_t per_commitment_key_arr[32];
4729         CHECK(per_commitment_key->arr_len == 32);
4730         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4731         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4732         LDKHTLCOutputInCommitment htlc_conv;
4733         htlc_conv.inner = untag_ptr(htlc);
4734         htlc_conv.is_owned = ptr_is_owned(htlc);
4735         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4736         htlc_conv.is_owned = false;
4737         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4738         *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);
4739         return tag_ptr(ret_conv, true);
4740 }
4741
4742 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) {
4743         void* this_arg_ptr = untag_ptr(this_arg);
4744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4745         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4746         LDKTransaction htlc_tx_ref;
4747         htlc_tx_ref.datalen = htlc_tx->arr_len;
4748         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4749         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4750         htlc_tx_ref.data_is_owned = true;
4751         LDKPublicKey per_commitment_point_ref;
4752         CHECK(per_commitment_point->arr_len == 33);
4753         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4754         LDKHTLCOutputInCommitment htlc_conv;
4755         htlc_conv.inner = untag_ptr(htlc);
4756         htlc_conv.is_owned = ptr_is_owned(htlc);
4757         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4758         htlc_conv.is_owned = false;
4759         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4760         *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);
4761         return tag_ptr(ret_conv, true);
4762 }
4763
4764 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4765         void* this_arg_ptr = untag_ptr(this_arg);
4766         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4767         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4768         LDKClosingTransaction closing_tx_conv;
4769         closing_tx_conv.inner = untag_ptr(closing_tx);
4770         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4771         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4772         closing_tx_conv.is_owned = false;
4773         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4774         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4775         return tag_ptr(ret_conv, true);
4776 }
4777
4778 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) {
4779         void* this_arg_ptr = untag_ptr(this_arg);
4780         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4781         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4782         LDKTransaction anchor_tx_ref;
4783         anchor_tx_ref.datalen = anchor_tx->arr_len;
4784         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
4785         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
4786         anchor_tx_ref.data_is_owned = true;
4787         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4788         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
4789         return tag_ptr(ret_conv, true);
4790 }
4791
4792 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) {
4793         void* this_arg_ptr = untag_ptr(this_arg);
4794         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4795         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4796         LDKUnsignedChannelAnnouncement msg_conv;
4797         msg_conv.inner = untag_ptr(msg);
4798         msg_conv.is_owned = ptr_is_owned(msg);
4799         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4800         msg_conv.is_owned = false;
4801         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4802         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
4803         return tag_ptr(ret_conv, true);
4804 }
4805
4806 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
4807         atomic_size_t refcnt;
4808         uint32_t instance_ptr;
4809         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
4810         LDKChannelSigner_JCalls* ChannelSigner;
4811 } LDKWriteableEcdsaChannelSigner_JCalls;
4812 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
4813         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
4814         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4815                 FREE(j_calls);
4816         }
4817 }
4818 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
4819         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
4820         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 16, 0, 0, 0, 0, 0, 0);
4821         LDKCVec_u8Z ret_ref;
4822         ret_ref.datalen = ret->arr_len;
4823         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4824         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4825         return ret_ref;
4826 }
4827 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
4828         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
4829         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4830         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
4831         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
4832 }
4833 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
4834         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
4835         atomic_init(&calls->refcnt, 1);
4836         calls->instance_ptr = o;
4837
4838         LDKChannelPublicKeys pubkeys_conv;
4839         pubkeys_conv.inner = untag_ptr(pubkeys);
4840         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4841         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4842
4843         LDKWriteableEcdsaChannelSigner ret = {
4844                 .this_arg = (void*) calls,
4845                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
4846                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
4847                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
4848                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
4849         };
4850         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
4851         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
4852         return ret;
4853 }
4854 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
4855         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4856         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
4857         return tag_ptr(res_ptr, true);
4858 }
4859 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
4860         void* this_arg_ptr = untag_ptr(this_arg);
4861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4862         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
4863         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4864         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4865         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4866         CVec_u8Z_free(ret_var);
4867         return ret_arr;
4868 }
4869
4870 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4871 CHECK(owner->result_ok);
4872         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
4873 }
4874 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
4875         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4876         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4877         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
4878         return tag_ptr(ret_ret, true);
4879 }
4880
4881 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4882 CHECK(!owner->result_ok);
4883         return DecodeError_clone(&*owner->contents.err);
4884 }
4885 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
4886         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4887         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4888         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
4889         uint64_t ret_ref = tag_ptr(ret_copy, true);
4890         return ret_ref;
4891 }
4892
4893 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4894         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4895         for (size_t i = 0; i < ret.datalen; i++) {
4896                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4897         }
4898         return ret;
4899 }
4900 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4901 CHECK(owner->result_ok);
4902         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4903 }
4904 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4905         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4906         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4907         ptrArray ret_arr = NULL;
4908         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4909         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4910         for (size_t m = 0; m < ret_var.datalen; m++) {
4911                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4912                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4913                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4914                 CVec_u8Z_free(ret_conv_12_var);
4915                 ret_arr_ptr[m] = ret_conv_12_arr;
4916         }
4917         
4918         FREE(ret_var.data);
4919         return ret_arr;
4920 }
4921
4922 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4923 CHECK(!owner->result_ok);
4924         return *owner->contents.err;
4925 }
4926 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4927         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4928         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4929 }
4930
4931 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4932         LDKInMemorySigner ret = *owner->contents.result;
4933         ret.is_owned = false;
4934         return ret;
4935 }
4936 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4937         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4938         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4939         uint64_t ret_ref = 0;
4940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4942         return ret_ref;
4943 }
4944
4945 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4946 CHECK(!owner->result_ok);
4947         return DecodeError_clone(&*owner->contents.err);
4948 }
4949 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4950         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4951         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4952         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4953         uint64_t ret_ref = tag_ptr(ret_copy, true);
4954         return ret_ref;
4955 }
4956
4957 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4958         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4959         for (size_t i = 0; i < ret.datalen; i++) {
4960                 ret.data[i] = TxOut_clone(&orig->data[i]);
4961         }
4962         return ret;
4963 }
4964 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4965 CHECK(owner->result_ok);
4966         return *owner->contents.result;
4967 }
4968 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4969         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4970         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4971         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4972         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4973         return ret_arr;
4974 }
4975
4976 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4977 CHECK(!owner->result_ok);
4978         return *owner->contents.err;
4979 }
4980 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4981         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4982         CResult_TransactionNoneZ_get_err(owner_conv);
4983 }
4984
4985 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4986         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4987         switch(obj->tag) {
4988                 case LDKCOption_u16Z_Some: return 0;
4989                 case LDKCOption_u16Z_None: return 1;
4990                 default: abort();
4991         }
4992 }
4993 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4994         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4995         assert(obj->tag == LDKCOption_u16Z_Some);
4996                         int16_t some_conv = obj->some;
4997         return some_conv;
4998 }
4999 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5000 CHECK(owner->result_ok);
5001         return ThirtyTwoBytes_clone(&*owner->contents.result);
5002 }
5003 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
5004         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5005         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5006         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
5007         return ret_arr;
5008 }
5009
5010 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5011 CHECK(!owner->result_ok);
5012         return APIError_clone(&*owner->contents.err);
5013 }
5014 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
5015         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5016         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5017         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5018         uint64_t ret_ref = tag_ptr(ret_copy, true);
5019         return ret_ref;
5020 }
5021
5022 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
5023         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5024         switch(obj->tag) {
5025                 case LDKRecentPaymentDetails_Pending: return 0;
5026                 case LDKRecentPaymentDetails_Fulfilled: return 1;
5027                 case LDKRecentPaymentDetails_Abandoned: return 2;
5028                 default: abort();
5029         }
5030 }
5031 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
5032         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5033         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5034                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5035                         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5036         return payment_hash_arr;
5037 }
5038 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
5039         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5040         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5041                         int64_t total_msat_conv = obj->pending.total_msat;
5042         return total_msat_conv;
5043 }
5044 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
5045         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5046         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5047                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5048                         memcpy(payment_hash_arr->elems, obj->fulfilled.payment_hash.data, 32);
5049         return payment_hash_arr;
5050 }
5051 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
5052         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5053         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5054                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5055                         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
5056         return payment_hash_arr;
5057 }
5058 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
5059         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
5060         for (size_t i = 0; i < ret.datalen; i++) {
5061                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
5062         }
5063         return ret;
5064 }
5065 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
5066         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5067         switch(obj->tag) {
5068                 case LDKPaymentSendFailure_ParameterError: return 0;
5069                 case LDKPaymentSendFailure_PathParameterError: return 1;
5070                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
5071                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
5072                 case LDKPaymentSendFailure_PartialFailure: return 4;
5073                 default: abort();
5074         }
5075 }
5076 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
5077         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5078         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
5079                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5080         return parameter_error_ref;
5081 }
5082 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
5083         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5084         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
5085                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5086                         uint64_tArray path_parameter_error_arr = NULL;
5087                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
5088                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
5089                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5090                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5091                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5092                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5093                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5094                         }
5095                         
5096         return path_parameter_error_arr;
5097 }
5098 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
5099         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5100         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
5101                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
5102                         uint64_tArray all_failed_resend_safe_arr = NULL;
5103                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
5104                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
5105                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
5106                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
5107                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
5108                         }
5109                         
5110         return all_failed_resend_safe_arr;
5111 }
5112 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
5113         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5114         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5115                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5116                         uint64_tArray results_arr = NULL;
5117                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
5118                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
5119                         for (size_t w = 0; w < results_var.datalen; w++) {
5120                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5121                                 *results_conv_22_conv = results_var.data[w];
5122                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5123                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5124                         }
5125                         
5126         return results_arr;
5127 }
5128 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
5129         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5130         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5131                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5132                         uint64_t failed_paths_retry_ref = 0;
5133                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5134                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5135         return failed_paths_retry_ref;
5136 }
5137 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
5138         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5139         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5140                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5141                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
5142         return payment_id_arr;
5143 }
5144 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5145 CHECK(owner->result_ok);
5146         return *owner->contents.result;
5147 }
5148 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
5149         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5150         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5151 }
5152
5153 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5154 CHECK(!owner->result_ok);
5155         return PaymentSendFailure_clone(&*owner->contents.err);
5156 }
5157 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
5158         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5159         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5160         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5161         uint64_t ret_ref = tag_ptr(ret_copy, true);
5162         return ret_ref;
5163 }
5164
5165 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5166 CHECK(owner->result_ok);
5167         return *owner->contents.result;
5168 }
5169 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
5170         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5171         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
5172 }
5173
5174 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5175 CHECK(!owner->result_ok);
5176         return RetryableSendFailure_clone(&*owner->contents.err);
5177 }
5178 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
5179         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5180         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
5181         return ret_conv;
5182 }
5183
5184 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
5185 CHECK(owner->result_ok);
5186         return ThirtyTwoBytes_clone(&*owner->contents.result);
5187 }
5188 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_ok(uint64_t owner) {
5189         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
5190         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5191         memcpy(ret_arr->elems, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5192         return ret_arr;
5193 }
5194
5195 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
5196 CHECK(!owner->result_ok);
5197         return PaymentSendFailure_clone(&*owner->contents.err);
5198 }
5199 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_err(uint64_t owner) {
5200         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
5201         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5202         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
5203         uint64_t ret_ref = tag_ptr(ret_copy, true);
5204         return ret_ref;
5205 }
5206
5207 static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
5208 CHECK(owner->result_ok);
5209         return ThirtyTwoBytes_clone(&*owner->contents.result);
5210 }
5211 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_ok(uint64_t owner) {
5212         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
5213         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5214         memcpy(ret_arr->elems, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5215         return ret_arr;
5216 }
5217
5218 static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
5219 CHECK(!owner->result_ok);
5220         return RetryableSendFailure_clone(&*owner->contents.err);
5221 }
5222 uint32_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_err(uint64_t owner) {
5223         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
5224         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv));
5225         return ret_conv;
5226 }
5227
5228 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5229         return ThirtyTwoBytes_clone(&owner->a);
5230 }
5231 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
5232         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5233         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5234         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
5235         return ret_arr;
5236 }
5237
5238 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5239         return ThirtyTwoBytes_clone(&owner->b);
5240 }
5241 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
5242         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5243         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5244         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
5245         return ret_arr;
5246 }
5247
5248 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5249 CHECK(owner->result_ok);
5250         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5251 }
5252 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
5253         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5254         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5255         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5256         return tag_ptr(ret_conv, true);
5257 }
5258
5259 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5260 CHECK(!owner->result_ok);
5261         return PaymentSendFailure_clone(&*owner->contents.err);
5262 }
5263 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
5264         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5265         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5266         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5267         uint64_t ret_ref = tag_ptr(ret_copy, true);
5268         return ret_ref;
5269 }
5270
5271 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
5272         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
5273         for (size_t i = 0; i < ret.datalen; i++) {
5274                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5275         }
5276         return ret;
5277 }
5278 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5279         return ThirtyTwoBytes_clone(&owner->a);
5280 }
5281 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
5282         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5283         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5284         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
5285         return ret_arr;
5286 }
5287
5288 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5289         return ThirtyTwoBytes_clone(&owner->b);
5290 }
5291 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
5292         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5293         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5294         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
5295         return ret_arr;
5296 }
5297
5298 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5299 CHECK(owner->result_ok);
5300         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5301 }
5302 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
5303         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5304         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5305         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5306         return tag_ptr(ret_conv, true);
5307 }
5308
5309 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5310 CHECK(!owner->result_ok);
5311         return *owner->contents.err;
5312 }
5313 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
5314         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5315         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5316 }
5317
5318 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5319 CHECK(owner->result_ok);
5320         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5321 }
5322 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
5323         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5324         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5325         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5326         return tag_ptr(ret_conv, true);
5327 }
5328
5329 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5330 CHECK(!owner->result_ok);
5331         return APIError_clone(&*owner->contents.err);
5332 }
5333 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
5334         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5335         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5336         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5337         uint64_t ret_ref = tag_ptr(ret_copy, true);
5338         return ret_ref;
5339 }
5340
5341 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5342 CHECK(owner->result_ok);
5343         return ThirtyTwoBytes_clone(&*owner->contents.result);
5344 }
5345 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
5346         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5347         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5348         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
5349         return ret_arr;
5350 }
5351
5352 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5353 CHECK(!owner->result_ok);
5354         return *owner->contents.err;
5355 }
5356 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
5357         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5358         CResult_PaymentSecretNoneZ_get_err(owner_conv);
5359 }
5360
5361 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5362 CHECK(owner->result_ok);
5363         return ThirtyTwoBytes_clone(&*owner->contents.result);
5364 }
5365 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
5366         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5367         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5368         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
5369         return ret_arr;
5370 }
5371
5372 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5373 CHECK(!owner->result_ok);
5374         return APIError_clone(&*owner->contents.err);
5375 }
5376 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
5377         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5378         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5379         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5380         uint64_t ret_ref = tag_ptr(ret_copy, true);
5381         return ret_ref;
5382 }
5383
5384 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5385 CHECK(owner->result_ok);
5386         return ThirtyTwoBytes_clone(&*owner->contents.result);
5387 }
5388 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
5389         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5390         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5391         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
5392         return ret_arr;
5393 }
5394
5395 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5396 CHECK(!owner->result_ok);
5397         return APIError_clone(&*owner->contents.err);
5398 }
5399 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
5400         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5401         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5402         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5403         uint64_t ret_ref = tag_ptr(ret_copy, true);
5404         return ret_ref;
5405 }
5406
5407 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5408         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5409         ret.is_owned = false;
5410         return ret;
5411 }
5412 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5413         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5414         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5415         uint64_t ret_ref = 0;
5416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5418         return ret_ref;
5419 }
5420
5421 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5422 CHECK(!owner->result_ok);
5423         return DecodeError_clone(&*owner->contents.err);
5424 }
5425 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5426         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5427         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5428         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5429         uint64_t ret_ref = tag_ptr(ret_copy, true);
5430         return ret_ref;
5431 }
5432
5433 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5434         LDKChannelCounterparty ret = *owner->contents.result;
5435         ret.is_owned = false;
5436         return ret;
5437 }
5438 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5439         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5440         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5441         uint64_t ret_ref = 0;
5442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5444         return ret_ref;
5445 }
5446
5447 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5448 CHECK(!owner->result_ok);
5449         return DecodeError_clone(&*owner->contents.err);
5450 }
5451 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5452         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5453         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5454         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5455         uint64_t ret_ref = tag_ptr(ret_copy, true);
5456         return ret_ref;
5457 }
5458
5459 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5460         LDKChannelDetails ret = *owner->contents.result;
5461         ret.is_owned = false;
5462         return ret;
5463 }
5464 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5465         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5466         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5467         uint64_t ret_ref = 0;
5468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5470         return ret_ref;
5471 }
5472
5473 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5474 CHECK(!owner->result_ok);
5475         return DecodeError_clone(&*owner->contents.err);
5476 }
5477 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5478         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5479         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5480         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5481         uint64_t ret_ref = tag_ptr(ret_copy, true);
5482         return ret_ref;
5483 }
5484
5485 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5486         LDKPhantomRouteHints ret = *owner->contents.result;
5487         ret.is_owned = false;
5488         return ret;
5489 }
5490 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5491         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5492         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5493         uint64_t ret_ref = 0;
5494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5496         return ret_ref;
5497 }
5498
5499 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5500 CHECK(!owner->result_ok);
5501         return DecodeError_clone(&*owner->contents.err);
5502 }
5503 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5504         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5505         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5506         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5507         uint64_t ret_ref = tag_ptr(ret_copy, true);
5508         return ret_ref;
5509 }
5510
5511 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5512         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5513         for (size_t i = 0; i < ret.datalen; i++) {
5514                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5515         }
5516         return ret;
5517 }
5518 typedef struct LDKWatch_JCalls {
5519         atomic_size_t refcnt;
5520         uint32_t instance_ptr;
5521 } LDKWatch_JCalls;
5522 static void LDKWatch_JCalls_free(void* this_arg) {
5523         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5524         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5525                 FREE(j_calls);
5526         }
5527 }
5528 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5529         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5530         LDKOutPoint funding_txo_var = funding_txo;
5531         uint64_t funding_txo_ref = 0;
5532         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5533         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5534         LDKChannelMonitor monitor_var = monitor;
5535         uint64_t monitor_ref = 0;
5536         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5537         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5538         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5539         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5540         return ret_conv;
5541 }
5542 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5543         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5544         LDKOutPoint funding_txo_var = funding_txo;
5545         uint64_t funding_txo_ref = 0;
5546         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5547         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5548         LDKChannelMonitorUpdate update_var = *update;
5549         uint64_t update_ref = 0;
5550         update_var = ChannelMonitorUpdate_clone(&update_var);
5551         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5552         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5553         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, update_ref, 0, 0, 0, 0);
5554         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5555         return ret_conv;
5556 }
5557 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5558         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5559         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, 0, 0, 0, 0, 0, 0);
5560         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5561         ret_constr.datalen = ret->arr_len;
5562         if (ret_constr.datalen > 0)
5563                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5564         else
5565                 ret_constr.data = NULL;
5566         uint64_t* ret_vals = ret->elems;
5567         for (size_t x = 0; x < ret_constr.datalen; x++) {
5568                 uint64_t ret_conv_49 = ret_vals[x];
5569                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5570                 CHECK_ACCESS(ret_conv_49_ptr);
5571                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5572                 FREE(untag_ptr(ret_conv_49));
5573                 ret_constr.data[x] = ret_conv_49_conv;
5574         }
5575         FREE(ret);
5576         return ret_constr;
5577 }
5578 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5579         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5580         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5581 }
5582 static inline LDKWatch LDKWatch_init (JSValue o) {
5583         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5584         atomic_init(&calls->refcnt, 1);
5585         calls->instance_ptr = o;
5586
5587         LDKWatch ret = {
5588                 .this_arg = (void*) calls,
5589                 .watch_channel = watch_channel_LDKWatch_jcall,
5590                 .update_channel = update_channel_LDKWatch_jcall,
5591                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5592                 .free = LDKWatch_JCalls_free,
5593         };
5594         return ret;
5595 }
5596 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5597         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5598         *res_ptr = LDKWatch_init(o);
5599         return tag_ptr(res_ptr, true);
5600 }
5601 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5602         void* this_arg_ptr = untag_ptr(this_arg);
5603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5604         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5605         LDKOutPoint funding_txo_conv;
5606         funding_txo_conv.inner = untag_ptr(funding_txo);
5607         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5608         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5609         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5610         LDKChannelMonitor monitor_conv;
5611         monitor_conv.inner = untag_ptr(monitor);
5612         monitor_conv.is_owned = ptr_is_owned(monitor);
5613         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5614         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5615         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
5616         return ret_conv;
5617 }
5618
5619 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5620         void* this_arg_ptr = untag_ptr(this_arg);
5621         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5622         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5623         LDKOutPoint funding_txo_conv;
5624         funding_txo_conv.inner = untag_ptr(funding_txo);
5625         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5626         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5627         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5628         LDKChannelMonitorUpdate update_conv;
5629         update_conv.inner = untag_ptr(update);
5630         update_conv.is_owned = ptr_is_owned(update);
5631         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5632         update_conv.is_owned = false;
5633         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5634         return ret_conv;
5635 }
5636
5637 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5638         void* this_arg_ptr = untag_ptr(this_arg);
5639         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5640         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5641         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5642         uint64_tArray ret_arr = NULL;
5643         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5644         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5645         for (size_t x = 0; x < ret_var.datalen; x++) {
5646                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5647                 *ret_conv_49_conv = ret_var.data[x];
5648                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5649         }
5650         
5651         FREE(ret_var.data);
5652         return ret_arr;
5653 }
5654
5655 typedef struct LDKBroadcasterInterface_JCalls {
5656         atomic_size_t refcnt;
5657         uint32_t instance_ptr;
5658 } LDKBroadcasterInterface_JCalls;
5659 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5660         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5661         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5662                 FREE(j_calls);
5663         }
5664 }
5665 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5666         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5667         LDKTransaction tx_var = tx;
5668         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5669         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5670         Transaction_free(tx_var);
5671         js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5672 }
5673 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5674         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5675         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5676 }
5677 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5678         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5679         atomic_init(&calls->refcnt, 1);
5680         calls->instance_ptr = o;
5681
5682         LDKBroadcasterInterface ret = {
5683                 .this_arg = (void*) calls,
5684                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5685                 .free = LDKBroadcasterInterface_JCalls_free,
5686         };
5687         return ret;
5688 }
5689 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5690         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5691         *res_ptr = LDKBroadcasterInterface_init(o);
5692         return tag_ptr(res_ptr, true);
5693 }
5694 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5695         void* this_arg_ptr = untag_ptr(this_arg);
5696         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5697         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5698         LDKTransaction tx_ref;
5699         tx_ref.datalen = tx->arr_len;
5700         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5701         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5702         tx_ref.data_is_owned = true;
5703         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5704 }
5705
5706 typedef struct LDKEntropySource_JCalls {
5707         atomic_size_t refcnt;
5708         uint32_t instance_ptr;
5709 } LDKEntropySource_JCalls;
5710 static void LDKEntropySource_JCalls_free(void* this_arg) {
5711         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5712         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5713                 FREE(j_calls);
5714         }
5715 }
5716 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5717         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5718         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, 0, 0, 0, 0, 0, 0);
5719         LDKThirtyTwoBytes ret_ref;
5720         CHECK(ret->arr_len == 32);
5721         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5722         return ret_ref;
5723 }
5724 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5725         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5726         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5727 }
5728 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5729         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5730         atomic_init(&calls->refcnt, 1);
5731         calls->instance_ptr = o;
5732
5733         LDKEntropySource ret = {
5734                 .this_arg = (void*) calls,
5735                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5736                 .free = LDKEntropySource_JCalls_free,
5737         };
5738         return ret;
5739 }
5740 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5741         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5742         *res_ptr = LDKEntropySource_init(o);
5743         return tag_ptr(res_ptr, true);
5744 }
5745 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5746         void* this_arg_ptr = untag_ptr(this_arg);
5747         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5748         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5749         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5750         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5751         return ret_arr;
5752 }
5753
5754 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5755         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5756         switch(obj->tag) {
5757                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5758                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5759                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5760                 default: abort();
5761         }
5762 }
5763 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5764         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5765         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5766                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5767                         uint64_t channel_announcement_ref = 0;
5768                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5769                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5770         return channel_announcement_ref;
5771 }
5772 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5773         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5774         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5775                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5776                         uint64_t channel_update_ref = 0;
5777                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5778                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5779         return channel_update_ref;
5780 }
5781 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5782         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5783         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5784                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5785                         uint64_t node_announcement_ref = 0;
5786                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5787                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5788         return node_announcement_ref;
5789 }
5790 typedef struct LDKNodeSigner_JCalls {
5791         atomic_size_t refcnt;
5792         uint32_t instance_ptr;
5793 } LDKNodeSigner_JCalls;
5794 static void LDKNodeSigner_JCalls_free(void* this_arg) {
5795         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5796         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5797                 FREE(j_calls);
5798         }
5799 }
5800 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
5801         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5802         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5803         LDKThirtyTwoBytes ret_ref;
5804         CHECK(ret->arr_len == 32);
5805         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5806         return ret_ref;
5807 }
5808 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
5809         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5810         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5811         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, recipient_conv, 0, 0, 0, 0, 0);
5812         void* ret_ptr = untag_ptr(ret);
5813         CHECK_ACCESS(ret_ptr);
5814         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5815         FREE(untag_ptr(ret));
5816         return ret_conv;
5817 }
5818 LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5819         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5820         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5821         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5822         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5823         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5824         *tweak_copy = tweak;
5825         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5826         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 24, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5827         void* ret_ptr = untag_ptr(ret);
5828         CHECK_ACCESS(ret_ptr);
5829         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5830         FREE(untag_ptr(ret));
5831         return ret_conv;
5832 }
5833 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
5834         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5835         LDKu8slice hrp_bytes_var = hrp_bytes;
5836         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5837         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5838         LDKCVec_U5Z invoice_data_var = invoice_data;
5839         ptrArray invoice_data_arr = NULL;
5840         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5841         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5842         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5843                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5844                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5845         }
5846         
5847         FREE(invoice_data_var.data);
5848         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5849         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);
5850         void* ret_ptr = untag_ptr(ret);
5851         CHECK_ACCESS(ret_ptr);
5852         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5853         FREE(untag_ptr(ret));
5854         return ret_conv;
5855 }
5856 LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
5857         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5858         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
5859         *msg_copy = msg;
5860         uint64_t msg_ref = tag_ptr(msg_copy, true);
5861         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 26, msg_ref, 0, 0, 0, 0, 0);
5862         void* ret_ptr = untag_ptr(ret);
5863         CHECK_ACCESS(ret_ptr);
5864         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5865         FREE(untag_ptr(ret));
5866         return ret_conv;
5867 }
5868 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
5869         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
5870         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5871 }
5872 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
5873         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
5874         atomic_init(&calls->refcnt, 1);
5875         calls->instance_ptr = o;
5876
5877         LDKNodeSigner ret = {
5878                 .this_arg = (void*) calls,
5879                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
5880                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
5881                 .ecdh = ecdh_LDKNodeSigner_jcall,
5882                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
5883                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
5884                 .free = LDKNodeSigner_JCalls_free,
5885         };
5886         return ret;
5887 }
5888 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
5889         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
5890         *res_ptr = LDKNodeSigner_init(o);
5891         return tag_ptr(res_ptr, true);
5892 }
5893 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
5894         void* this_arg_ptr = untag_ptr(this_arg);
5895         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5896         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5897         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5898         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5899         return ret_arr;
5900 }
5901
5902 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
5903         void* this_arg_ptr = untag_ptr(this_arg);
5904         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5905         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5906         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5907         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5908         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5909         return tag_ptr(ret_conv, true);
5910 }
5911
5912 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) {
5913         void* this_arg_ptr = untag_ptr(this_arg);
5914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5915         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5916         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5917         LDKPublicKey other_key_ref;
5918         CHECK(other_key->arr_len == 33);
5919         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5920         void* tweak_ptr = untag_ptr(tweak);
5921         CHECK_ACCESS(tweak_ptr);
5922         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5923         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
5924         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5925         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5926         return tag_ptr(ret_conv, true);
5927 }
5928
5929 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) {
5930         void* this_arg_ptr = untag_ptr(this_arg);
5931         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5932         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5933         LDKu8slice hrp_bytes_ref;
5934         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5935         hrp_bytes_ref.data = hrp_bytes->elems;
5936         LDKCVec_U5Z invoice_data_constr;
5937         invoice_data_constr.datalen = invoice_data->arr_len;
5938         if (invoice_data_constr.datalen > 0)
5939                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5940         else
5941                 invoice_data_constr.data = NULL;
5942         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5943         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5944                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5945                 
5946                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5947         }
5948         FREE(invoice_data);
5949         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5950         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5951         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
5952         FREE(hrp_bytes);
5953         return tag_ptr(ret_conv, true);
5954 }
5955
5956 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
5957         void* this_arg_ptr = untag_ptr(this_arg);
5958         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5959         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5960         void* msg_ptr = untag_ptr(msg);
5961         CHECK_ACCESS(msg_ptr);
5962         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
5963         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
5964         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5965         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
5966         return tag_ptr(ret_conv, true);
5967 }
5968
5969 typedef struct LDKSignerProvider_JCalls {
5970         atomic_size_t refcnt;
5971         uint32_t instance_ptr;
5972 } LDKSignerProvider_JCalls;
5973 static void LDKSignerProvider_JCalls_free(void* this_arg) {
5974         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5975         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5976                 FREE(j_calls);
5977         }
5978 }
5979 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5980         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5981         jboolean inbound_conv = inbound;
5982         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5983         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5984         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5985         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);
5986         LDKThirtyTwoBytes ret_ref;
5987         CHECK(ret->arr_len == 32);
5988         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5989         return ret_ref;
5990 }
5991 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5992         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5993         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5994         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5995         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5996         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);
5997         void* ret_ptr = untag_ptr(ret);
5998         CHECK_ACCESS(ret_ptr);
5999         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6000         FREE(untag_ptr(ret));
6001         return ret_conv;
6002 }
6003 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6004         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6005         LDKu8slice reader_var = reader;
6006         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6007         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6008         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
6009         void* ret_ptr = untag_ptr(ret);
6010         CHECK_ACCESS(ret_ptr);
6011         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6012         FREE(untag_ptr(ret));
6013         return ret_conv;
6014 }
6015 LDKCVec_u8Z get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
6016         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6017         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
6018         LDKCVec_u8Z ret_ref;
6019         ret_ref.datalen = ret->arr_len;
6020         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6021         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6022         return ret_ref;
6023 }
6024 LDKShutdownScript get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6025         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6026         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
6027         LDKShutdownScript ret_conv;
6028         ret_conv.inner = untag_ptr(ret);
6029         ret_conv.is_owned = ptr_is_owned(ret);
6030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6031         return ret_conv;
6032 }
6033 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6034         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6035         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6036 }
6037 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
6038         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6039         atomic_init(&calls->refcnt, 1);
6040         calls->instance_ptr = o;
6041
6042         LDKSignerProvider ret = {
6043                 .this_arg = (void*) calls,
6044                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6045                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6046                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6047                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6048                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6049                 .free = LDKSignerProvider_JCalls_free,
6050         };
6051         return ret;
6052 }
6053 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
6054         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
6055         *res_ptr = LDKSignerProvider_init(o);
6056         return tag_ptr(res_ptr, true);
6057 }
6058 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) {
6059         void* this_arg_ptr = untag_ptr(this_arg);
6060         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6061         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6062         LDKU128 user_channel_id_ref;
6063         CHECK(user_channel_id->arr_len == 16);
6064         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
6065         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6066         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);
6067         return ret_arr;
6068 }
6069
6070 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) {
6071         void* this_arg_ptr = untag_ptr(this_arg);
6072         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6073         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6074         LDKThirtyTwoBytes channel_keys_id_ref;
6075         CHECK(channel_keys_id->arr_len == 32);
6076         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6077         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6078         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
6079         return tag_ptr(ret_ret, true);
6080 }
6081
6082 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
6083         void* this_arg_ptr = untag_ptr(this_arg);
6084         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6085         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6086         LDKu8slice reader_ref;
6087         reader_ref.datalen = reader->arr_len;
6088         reader_ref.data = reader->elems;
6089         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
6090         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6091         FREE(reader);
6092         return tag_ptr(ret_conv, true);
6093 }
6094
6095 int8_tArray  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
6096         void* this_arg_ptr = untag_ptr(this_arg);
6097         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6098         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6099         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6100         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6101         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6102         CVec_u8Z_free(ret_var);
6103         return ret_arr;
6104 }
6105
6106 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
6107         void* this_arg_ptr = untag_ptr(this_arg);
6108         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6109         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6110         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6111         uint64_t ret_ref = 0;
6112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6114         return ret_ref;
6115 }
6116
6117 typedef struct LDKFeeEstimator_JCalls {
6118         atomic_size_t refcnt;
6119         uint32_t instance_ptr;
6120 } LDKFeeEstimator_JCalls;
6121 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6122         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6123         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6124                 FREE(j_calls);
6125         }
6126 }
6127 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6128         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6129         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6130         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, confirmation_target_conv, 0, 0, 0, 0, 0);
6131 }
6132 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6133         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6134         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6135 }
6136 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6137         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6138         atomic_init(&calls->refcnt, 1);
6139         calls->instance_ptr = o;
6140
6141         LDKFeeEstimator ret = {
6142                 .this_arg = (void*) calls,
6143                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6144                 .free = LDKFeeEstimator_JCalls_free,
6145         };
6146         return ret;
6147 }
6148 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6149         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6150         *res_ptr = LDKFeeEstimator_init(o);
6151         return tag_ptr(res_ptr, true);
6152 }
6153 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) {
6154         void* this_arg_ptr = untag_ptr(this_arg);
6155         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6156         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6157         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6158         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6159         return ret_conv;
6160 }
6161
6162 typedef struct LDKRouter_JCalls {
6163         atomic_size_t refcnt;
6164         uint32_t instance_ptr;
6165 } LDKRouter_JCalls;
6166 static void LDKRouter_JCalls_free(void* this_arg) {
6167         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6168         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6169                 FREE(j_calls);
6170         }
6171 }
6172 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs) {
6173         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6174         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6175         memcpy(payer_arr->elems, payer.compressed_form, 33);
6176         LDKRouteParameters route_params_var = *route_params;
6177         uint64_t route_params_ref = 0;
6178         route_params_var = RouteParameters_clone(&route_params_var);
6179         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6180         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6181         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6182         uint64_tArray first_hops_arr = NULL;
6183         if (first_hops != NULL) {
6184                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6185                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6186                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6187                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6188                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6189                         uint64_t first_hops_conv_16_ref = 0;
6190                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6191                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6192                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6193                 }
6194         
6195         }
6196         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
6197         uint64_t inflight_htlcs_ref = 0;
6198         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
6199         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6200         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6201         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);
6202         void* ret_ptr = untag_ptr(ret);
6203         CHECK_ACCESS(ret_ptr);
6204         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6205         FREE(untag_ptr(ret));
6206         return ret_conv;
6207 }
6208 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) {
6209         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6210         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6211         memcpy(payer_arr->elems, payer.compressed_form, 33);
6212         LDKRouteParameters route_params_var = *route_params;
6213         uint64_t route_params_ref = 0;
6214         route_params_var = RouteParameters_clone(&route_params_var);
6215         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6216         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6217         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6218         uint64_tArray first_hops_arr = NULL;
6219         if (first_hops != NULL) {
6220                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6221                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6222                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6223                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6224                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6225                         uint64_t first_hops_conv_16_ref = 0;
6226                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6227                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6228                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6229                 }
6230         
6231         }
6232         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
6233         uint64_t inflight_htlcs_ref = 0;
6234         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
6235         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6236         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6237         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
6238         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
6239         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
6240         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
6241         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);
6242         void* ret_ptr = untag_ptr(ret);
6243         CHECK_ACCESS(ret_ptr);
6244         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6245         FREE(untag_ptr(ret));
6246         return ret_conv;
6247 }
6248 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
6249         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
6250         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6251 }
6252 static inline LDKRouter LDKRouter_init (JSValue o) {
6253         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
6254         atomic_init(&calls->refcnt, 1);
6255         calls->instance_ptr = o;
6256
6257         LDKRouter ret = {
6258                 .this_arg = (void*) calls,
6259                 .find_route = find_route_LDKRouter_jcall,
6260                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
6261                 .free = LDKRouter_JCalls_free,
6262         };
6263         return ret;
6264 }
6265 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
6266         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
6267         *res_ptr = LDKRouter_init(o);
6268         return tag_ptr(res_ptr, true);
6269 }
6270 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) {
6271         void* this_arg_ptr = untag_ptr(this_arg);
6272         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6273         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6274         LDKPublicKey payer_ref;
6275         CHECK(payer->arr_len == 33);
6276         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6277         LDKRouteParameters route_params_conv;
6278         route_params_conv.inner = untag_ptr(route_params);
6279         route_params_conv.is_owned = ptr_is_owned(route_params);
6280         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6281         route_params_conv.is_owned = false;
6282         LDKCVec_ChannelDetailsZ first_hops_constr;
6283         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6284         if (first_hops != 0) {
6285                 first_hops_constr.datalen = first_hops->arr_len;
6286                 if (first_hops_constr.datalen > 0)
6287                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6288                 else
6289                         first_hops_constr.data = NULL;
6290                 uint64_t* first_hops_vals = first_hops->elems;
6291                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6292                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6293                         LDKChannelDetails first_hops_conv_16_conv;
6294                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6295                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6296                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6297                         first_hops_conv_16_conv.is_owned = false;
6298                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6299                 }
6300                 FREE(first_hops);
6301                 first_hops_ptr = &first_hops_constr;
6302         }
6303         LDKInFlightHtlcs inflight_htlcs_conv;
6304         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6305         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6306         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6307         inflight_htlcs_conv.is_owned = false;
6308         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6309         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv);
6310         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6311         return tag_ptr(ret_conv, true);
6312 }
6313
6314 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) {
6315         void* this_arg_ptr = untag_ptr(this_arg);
6316         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6317         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6318         LDKPublicKey payer_ref;
6319         CHECK(payer->arr_len == 33);
6320         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6321         LDKRouteParameters route_params_conv;
6322         route_params_conv.inner = untag_ptr(route_params);
6323         route_params_conv.is_owned = ptr_is_owned(route_params);
6324         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6325         route_params_conv.is_owned = false;
6326         LDKCVec_ChannelDetailsZ first_hops_constr;
6327         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6328         if (first_hops != 0) {
6329                 first_hops_constr.datalen = first_hops->arr_len;
6330                 if (first_hops_constr.datalen > 0)
6331                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6332                 else
6333                         first_hops_constr.data = NULL;
6334                 uint64_t* first_hops_vals = first_hops->elems;
6335                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6336                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6337                         LDKChannelDetails first_hops_conv_16_conv;
6338                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6339                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6340                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6341                         first_hops_conv_16_conv.is_owned = false;
6342                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6343                 }
6344                 FREE(first_hops);
6345                 first_hops_ptr = &first_hops_constr;
6346         }
6347         LDKInFlightHtlcs inflight_htlcs_conv;
6348         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6349         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6350         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6351         inflight_htlcs_conv.is_owned = false;
6352         LDKThirtyTwoBytes _payment_hash_ref;
6353         CHECK(_payment_hash->arr_len == 32);
6354         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6355         LDKThirtyTwoBytes _payment_id_ref;
6356         CHECK(_payment_id->arr_len == 32);
6357         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6358         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6359         *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);
6360         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6361         return tag_ptr(ret_conv, true);
6362 }
6363
6364 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6365         return ThirtyTwoBytes_clone(&owner->a);
6366 }
6367 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
6368         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6369         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6370         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
6371         return ret_arr;
6372 }
6373
6374 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6375         LDKChannelManager ret = owner->b;
6376         ret.is_owned = false;
6377         return ret;
6378 }
6379 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
6380         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6381         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6382         uint64_t ret_ref = 0;
6383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6385         return ret_ref;
6386 }
6387
6388 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6389 CHECK(owner->result_ok);
6390         return &*owner->contents.result;
6391 }
6392 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6393         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6394         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6395         return ret_ret;
6396 }
6397
6398 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6399 CHECK(!owner->result_ok);
6400         return DecodeError_clone(&*owner->contents.err);
6401 }
6402 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6403         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6404         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6405         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6406         uint64_t ret_ref = tag_ptr(ret_copy, true);
6407         return ret_ref;
6408 }
6409
6410 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6411         LDKChannelConfig ret = *owner->contents.result;
6412         ret.is_owned = false;
6413         return ret;
6414 }
6415 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6416         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6417         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6418         uint64_t ret_ref = 0;
6419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6421         return ret_ref;
6422 }
6423
6424 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6425 CHECK(!owner->result_ok);
6426         return DecodeError_clone(&*owner->contents.err);
6427 }
6428 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6429         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6430         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6431         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6432         uint64_t ret_ref = tag_ptr(ret_copy, true);
6433         return ret_ref;
6434 }
6435
6436 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6437         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6438         switch(obj->tag) {
6439                 case LDKCOption_APIErrorZ_Some: return 0;
6440                 case LDKCOption_APIErrorZ_None: return 1;
6441                 default: abort();
6442         }
6443 }
6444 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6445         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6446         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6447                         uint64_t some_ref = tag_ptr(&obj->some, false);
6448         return some_ref;
6449 }
6450 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6451 CHECK(owner->result_ok);
6452         return COption_APIErrorZ_clone(&*owner->contents.result);
6453 }
6454 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6455         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6456         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6457         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6458         uint64_t ret_ref = tag_ptr(ret_copy, true);
6459         return ret_ref;
6460 }
6461
6462 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6463 CHECK(!owner->result_ok);
6464         return DecodeError_clone(&*owner->contents.err);
6465 }
6466 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6467         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6468         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6469         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
6470         uint64_t ret_ref = tag_ptr(ret_copy, true);
6471         return ret_ref;
6472 }
6473
6474 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
6475         LDKUntrustedString ret = *owner->contents.result;
6476         ret.is_owned = false;
6477         return ret;
6478 }
6479 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
6480         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
6481         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
6482         uint64_t ret_ref = 0;
6483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6485         return ret_ref;
6486 }
6487
6488 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
6489 CHECK(!owner->result_ok);
6490         return DecodeError_clone(&*owner->contents.err);
6491 }
6492 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
6493         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
6494         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6495         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
6496         uint64_t ret_ref = tag_ptr(ret_copy, true);
6497         return ret_ref;
6498 }
6499
6500 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6501         LDKOutPoint ret = *owner->contents.result;
6502         ret.is_owned = false;
6503         return ret;
6504 }
6505 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
6506         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6507         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6508         uint64_t ret_ref = 0;
6509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6511         return ret_ref;
6512 }
6513
6514 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6515 CHECK(!owner->result_ok);
6516         return DecodeError_clone(&*owner->contents.err);
6517 }
6518 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
6519         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6520         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6521         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6522         uint64_t ret_ref = tag_ptr(ret_copy, true);
6523         return ret_ref;
6524 }
6525
6526 typedef struct LDKType_JCalls {
6527         atomic_size_t refcnt;
6528         uint32_t instance_ptr;
6529 } LDKType_JCalls;
6530 static void LDKType_JCalls_free(void* this_arg) {
6531         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6532         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6533                 FREE(j_calls);
6534         }
6535 }
6536 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6537         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6538         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
6539 }
6540 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6541         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6542         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
6543         LDKStr ret_conv = str_ref_to_owned_c(ret);
6544         return ret_conv;
6545 }
6546 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6547         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6548         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, 0, 0, 0, 0, 0, 0);
6549         LDKCVec_u8Z ret_ref;
6550         ret_ref.datalen = ret->arr_len;
6551         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6552         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6553         return ret_ref;
6554 }
6555 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6556         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6557         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6558 }
6559 static inline LDKType LDKType_init (JSValue o) {
6560         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6561         atomic_init(&calls->refcnt, 1);
6562         calls->instance_ptr = o;
6563
6564         LDKType ret = {
6565                 .this_arg = (void*) calls,
6566                 .type_id = type_id_LDKType_jcall,
6567                 .debug_str = debug_str_LDKType_jcall,
6568                 .write = write_LDKType_jcall,
6569                 .cloned = LDKType_JCalls_cloned,
6570                 .free = LDKType_JCalls_free,
6571         };
6572         return ret;
6573 }
6574 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
6575         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6576         *res_ptr = LDKType_init(o);
6577         return tag_ptr(res_ptr, true);
6578 }
6579 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
6580         void* this_arg_ptr = untag_ptr(this_arg);
6581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6582         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6583         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6584         return ret_conv;
6585 }
6586
6587 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
6588         void* this_arg_ptr = untag_ptr(this_arg);
6589         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6590         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6591         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6592         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6593         Str_free(ret_str);
6594         return ret_conv;
6595 }
6596
6597 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
6598         void* this_arg_ptr = untag_ptr(this_arg);
6599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6600         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6601         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6602         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6603         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6604         CVec_u8Z_free(ret_var);
6605         return ret_arr;
6606 }
6607
6608 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
6609         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6610         switch(obj->tag) {
6611                 case LDKCOption_TypeZ_Some: return 0;
6612                 case LDKCOption_TypeZ_None: return 1;
6613                 default: abort();
6614         }
6615 }
6616 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
6617         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6618         assert(obj->tag == LDKCOption_TypeZ_Some);
6619                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6620                         *some_ret = Type_clone(&obj->some);
6621         return tag_ptr(some_ret, true);
6622 }
6623 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6624 CHECK(owner->result_ok);
6625         return COption_TypeZ_clone(&*owner->contents.result);
6626 }
6627 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
6628         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6629         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6630         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6631         uint64_t ret_ref = tag_ptr(ret_copy, true);
6632         return ret_ref;
6633 }
6634
6635 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6636 CHECK(!owner->result_ok);
6637         return DecodeError_clone(&*owner->contents.err);
6638 }
6639 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
6640         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6641         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6642         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6643         uint64_t ret_ref = tag_ptr(ret_copy, true);
6644         return ret_ref;
6645 }
6646
6647 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
6648         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6649         switch(obj->tag) {
6650                 case LDKPaymentError_Invoice: return 0;
6651                 case LDKPaymentError_Sending: return 1;
6652                 default: abort();
6653         }
6654 }
6655 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
6656         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6657         assert(obj->tag == LDKPaymentError_Invoice);
6658                         LDKStr invoice_str = obj->invoice;
6659                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
6660         return invoice_conv;
6661 }
6662 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
6663         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6664         assert(obj->tag == LDKPaymentError_Sending);
6665                         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
6666         return sending_conv;
6667 }
6668 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6669 CHECK(owner->result_ok);
6670         return ThirtyTwoBytes_clone(&*owner->contents.result);
6671 }
6672 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
6673         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
6674         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6675         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
6676         return ret_arr;
6677 }
6678
6679 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6680 CHECK(!owner->result_ok);
6681         return PaymentError_clone(&*owner->contents.err);
6682 }
6683 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
6684         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
6685         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6686         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6687         uint64_t ret_ref = tag_ptr(ret_copy, true);
6688         return ret_ref;
6689 }
6690
6691 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
6692 CHECK(owner->result_ok);
6693         return *owner->contents.result;
6694 }
6695 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
6696         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
6697         CResult_NonePaymentErrorZ_get_ok(owner_conv);
6698 }
6699
6700 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
6701 CHECK(!owner->result_ok);
6702         return PaymentError_clone(&*owner->contents.err);
6703 }
6704 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
6705         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
6706         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6707         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
6708         uint64_t ret_ref = tag_ptr(ret_copy, true);
6709         return ret_ref;
6710 }
6711
6712 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6713 CHECK(owner->result_ok);
6714         return *owner->contents.result;
6715 }
6716 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
6717         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6718         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6719         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6720         return ret_conv;
6721 }
6722
6723 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6724 CHECK(!owner->result_ok);
6725         return *owner->contents.err;
6726 }
6727 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
6728         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6729         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6730         return ret_conv;
6731 }
6732
6733 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6734         LDKChannelMonitorUpdate ret = *owner->contents.result;
6735         ret.is_owned = false;
6736         return ret;
6737 }
6738 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6739         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6740         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6741         uint64_t ret_ref = 0;
6742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6744         return ret_ref;
6745 }
6746
6747 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6748 CHECK(!owner->result_ok);
6749         return DecodeError_clone(&*owner->contents.err);
6750 }
6751 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6752         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6753         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6754         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6755         uint64_t ret_ref = tag_ptr(ret_copy, true);
6756         return ret_ref;
6757 }
6758
6759 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6760         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6761         switch(obj->tag) {
6762                 case LDKCOption_MonitorEventZ_Some: return 0;
6763                 case LDKCOption_MonitorEventZ_None: return 1;
6764                 default: abort();
6765         }
6766 }
6767 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6768         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6769         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6770                         uint64_t some_ref = tag_ptr(&obj->some, false);
6771         return some_ref;
6772 }
6773 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6774 CHECK(owner->result_ok);
6775         return COption_MonitorEventZ_clone(&*owner->contents.result);
6776 }
6777 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6778         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6779         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6780         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6781         uint64_t ret_ref = tag_ptr(ret_copy, true);
6782         return ret_ref;
6783 }
6784
6785 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6786 CHECK(!owner->result_ok);
6787         return DecodeError_clone(&*owner->contents.err);
6788 }
6789 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6790         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6791         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6792         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6793         uint64_t ret_ref = tag_ptr(ret_copy, true);
6794         return ret_ref;
6795 }
6796
6797 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6798         LDKHTLCUpdate ret = *owner->contents.result;
6799         ret.is_owned = false;
6800         return ret;
6801 }
6802 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6803         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6804         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6805         uint64_t ret_ref = 0;
6806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6808         return ret_ref;
6809 }
6810
6811 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6812 CHECK(!owner->result_ok);
6813         return DecodeError_clone(&*owner->contents.err);
6814 }
6815 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6816         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6817         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6818         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6819         uint64_t ret_ref = tag_ptr(ret_copy, true);
6820         return ret_ref;
6821 }
6822
6823 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6824         LDKOutPoint ret = owner->a;
6825         ret.is_owned = false;
6826         return ret;
6827 }
6828 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6829         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6830         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6831         uint64_t ret_ref = 0;
6832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6834         return ret_ref;
6835 }
6836
6837 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6838         return CVec_u8Z_clone(&owner->b);
6839 }
6840 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6841         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6842         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6843         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6844         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6845         CVec_u8Z_free(ret_var);
6846         return ret_arr;
6847 }
6848
6849 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6850         return owner->a;
6851 }
6852 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6853         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6854         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6855         return ret_conv;
6856 }
6857
6858 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6859         return CVec_u8Z_clone(&owner->b);
6860 }
6861 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6862         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6863         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6864         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6865         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6866         CVec_u8Z_free(ret_var);
6867         return ret_arr;
6868 }
6869
6870 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6871         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6872         for (size_t i = 0; i < ret.datalen; i++) {
6873                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6874         }
6875         return ret;
6876 }
6877 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6878         return ThirtyTwoBytes_clone(&owner->a);
6879 }
6880 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6881         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6882         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6883         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6884         return ret_arr;
6885 }
6886
6887 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6888         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6889 }
6890 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6891         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6892         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6893         uint64_tArray ret_arr = NULL;
6894         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6895         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6896         for (size_t v = 0; v < ret_var.datalen; v++) {
6897                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6898                 *ret_conv_21_conv = ret_var.data[v];
6899                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6900         }
6901         
6902         FREE(ret_var.data);
6903         return ret_arr;
6904 }
6905
6906 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6907         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 };
6908         for (size_t i = 0; i < ret.datalen; i++) {
6909                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6910         }
6911         return ret;
6912 }
6913 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6914         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6915         for (size_t i = 0; i < ret.datalen; i++) {
6916                 ret.data[i] = Event_clone(&orig->data[i]);
6917         }
6918         return ret;
6919 }
6920 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6921         return owner->a;
6922 }
6923 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6924         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6925         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6926         return ret_conv;
6927 }
6928
6929 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6930         return TxOut_clone(&owner->b);
6931 }
6932 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6933         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6934         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6935         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6936         return tag_ptr(ret_ref, true);
6937 }
6938
6939 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6940         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6941         for (size_t i = 0; i < ret.datalen; i++) {
6942                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6943         }
6944         return ret;
6945 }
6946 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6947         return ThirtyTwoBytes_clone(&owner->a);
6948 }
6949 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6950         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6951         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6952         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6953         return ret_arr;
6954 }
6955
6956 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6957         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6958 }
6959 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6960         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6961         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6962         uint64_tArray ret_arr = NULL;
6963         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6964         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6965         for (size_t u = 0; u < ret_var.datalen; u++) {
6966                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6967                 *ret_conv_20_conv = ret_var.data[u];
6968                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6969         }
6970         
6971         FREE(ret_var.data);
6972         return ret_arr;
6973 }
6974
6975 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6976         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 };
6977         for (size_t i = 0; i < ret.datalen; i++) {
6978                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6979         }
6980         return ret;
6981 }
6982 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6983         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6984         switch(obj->tag) {
6985                 case LDKBalance_ClaimableOnChannelClose: return 0;
6986                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6987                 case LDKBalance_ContentiousClaimable: return 2;
6988                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6989                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6990                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6991                 default: abort();
6992         }
6993 }
6994 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6995         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6996         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6997                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6998         return claimable_amount_satoshis_conv;
6999 }
7000 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
7001         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7002         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7003                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
7004         return claimable_amount_satoshis_conv;
7005 }
7006 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
7007         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7008         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7009                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7010         return confirmation_height_conv;
7011 }
7012 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
7013         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7014         assert(obj->tag == LDKBalance_ContentiousClaimable);
7015                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
7016         return claimable_amount_satoshis_conv;
7017 }
7018 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
7019         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7020         assert(obj->tag == LDKBalance_ContentiousClaimable);
7021                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7022         return timeout_height_conv;
7023 }
7024 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
7025         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7026         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7027                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
7028         return claimable_amount_satoshis_conv;
7029 }
7030 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
7031         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7032         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7033                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
7034         return claimable_height_conv;
7035 }
7036 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
7037         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7038         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7039                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
7040         return claimable_amount_satoshis_conv;
7041 }
7042 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
7043         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7044         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7045                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
7046         return expiry_height_conv;
7047 }
7048 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
7049         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7050         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
7051                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
7052         return claimable_amount_satoshis_conv;
7053 }
7054 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7055         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7056         for (size_t i = 0; i < ret.datalen; i++) {
7057                 ret.data[i] = Balance_clone(&orig->data[i]);
7058         }
7059         return ret;
7060 }
7061 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
7062         return ThirtyTwoBytes_clone(&owner->a);
7063 }
7064 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
7065         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
7066         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7067         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
7068         return ret_arr;
7069 }
7070
7071 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
7072         LDKChannelMonitor ret = owner->b;
7073         ret.is_owned = false;
7074         return ret;
7075 }
7076 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
7077         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
7078         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
7079         uint64_t ret_ref = 0;
7080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7082         return ret_ref;
7083 }
7084
7085 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7086 CHECK(owner->result_ok);
7087         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
7088 }
7089 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
7090         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7091         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7092         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7093         return tag_ptr(ret_conv, true);
7094 }
7095
7096 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7097 CHECK(!owner->result_ok);
7098         return DecodeError_clone(&*owner->contents.err);
7099 }
7100 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
7101         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7102         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7103         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7104         uint64_t ret_ref = tag_ptr(ret_copy, true);
7105         return ret_ref;
7106 }
7107
7108 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7109         return owner->a;
7110 }
7111 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
7112         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7113         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7114         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
7115         return ret_arr;
7116 }
7117
7118 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7119         return Type_clone(&owner->b);
7120 }
7121 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
7122         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7123         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7124         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7125         return tag_ptr(ret_ret, true);
7126 }
7127
7128 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7129         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7130         for (size_t i = 0; i < ret.datalen; i++) {
7131                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7132         }
7133         return ret;
7134 }
7135 typedef struct LDKCustomOnionMessageContents_JCalls {
7136         atomic_size_t refcnt;
7137         uint32_t instance_ptr;
7138 } LDKCustomOnionMessageContents_JCalls;
7139 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
7140         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
7141         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7142                 FREE(j_calls);
7143         }
7144 }
7145 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
7146         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
7147         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
7148 }
7149 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
7150         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
7151         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
7152         LDKCVec_u8Z ret_ref;
7153         ret_ref.datalen = ret->arr_len;
7154         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7155         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7156         return ret_ref;
7157 }
7158 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
7159         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
7160         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7161 }
7162 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
7163         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
7164         atomic_init(&calls->refcnt, 1);
7165         calls->instance_ptr = o;
7166
7167         LDKCustomOnionMessageContents ret = {
7168                 .this_arg = (void*) calls,
7169                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
7170                 .write = write_LDKCustomOnionMessageContents_jcall,
7171                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
7172                 .free = LDKCustomOnionMessageContents_JCalls_free,
7173         };
7174         return ret;
7175 }
7176 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
7177         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
7178         *res_ptr = LDKCustomOnionMessageContents_init(o);
7179         return tag_ptr(res_ptr, true);
7180 }
7181 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
7182         void* this_arg_ptr = untag_ptr(this_arg);
7183         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7184         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
7185         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
7186         return ret_conv;
7187 }
7188
7189 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
7190         void* this_arg_ptr = untag_ptr(this_arg);
7191         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7192         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
7193         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7194         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7195         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7196         CVec_u8Z_free(ret_var);
7197         return ret_arr;
7198 }
7199
7200 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
7201         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
7202         switch(obj->tag) {
7203                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
7204                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
7205                 default: abort();
7206         }
7207 }
7208 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
7209         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
7210         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
7211                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
7212                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
7213         return tag_ptr(some_ret, true);
7214 }
7215 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7216 CHECK(owner->result_ok);
7217         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
7218 }
7219 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
7220         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7221         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
7222         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
7223         uint64_t ret_ref = tag_ptr(ret_copy, true);
7224         return ret_ref;
7225 }
7226
7227 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7228 CHECK(!owner->result_ok);
7229         return DecodeError_clone(&*owner->contents.err);
7230 }
7231 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
7232         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7233         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7234         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
7235         uint64_t ret_ref = tag_ptr(ret_copy, true);
7236         return ret_ref;
7237 }
7238
7239 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
7240         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
7241         switch(obj->tag) {
7242                 case LDKCOption_NetAddressZ_Some: return 0;
7243                 case LDKCOption_NetAddressZ_None: return 1;
7244                 default: abort();
7245         }
7246 }
7247 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
7248         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
7249         assert(obj->tag == LDKCOption_NetAddressZ_Some);
7250                         uint64_t some_ref = tag_ptr(&obj->some, false);
7251         return some_ref;
7252 }
7253 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
7254         return owner->a;
7255 }
7256 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(uint64_t owner) {
7257         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
7258         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7259         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form, 33);
7260         return ret_arr;
7261 }
7262
7263 static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
7264         return COption_NetAddressZ_clone(&owner->b);
7265 }
7266 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(uint64_t owner) {
7267         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
7268         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
7269         *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv);
7270         uint64_t ret_ref = tag_ptr(ret_copy, true);
7271         return ret_ref;
7272 }
7273
7274 static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) {
7275         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen };
7276         for (size_t i = 0; i < ret.datalen; i++) {
7277                 ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]);
7278         }
7279         return ret;
7280 }
7281 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7282 CHECK(owner->result_ok);
7283         return CVec_u8Z_clone(&*owner->contents.result);
7284 }
7285 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
7286         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7287         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7288         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7289         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7290         CVec_u8Z_free(ret_var);
7291         return ret_arr;
7292 }
7293
7294 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7295         LDKPeerHandleError ret = *owner->contents.err;
7296         ret.is_owned = false;
7297         return ret;
7298 }
7299 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7300         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7301         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7302         uint64_t ret_ref = 0;
7303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7305         return ret_ref;
7306 }
7307
7308 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7309 CHECK(owner->result_ok);
7310         return *owner->contents.result;
7311 }
7312 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7313         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7314         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7315 }
7316
7317 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7318         LDKPeerHandleError ret = *owner->contents.err;
7319         ret.is_owned = false;
7320         return ret;
7321 }
7322 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7323         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7324         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7325         uint64_t ret_ref = 0;
7326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7328         return ret_ref;
7329 }
7330
7331 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7332 CHECK(owner->result_ok);
7333         return *owner->contents.result;
7334 }
7335 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7336         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7337         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7338         return ret_conv;
7339 }
7340
7341 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7342         LDKPeerHandleError ret = *owner->contents.err;
7343         ret.is_owned = false;
7344         return ret;
7345 }
7346 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7347         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7348         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7349         uint64_t ret_ref = 0;
7350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7352         return ret_ref;
7353 }
7354
7355 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
7356         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
7357         switch(obj->tag) {
7358                 case LDKSendError_Secp256k1: return 0;
7359                 case LDKSendError_TooBigPacket: return 1;
7360                 case LDKSendError_TooFewBlindedHops: return 2;
7361                 case LDKSendError_InvalidFirstHop: return 3;
7362                 case LDKSendError_InvalidMessage: return 4;
7363                 case LDKSendError_BufferFull: return 5;
7364                 case LDKSendError_GetNodeIdFailed: return 6;
7365                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
7366                 default: abort();
7367         }
7368 }
7369 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
7370         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
7371         assert(obj->tag == LDKSendError_Secp256k1);
7372                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
7373         return secp256k1_conv;
7374 }
7375 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
7376 CHECK(owner->result_ok);
7377         return *owner->contents.result;
7378 }
7379 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
7380         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
7381         CResult_NoneSendErrorZ_get_ok(owner_conv);
7382 }
7383
7384 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
7385 CHECK(!owner->result_ok);
7386         return SendError_clone(&*owner->contents.err);
7387 }
7388 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
7389         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
7390         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
7391         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
7392         uint64_t ret_ref = tag_ptr(ret_copy, true);
7393         return ret_ref;
7394 }
7395
7396 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
7397         LDKBlindedPath ret = *owner->contents.result;
7398         ret.is_owned = false;
7399         return ret;
7400 }
7401 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
7402         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
7403         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
7404         uint64_t ret_ref = 0;
7405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7407         return ret_ref;
7408 }
7409
7410 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
7411 CHECK(!owner->result_ok);
7412         return *owner->contents.err;
7413 }
7414 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
7415         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
7416         CResult_BlindedPathNoneZ_get_err(owner_conv);
7417 }
7418
7419 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
7420         LDKBlindedPath ret = *owner->contents.result;
7421         ret.is_owned = false;
7422         return ret;
7423 }
7424 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
7425         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
7426         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
7427         uint64_t ret_ref = 0;
7428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7430         return ret_ref;
7431 }
7432
7433 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
7434 CHECK(!owner->result_ok);
7435         return DecodeError_clone(&*owner->contents.err);
7436 }
7437 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
7438         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
7439         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7440         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
7441         uint64_t ret_ref = tag_ptr(ret_copy, true);
7442         return ret_ref;
7443 }
7444
7445 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
7446         LDKBlindedHop ret = *owner->contents.result;
7447         ret.is_owned = false;
7448         return ret;
7449 }
7450 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
7451         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
7452         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
7453         uint64_t ret_ref = 0;
7454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7456         return ret_ref;
7457 }
7458
7459 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
7460 CHECK(!owner->result_ok);
7461         return DecodeError_clone(&*owner->contents.err);
7462 }
7463 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
7464         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
7465         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7466         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
7467         uint64_t ret_ref = tag_ptr(ret_copy, true);
7468         return ret_ref;
7469 }
7470
7471 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7472         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7473         switch(obj->tag) {
7474                 case LDKGraphSyncError_DecodeError: return 0;
7475                 case LDKGraphSyncError_LightningError: return 1;
7476                 default: abort();
7477         }
7478 }
7479 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7480         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7481         assert(obj->tag == LDKGraphSyncError_DecodeError);
7482                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7483         return decode_error_ref;
7484 }
7485 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7486         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7487         assert(obj->tag == LDKGraphSyncError_LightningError);
7488                         LDKLightningError lightning_error_var = obj->lightning_error;
7489                         uint64_t lightning_error_ref = 0;
7490                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7491                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7492         return lightning_error_ref;
7493 }
7494 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7495 CHECK(owner->result_ok);
7496         return *owner->contents.result;
7497 }
7498 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7499         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7500         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7501         return ret_conv;
7502 }
7503
7504 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7505 CHECK(!owner->result_ok);
7506         return GraphSyncError_clone(&*owner->contents.err);
7507 }
7508 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7509         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7510         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7511         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7512         uint64_t ret_ref = tag_ptr(ret_copy, true);
7513         return ret_ref;
7514 }
7515
7516 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7517 CHECK(owner->result_ok);
7518         return *owner->contents.result;
7519 }
7520 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
7521         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7522         CResult_NoneErrorZ_get_ok(owner_conv);
7523 }
7524
7525 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7526 CHECK(!owner->result_ok);
7527         return *owner->contents.err;
7528 }
7529 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
7530         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7531         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
7532         return ret_conv;
7533 }
7534
7535 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7536 CHECK(owner->result_ok);
7537         return NetAddress_clone(&*owner->contents.result);
7538 }
7539 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
7540         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7541         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
7542         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
7543         uint64_t ret_ref = tag_ptr(ret_copy, true);
7544         return ret_ref;
7545 }
7546
7547 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7548 CHECK(!owner->result_ok);
7549         return DecodeError_clone(&*owner->contents.err);
7550 }
7551 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
7552         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7553         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7554         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
7555         uint64_t ret_ref = tag_ptr(ret_copy, true);
7556         return ret_ref;
7557 }
7558
7559 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7560         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7561         for (size_t i = 0; i < ret.datalen; i++) {
7562                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7563         }
7564         return ret;
7565 }
7566 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7567         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7568         for (size_t i = 0; i < ret.datalen; i++) {
7569                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7570         }
7571         return ret;
7572 }
7573 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7574         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7575         for (size_t i = 0; i < ret.datalen; i++) {
7576                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7577         }
7578         return ret;
7579 }
7580 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7581         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7582         for (size_t i = 0; i < ret.datalen; i++) {
7583                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7584         }
7585         return ret;
7586 }
7587 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7588         LDKAcceptChannel ret = *owner->contents.result;
7589         ret.is_owned = false;
7590         return ret;
7591 }
7592 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7593         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7594         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7595         uint64_t ret_ref = 0;
7596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7598         return ret_ref;
7599 }
7600
7601 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7602 CHECK(!owner->result_ok);
7603         return DecodeError_clone(&*owner->contents.err);
7604 }
7605 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7606         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7607         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7608         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7609         uint64_t ret_ref = tag_ptr(ret_copy, true);
7610         return ret_ref;
7611 }
7612
7613 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7614         LDKAnnouncementSignatures ret = *owner->contents.result;
7615         ret.is_owned = false;
7616         return ret;
7617 }
7618 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7619         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7620         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7621         uint64_t ret_ref = 0;
7622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7624         return ret_ref;
7625 }
7626
7627 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7628 CHECK(!owner->result_ok);
7629         return DecodeError_clone(&*owner->contents.err);
7630 }
7631 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7632         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7633         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7634         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7635         uint64_t ret_ref = tag_ptr(ret_copy, true);
7636         return ret_ref;
7637 }
7638
7639 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7640         LDKChannelReestablish ret = *owner->contents.result;
7641         ret.is_owned = false;
7642         return ret;
7643 }
7644 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7645         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7646         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7647         uint64_t ret_ref = 0;
7648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7650         return ret_ref;
7651 }
7652
7653 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7654 CHECK(!owner->result_ok);
7655         return DecodeError_clone(&*owner->contents.err);
7656 }
7657 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7658         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7659         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7660         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7661         uint64_t ret_ref = tag_ptr(ret_copy, true);
7662         return ret_ref;
7663 }
7664
7665 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7666         LDKClosingSigned ret = *owner->contents.result;
7667         ret.is_owned = false;
7668         return ret;
7669 }
7670 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7671         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7672         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7673         uint64_t ret_ref = 0;
7674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7676         return ret_ref;
7677 }
7678
7679 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7680 CHECK(!owner->result_ok);
7681         return DecodeError_clone(&*owner->contents.err);
7682 }
7683 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7684         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7685         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7686         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7687         uint64_t ret_ref = tag_ptr(ret_copy, true);
7688         return ret_ref;
7689 }
7690
7691 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7692         LDKClosingSignedFeeRange ret = *owner->contents.result;
7693         ret.is_owned = false;
7694         return ret;
7695 }
7696 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7697         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7698         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7699         uint64_t ret_ref = 0;
7700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7702         return ret_ref;
7703 }
7704
7705 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7706 CHECK(!owner->result_ok);
7707         return DecodeError_clone(&*owner->contents.err);
7708 }
7709 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7710         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7711         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7712         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7713         uint64_t ret_ref = tag_ptr(ret_copy, true);
7714         return ret_ref;
7715 }
7716
7717 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7718         LDKCommitmentSigned ret = *owner->contents.result;
7719         ret.is_owned = false;
7720         return ret;
7721 }
7722 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7723         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7724         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7725         uint64_t ret_ref = 0;
7726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7728         return ret_ref;
7729 }
7730
7731 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7732 CHECK(!owner->result_ok);
7733         return DecodeError_clone(&*owner->contents.err);
7734 }
7735 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7736         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7737         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7738         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7739         uint64_t ret_ref = tag_ptr(ret_copy, true);
7740         return ret_ref;
7741 }
7742
7743 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7744         LDKFundingCreated ret = *owner->contents.result;
7745         ret.is_owned = false;
7746         return ret;
7747 }
7748 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7749         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7750         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7751         uint64_t ret_ref = 0;
7752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7754         return ret_ref;
7755 }
7756
7757 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7758 CHECK(!owner->result_ok);
7759         return DecodeError_clone(&*owner->contents.err);
7760 }
7761 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7762         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7763         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7764         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7765         uint64_t ret_ref = tag_ptr(ret_copy, true);
7766         return ret_ref;
7767 }
7768
7769 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7770         LDKFundingSigned ret = *owner->contents.result;
7771         ret.is_owned = false;
7772         return ret;
7773 }
7774 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7775         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7776         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7777         uint64_t ret_ref = 0;
7778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7780         return ret_ref;
7781 }
7782
7783 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7784 CHECK(!owner->result_ok);
7785         return DecodeError_clone(&*owner->contents.err);
7786 }
7787 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7788         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7789         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7790         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7791         uint64_t ret_ref = tag_ptr(ret_copy, true);
7792         return ret_ref;
7793 }
7794
7795 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7796         LDKChannelReady ret = *owner->contents.result;
7797         ret.is_owned = false;
7798         return ret;
7799 }
7800 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7801         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7802         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7803         uint64_t ret_ref = 0;
7804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7806         return ret_ref;
7807 }
7808
7809 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7810 CHECK(!owner->result_ok);
7811         return DecodeError_clone(&*owner->contents.err);
7812 }
7813 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7814         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7815         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7816         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7817         uint64_t ret_ref = tag_ptr(ret_copy, true);
7818         return ret_ref;
7819 }
7820
7821 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7822         LDKInit ret = *owner->contents.result;
7823         ret.is_owned = false;
7824         return ret;
7825 }
7826 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7827         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7828         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7829         uint64_t ret_ref = 0;
7830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7832         return ret_ref;
7833 }
7834
7835 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7836 CHECK(!owner->result_ok);
7837         return DecodeError_clone(&*owner->contents.err);
7838 }
7839 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7840         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7841         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7842         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7843         uint64_t ret_ref = tag_ptr(ret_copy, true);
7844         return ret_ref;
7845 }
7846
7847 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7848         LDKOpenChannel ret = *owner->contents.result;
7849         ret.is_owned = false;
7850         return ret;
7851 }
7852 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7853         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7854         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7855         uint64_t ret_ref = 0;
7856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7858         return ret_ref;
7859 }
7860
7861 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7862 CHECK(!owner->result_ok);
7863         return DecodeError_clone(&*owner->contents.err);
7864 }
7865 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7866         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7867         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7868         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7869         uint64_t ret_ref = tag_ptr(ret_copy, true);
7870         return ret_ref;
7871 }
7872
7873 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7874         LDKRevokeAndACK ret = *owner->contents.result;
7875         ret.is_owned = false;
7876         return ret;
7877 }
7878 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7879         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7880         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7881         uint64_t ret_ref = 0;
7882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7884         return ret_ref;
7885 }
7886
7887 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7888 CHECK(!owner->result_ok);
7889         return DecodeError_clone(&*owner->contents.err);
7890 }
7891 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7892         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7893         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7894         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7895         uint64_t ret_ref = tag_ptr(ret_copy, true);
7896         return ret_ref;
7897 }
7898
7899 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7900         LDKShutdown ret = *owner->contents.result;
7901         ret.is_owned = false;
7902         return ret;
7903 }
7904 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7905         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7906         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7907         uint64_t ret_ref = 0;
7908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7910         return ret_ref;
7911 }
7912
7913 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7914 CHECK(!owner->result_ok);
7915         return DecodeError_clone(&*owner->contents.err);
7916 }
7917 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7918         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7919         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7920         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7921         uint64_t ret_ref = tag_ptr(ret_copy, true);
7922         return ret_ref;
7923 }
7924
7925 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7926         LDKUpdateFailHTLC ret = *owner->contents.result;
7927         ret.is_owned = false;
7928         return ret;
7929 }
7930 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7931         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7932         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7933         uint64_t ret_ref = 0;
7934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7936         return ret_ref;
7937 }
7938
7939 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7940 CHECK(!owner->result_ok);
7941         return DecodeError_clone(&*owner->contents.err);
7942 }
7943 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
7944         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7945         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7946         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7947         uint64_t ret_ref = tag_ptr(ret_copy, true);
7948         return ret_ref;
7949 }
7950
7951 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7952         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
7953         ret.is_owned = false;
7954         return ret;
7955 }
7956 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7957         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7958         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7959         uint64_t ret_ref = 0;
7960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7962         return ret_ref;
7963 }
7964
7965 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7966 CHECK(!owner->result_ok);
7967         return DecodeError_clone(&*owner->contents.err);
7968 }
7969 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
7970         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7971         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7972         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7973         uint64_t ret_ref = tag_ptr(ret_copy, true);
7974         return ret_ref;
7975 }
7976
7977 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7978         LDKUpdateFee ret = *owner->contents.result;
7979         ret.is_owned = false;
7980         return ret;
7981 }
7982 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
7983         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7984         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7985         uint64_t ret_ref = 0;
7986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7988         return ret_ref;
7989 }
7990
7991 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7992 CHECK(!owner->result_ok);
7993         return DecodeError_clone(&*owner->contents.err);
7994 }
7995 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
7996         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7997         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7998         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7999         uint64_t ret_ref = tag_ptr(ret_copy, true);
8000         return ret_ref;
8001 }
8002
8003 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8004         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8005         ret.is_owned = false;
8006         return ret;
8007 }
8008 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8009         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8010         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8011         uint64_t ret_ref = 0;
8012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8014         return ret_ref;
8015 }
8016
8017 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8018 CHECK(!owner->result_ok);
8019         return DecodeError_clone(&*owner->contents.err);
8020 }
8021 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
8022         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8023         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8024         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8025         uint64_t ret_ref = tag_ptr(ret_copy, true);
8026         return ret_ref;
8027 }
8028
8029 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8030         LDKUpdateAddHTLC ret = *owner->contents.result;
8031         ret.is_owned = false;
8032         return ret;
8033 }
8034 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8035         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8036         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8037         uint64_t ret_ref = 0;
8038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8040         return ret_ref;
8041 }
8042
8043 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8044 CHECK(!owner->result_ok);
8045         return DecodeError_clone(&*owner->contents.err);
8046 }
8047 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
8048         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8049         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8050         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8051         uint64_t ret_ref = tag_ptr(ret_copy, true);
8052         return ret_ref;
8053 }
8054
8055 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8056         LDKOnionMessage ret = *owner->contents.result;
8057         ret.is_owned = false;
8058         return ret;
8059 }
8060 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
8061         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8062         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
8063         uint64_t ret_ref = 0;
8064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8066         return ret_ref;
8067 }
8068
8069 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8070 CHECK(!owner->result_ok);
8071         return DecodeError_clone(&*owner->contents.err);
8072 }
8073 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
8074         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8075         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8076         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
8077         uint64_t ret_ref = tag_ptr(ret_copy, true);
8078         return ret_ref;
8079 }
8080
8081 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8082         LDKPing ret = *owner->contents.result;
8083         ret.is_owned = false;
8084         return ret;
8085 }
8086 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
8087         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8088         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8089         uint64_t ret_ref = 0;
8090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8092         return ret_ref;
8093 }
8094
8095 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8096 CHECK(!owner->result_ok);
8097         return DecodeError_clone(&*owner->contents.err);
8098 }
8099 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
8100         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8101         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8102         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
8103         uint64_t ret_ref = tag_ptr(ret_copy, true);
8104         return ret_ref;
8105 }
8106
8107 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8108         LDKPong ret = *owner->contents.result;
8109         ret.is_owned = false;
8110         return ret;
8111 }
8112 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
8113         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8114         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8115         uint64_t ret_ref = 0;
8116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8118         return ret_ref;
8119 }
8120
8121 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8122 CHECK(!owner->result_ok);
8123         return DecodeError_clone(&*owner->contents.err);
8124 }
8125 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
8126         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8127         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8128         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
8129         uint64_t ret_ref = tag_ptr(ret_copy, true);
8130         return ret_ref;
8131 }
8132
8133 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8134         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8135         ret.is_owned = false;
8136         return ret;
8137 }
8138 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8139         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8140         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8141         uint64_t ret_ref = 0;
8142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8144         return ret_ref;
8145 }
8146
8147 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8148 CHECK(!owner->result_ok);
8149         return DecodeError_clone(&*owner->contents.err);
8150 }
8151 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8152         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8153         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8154         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8155         uint64_t ret_ref = tag_ptr(ret_copy, true);
8156         return ret_ref;
8157 }
8158
8159 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8160         LDKChannelAnnouncement ret = *owner->contents.result;
8161         ret.is_owned = false;
8162         return ret;
8163 }
8164 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8165         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8166         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8167         uint64_t ret_ref = 0;
8168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8170         return ret_ref;
8171 }
8172
8173 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8174 CHECK(!owner->result_ok);
8175         return DecodeError_clone(&*owner->contents.err);
8176 }
8177 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8178         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8179         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8180         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8181         uint64_t ret_ref = tag_ptr(ret_copy, true);
8182         return ret_ref;
8183 }
8184
8185 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8186         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8187         ret.is_owned = false;
8188         return ret;
8189 }
8190 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8191         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8192         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8193         uint64_t ret_ref = 0;
8194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8196         return ret_ref;
8197 }
8198
8199 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8200 CHECK(!owner->result_ok);
8201         return DecodeError_clone(&*owner->contents.err);
8202 }
8203 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8204         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8205         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8206         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8207         uint64_t ret_ref = tag_ptr(ret_copy, true);
8208         return ret_ref;
8209 }
8210
8211 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8212         LDKChannelUpdate ret = *owner->contents.result;
8213         ret.is_owned = false;
8214         return ret;
8215 }
8216 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8217         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8218         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8219         uint64_t ret_ref = 0;
8220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8222         return ret_ref;
8223 }
8224
8225 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8226 CHECK(!owner->result_ok);
8227         return DecodeError_clone(&*owner->contents.err);
8228 }
8229 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8230         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8231         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8232         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8233         uint64_t ret_ref = tag_ptr(ret_copy, true);
8234         return ret_ref;
8235 }
8236
8237 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8238         LDKErrorMessage ret = *owner->contents.result;
8239         ret.is_owned = false;
8240         return ret;
8241 }
8242 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
8243         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8244         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8245         uint64_t ret_ref = 0;
8246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8248         return ret_ref;
8249 }
8250
8251 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8252 CHECK(!owner->result_ok);
8253         return DecodeError_clone(&*owner->contents.err);
8254 }
8255 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
8256         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8257         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8258         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8259         uint64_t ret_ref = tag_ptr(ret_copy, true);
8260         return ret_ref;
8261 }
8262
8263 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8264         LDKWarningMessage ret = *owner->contents.result;
8265         ret.is_owned = false;
8266         return ret;
8267 }
8268 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
8269         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8270         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8271         uint64_t ret_ref = 0;
8272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8274         return ret_ref;
8275 }
8276
8277 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8278 CHECK(!owner->result_ok);
8279         return DecodeError_clone(&*owner->contents.err);
8280 }
8281 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
8282         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8283         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8284         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8285         uint64_t ret_ref = tag_ptr(ret_copy, true);
8286         return ret_ref;
8287 }
8288
8289 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8290         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
8291         ret.is_owned = false;
8292         return ret;
8293 }
8294 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8295         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8296         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8297         uint64_t ret_ref = 0;
8298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8300         return ret_ref;
8301 }
8302
8303 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8304 CHECK(!owner->result_ok);
8305         return DecodeError_clone(&*owner->contents.err);
8306 }
8307 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8308         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8309         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8310         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8311         uint64_t ret_ref = tag_ptr(ret_copy, true);
8312         return ret_ref;
8313 }
8314
8315 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8316         LDKNodeAnnouncement ret = *owner->contents.result;
8317         ret.is_owned = false;
8318         return ret;
8319 }
8320 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8321         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8322         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8323         uint64_t ret_ref = 0;
8324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8326         return ret_ref;
8327 }
8328
8329 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8330 CHECK(!owner->result_ok);
8331         return DecodeError_clone(&*owner->contents.err);
8332 }
8333 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8334         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8335         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8336         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8337         uint64_t ret_ref = tag_ptr(ret_copy, true);
8338         return ret_ref;
8339 }
8340
8341 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8342         LDKQueryShortChannelIds ret = *owner->contents.result;
8343         ret.is_owned = false;
8344         return ret;
8345 }
8346 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
8347         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8348         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8349         uint64_t ret_ref = 0;
8350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8352         return ret_ref;
8353 }
8354
8355 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8356 CHECK(!owner->result_ok);
8357         return DecodeError_clone(&*owner->contents.err);
8358 }
8359 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
8360         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8361         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8362         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8363         uint64_t ret_ref = tag_ptr(ret_copy, true);
8364         return ret_ref;
8365 }
8366
8367 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8368         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
8369         ret.is_owned = false;
8370         return ret;
8371 }
8372 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
8373         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8374         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8375         uint64_t ret_ref = 0;
8376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8378         return ret_ref;
8379 }
8380
8381 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8382 CHECK(!owner->result_ok);
8383         return DecodeError_clone(&*owner->contents.err);
8384 }
8385 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
8386         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8387         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8388         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8389         uint64_t ret_ref = tag_ptr(ret_copy, true);
8390         return ret_ref;
8391 }
8392
8393 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8394         LDKQueryChannelRange ret = *owner->contents.result;
8395         ret.is_owned = false;
8396         return ret;
8397 }
8398 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8399         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8400         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8401         uint64_t ret_ref = 0;
8402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8404         return ret_ref;
8405 }
8406
8407 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8408 CHECK(!owner->result_ok);
8409         return DecodeError_clone(&*owner->contents.err);
8410 }
8411 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8412         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8413         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8414         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8415         uint64_t ret_ref = tag_ptr(ret_copy, true);
8416         return ret_ref;
8417 }
8418
8419 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8420         LDKReplyChannelRange ret = *owner->contents.result;
8421         ret.is_owned = false;
8422         return ret;
8423 }
8424 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8425         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8426         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8427         uint64_t ret_ref = 0;
8428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8430         return ret_ref;
8431 }
8432
8433 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8434 CHECK(!owner->result_ok);
8435         return DecodeError_clone(&*owner->contents.err);
8436 }
8437 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8438         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8439         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8440         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8441         uint64_t ret_ref = tag_ptr(ret_copy, true);
8442         return ret_ref;
8443 }
8444
8445 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8446         LDKGossipTimestampFilter ret = *owner->contents.result;
8447         ret.is_owned = false;
8448         return ret;
8449 }
8450 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
8451         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8452         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8453         uint64_t ret_ref = 0;
8454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8456         return ret_ref;
8457 }
8458
8459 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8460 CHECK(!owner->result_ok);
8461         return DecodeError_clone(&*owner->contents.err);
8462 }
8463 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
8464         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8465         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8466         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8467         uint64_t ret_ref = tag_ptr(ret_copy, true);
8468         return ret_ref;
8469 }
8470
8471 typedef struct LDKFilter_JCalls {
8472         atomic_size_t refcnt;
8473         uint32_t instance_ptr;
8474 } LDKFilter_JCalls;
8475 static void LDKFilter_JCalls_free(void* this_arg) {
8476         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8477         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8478                 FREE(j_calls);
8479         }
8480 }
8481 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8482         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8483         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8484         memcpy(txid_arr->elems, *txid, 32);
8485         LDKu8slice script_pubkey_var = script_pubkey;
8486         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8487         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8488         js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
8489 }
8490 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8491         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8492         LDKWatchedOutput output_var = output;
8493         uint64_t output_ref = 0;
8494         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8495         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
8496         js_invoke_function_buuuuu(j_calls->instance_ptr, 41, output_ref, 0, 0, 0, 0, 0);
8497 }
8498 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8499         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8500         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8501 }
8502 static inline LDKFilter LDKFilter_init (JSValue o) {
8503         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8504         atomic_init(&calls->refcnt, 1);
8505         calls->instance_ptr = o;
8506
8507         LDKFilter ret = {
8508                 .this_arg = (void*) calls,
8509                 .register_tx = register_tx_LDKFilter_jcall,
8510                 .register_output = register_output_LDKFilter_jcall,
8511                 .free = LDKFilter_JCalls_free,
8512         };
8513         return ret;
8514 }
8515 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8516         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8517         *res_ptr = LDKFilter_init(o);
8518         return tag_ptr(res_ptr, true);
8519 }
8520 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8521         void* this_arg_ptr = untag_ptr(this_arg);
8522         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8523         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8524         uint8_t txid_arr[32];
8525         CHECK(txid->arr_len == 32);
8526         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8527         uint8_t (*txid_ref)[32] = &txid_arr;
8528         LDKu8slice script_pubkey_ref;
8529         script_pubkey_ref.datalen = script_pubkey->arr_len;
8530         script_pubkey_ref.data = script_pubkey->elems;
8531         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8532         FREE(script_pubkey);
8533 }
8534
8535 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
8536         void* this_arg_ptr = untag_ptr(this_arg);
8537         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8538         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8539         LDKWatchedOutput output_conv;
8540         output_conv.inner = untag_ptr(output);
8541         output_conv.is_owned = ptr_is_owned(output);
8542         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8543         output_conv = WatchedOutput_clone(&output_conv);
8544         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8545 }
8546
8547 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
8548         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8549         switch(obj->tag) {
8550                 case LDKCOption_FilterZ_Some: return 0;
8551                 case LDKCOption_FilterZ_None: return 1;
8552                 default: abort();
8553         }
8554 }
8555 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
8556         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8557         assert(obj->tag == LDKCOption_FilterZ_Some);
8558                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8559                         *some_ret = obj->some;
8560                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8561                         if ((*some_ret).free == LDKFilter_JCalls_free) {
8562                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8563                                 LDKFilter_JCalls_cloned(&(*some_ret));
8564                         }
8565         return tag_ptr(some_ret, true);
8566 }
8567 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8568         LDKLockedChannelMonitor ret = *owner->contents.result;
8569         ret.is_owned = false;
8570         return ret;
8571 }
8572 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
8573         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8574         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8575         uint64_t ret_ref = 0;
8576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8578         return ret_ref;
8579 }
8580
8581 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8582 CHECK(!owner->result_ok);
8583         return *owner->contents.err;
8584 }
8585 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
8586         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8587         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8588 }
8589
8590 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8591         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8592         for (size_t i = 0; i < ret.datalen; i++) {
8593                 ret.data[i] = OutPoint_clone(&orig->data[i]);
8594         }
8595         return ret;
8596 }
8597 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
8598         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
8599         for (size_t i = 0; i < ret.datalen; i++) {
8600                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
8601         }
8602         return ret;
8603 }
8604 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8605         LDKOutPoint ret = owner->a;
8606         ret.is_owned = false;
8607         return ret;
8608 }
8609 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
8610         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8611         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
8612         uint64_t ret_ref = 0;
8613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8615         return ret_ref;
8616 }
8617
8618 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8619         return CVec_MonitorUpdateIdZ_clone(&owner->b);
8620 }
8621 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
8622         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8623         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
8624         uint64_tArray ret_arr = NULL;
8625         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8626         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8627         for (size_t r = 0; r < ret_var.datalen; r++) {
8628                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
8629                 uint64_t ret_conv_17_ref = 0;
8630                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
8631                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
8632                 ret_arr_ptr[r] = ret_conv_17_ref;
8633         }
8634         
8635         FREE(ret_var.data);
8636         return ret_arr;
8637 }
8638
8639 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
8640         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
8641         for (size_t i = 0; i < ret.datalen; i++) {
8642                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
8643         }
8644         return ret;
8645 }
8646 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
8647         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
8648         for (size_t i = 0; i < ret.datalen; i++) {
8649                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
8650         }
8651         return ret;
8652 }
8653 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
8654         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8655         switch(obj->tag) {
8656                 case LDKSignOrCreationError_SignError: return 0;
8657                 case LDKSignOrCreationError_CreationError: return 1;
8658                 default: abort();
8659         }
8660 }
8661 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
8662         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8663         assert(obj->tag == LDKSignOrCreationError_CreationError);
8664                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
8665         return creation_error_conv;
8666 }
8667 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8668         LDKInvoice ret = *owner->contents.result;
8669         ret.is_owned = false;
8670         return ret;
8671 }
8672 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
8673         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8674         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8675         uint64_t ret_ref = 0;
8676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8678         return ret_ref;
8679 }
8680
8681 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8682 CHECK(!owner->result_ok);
8683         return SignOrCreationError_clone(&*owner->contents.err);
8684 }
8685 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
8686         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8687         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8688         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8689         uint64_t ret_ref = tag_ptr(ret_copy, true);
8690         return ret_ref;
8691 }
8692
8693 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
8694         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8695         switch(obj->tag) {
8696                 case LDKParseError_Bech32Error: return 0;
8697                 case LDKParseError_ParseAmountError: return 1;
8698                 case LDKParseError_MalformedSignature: return 2;
8699                 case LDKParseError_BadPrefix: return 3;
8700                 case LDKParseError_UnknownCurrency: return 4;
8701                 case LDKParseError_UnknownSiPrefix: return 5;
8702                 case LDKParseError_MalformedHRP: return 6;
8703                 case LDKParseError_TooShortDataPart: return 7;
8704                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
8705                 case LDKParseError_DescriptionDecodeError: return 9;
8706                 case LDKParseError_PaddingError: return 10;
8707                 case LDKParseError_IntegerOverflowError: return 11;
8708                 case LDKParseError_InvalidSegWitProgramLength: return 12;
8709                 case LDKParseError_InvalidPubKeyHashLength: return 13;
8710                 case LDKParseError_InvalidScriptHashLength: return 14;
8711                 case LDKParseError_InvalidRecoveryId: return 15;
8712                 case LDKParseError_InvalidSliceLength: return 16;
8713                 case LDKParseError_Skip: return 17;
8714                 default: abort();
8715         }
8716 }
8717 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
8718         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8719         assert(obj->tag == LDKParseError_Bech32Error);
8720                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
8721         return bech32_error_ref;
8722 }
8723 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
8724         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8725         assert(obj->tag == LDKParseError_ParseAmountError);
8726                         /*obj->parse_amount_error*/
8727         return 0;
8728 }
8729 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
8730         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8731         assert(obj->tag == LDKParseError_MalformedSignature);
8732                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
8733         return malformed_signature_conv;
8734 }
8735 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
8736         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8737         assert(obj->tag == LDKParseError_DescriptionDecodeError);
8738                         /*obj->description_decode_error*/
8739         return 0;
8740 }
8741 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
8742         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8743         assert(obj->tag == LDKParseError_InvalidSliceLength);
8744                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
8745                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
8746         return invalid_slice_length_conv;
8747 }
8748 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
8749 CHECK(owner->result_ok);
8750         return SiPrefix_clone(&*owner->contents.result);
8751 }
8752 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
8753         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
8754         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
8755         return ret_conv;
8756 }
8757
8758 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
8759 CHECK(!owner->result_ok);
8760         return ParseError_clone(&*owner->contents.err);
8761 }
8762 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
8763         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
8764         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
8765         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
8766         uint64_t ret_ref = tag_ptr(ret_copy, true);
8767         return ret_ref;
8768 }
8769
8770 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
8771         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
8772         switch(obj->tag) {
8773                 case LDKParseOrSemanticError_ParseError: return 0;
8774                 case LDKParseOrSemanticError_SemanticError: return 1;
8775                 default: abort();
8776         }
8777 }
8778 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
8779         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
8780         assert(obj->tag == LDKParseOrSemanticError_ParseError);
8781                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
8782         return parse_error_ref;
8783 }
8784 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
8785         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
8786         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
8787                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
8788         return semantic_error_conv;
8789 }
8790 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
8791         LDKInvoice ret = *owner->contents.result;
8792         ret.is_owned = false;
8793         return ret;
8794 }
8795 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
8796         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
8797         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
8798         uint64_t ret_ref = 0;
8799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8801         return ret_ref;
8802 }
8803
8804 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
8805 CHECK(!owner->result_ok);
8806         return ParseOrSemanticError_clone(&*owner->contents.err);
8807 }
8808 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
8809         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
8810         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
8811         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
8812         uint64_t ret_ref = tag_ptr(ret_copy, true);
8813         return ret_ref;
8814 }
8815
8816 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
8817         LDKSignedRawInvoice ret = *owner->contents.result;
8818         ret.is_owned = false;
8819         return ret;
8820 }
8821 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
8822         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
8823         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
8824         uint64_t ret_ref = 0;
8825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8827         return ret_ref;
8828 }
8829
8830 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
8831 CHECK(!owner->result_ok);
8832         return ParseError_clone(&*owner->contents.err);
8833 }
8834 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
8835         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
8836         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
8837         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
8838         uint64_t ret_ref = tag_ptr(ret_copy, true);
8839         return ret_ref;
8840 }
8841
8842 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8843         LDKRawInvoice ret = owner->a;
8844         ret.is_owned = false;
8845         return ret;
8846 }
8847 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
8848         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
8849         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
8850         uint64_t ret_ref = 0;
8851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8853         return ret_ref;
8854 }
8855
8856 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8857         return ThirtyTwoBytes_clone(&owner->b);
8858 }
8859 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
8860         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
8861         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8862         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
8863         return ret_arr;
8864 }
8865
8866 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8867         LDKInvoiceSignature ret = owner->c;
8868         ret.is_owned = false;
8869         return ret;
8870 }
8871 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
8872         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
8873         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
8874         uint64_t ret_ref = 0;
8875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8877         return ret_ref;
8878 }
8879
8880 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8881         LDKPayeePubKey ret = *owner->contents.result;
8882         ret.is_owned = false;
8883         return ret;
8884 }
8885 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
8886         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
8887         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
8888         uint64_t ret_ref = 0;
8889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8891         return ret_ref;
8892 }
8893
8894 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8895 CHECK(!owner->result_ok);
8896         return *owner->contents.err;
8897 }
8898 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
8899         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
8900         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
8901         return ret_conv;
8902 }
8903
8904 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
8905         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
8906         for (size_t i = 0; i < ret.datalen; i++) {
8907                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
8908         }
8909         return ret;
8910 }
8911 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8912         LDKPositiveTimestamp ret = *owner->contents.result;
8913         ret.is_owned = false;
8914         return ret;
8915 }
8916 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
8917         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
8918         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
8919         uint64_t ret_ref = 0;
8920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8922         return ret_ref;
8923 }
8924
8925 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8926 CHECK(!owner->result_ok);
8927         return CreationError_clone(&*owner->contents.err);
8928 }
8929 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
8930         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
8931         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
8932         return ret_conv;
8933 }
8934
8935 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8936 CHECK(owner->result_ok);
8937         return *owner->contents.result;
8938 }
8939 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
8940         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
8941         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
8942 }
8943
8944 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8945 CHECK(!owner->result_ok);
8946         return SemanticError_clone(&*owner->contents.err);
8947 }
8948 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
8949         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
8950         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
8951         return ret_conv;
8952 }
8953
8954 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8955         LDKInvoice ret = *owner->contents.result;
8956         ret.is_owned = false;
8957         return ret;
8958 }
8959 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
8960         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
8961         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
8962         uint64_t ret_ref = 0;
8963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8965         return ret_ref;
8966 }
8967
8968 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8969 CHECK(!owner->result_ok);
8970         return SemanticError_clone(&*owner->contents.err);
8971 }
8972 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
8973         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
8974         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
8975         return ret_conv;
8976 }
8977
8978 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8979         LDKDescription ret = *owner->contents.result;
8980         ret.is_owned = false;
8981         return ret;
8982 }
8983 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
8984         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
8985         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
8986         uint64_t ret_ref = 0;
8987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8989         return ret_ref;
8990 }
8991
8992 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8993 CHECK(!owner->result_ok);
8994         return CreationError_clone(&*owner->contents.err);
8995 }
8996 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
8997         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
8998         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
8999         return ret_conv;
9000 }
9001
9002 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
9003         LDKPrivateRoute ret = *owner->contents.result;
9004         ret.is_owned = false;
9005         return ret;
9006 }
9007 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
9008         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
9009         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
9010         uint64_t ret_ref = 0;
9011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9013         return ret_ref;
9014 }
9015
9016 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
9017 CHECK(!owner->result_ok);
9018         return CreationError_clone(&*owner->contents.err);
9019 }
9020 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
9021         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
9022         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
9023         return ret_conv;
9024 }
9025
9026 typedef struct LDKScore_JCalls {
9027         atomic_size_t refcnt;
9028         uint32_t instance_ptr;
9029 } LDKScore_JCalls;
9030 static void LDKScore_JCalls_free(void* this_arg) {
9031         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9032         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9033                 FREE(j_calls);
9034         }
9035 }
9036 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
9037         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9038         int64_t short_channel_id_conv = short_channel_id;
9039         LDKNodeId source_var = *source;
9040         uint64_t source_ref = 0;
9041         source_var = NodeId_clone(&source_var);
9042         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
9043         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
9044         LDKNodeId target_var = *target;
9045         uint64_t target_ref = 0;
9046         target_var = NodeId_clone(&target_var);
9047         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
9048         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
9049         LDKChannelUsage usage_var = usage;
9050         uint64_t usage_ref = 0;
9051         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
9052         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
9053         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 42, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
9054 }
9055 void payment_path_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
9056         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9057         LDKPath path_var = *path;
9058         uint64_t path_ref = 0;
9059         path_var = Path_clone(&path_var);
9060         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9061         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
9062         int64_t short_channel_id_conv = short_channel_id;
9063         js_invoke_function_bbuuuu(j_calls->instance_ptr, 43, path_ref, short_channel_id_conv, 0, 0, 0, 0);
9064 }
9065 void payment_path_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
9066         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9067         LDKPath path_var = *path;
9068         uint64_t path_ref = 0;
9069         path_var = Path_clone(&path_var);
9070         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9071         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
9072         js_invoke_function_buuuuu(j_calls->instance_ptr, 44, path_ref, 0, 0, 0, 0, 0);
9073 }
9074 void probe_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
9075         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9076         LDKPath path_var = *path;
9077         uint64_t path_ref = 0;
9078         path_var = Path_clone(&path_var);
9079         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9080         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
9081         int64_t short_channel_id_conv = short_channel_id;
9082         js_invoke_function_bbuuuu(j_calls->instance_ptr, 45, path_ref, short_channel_id_conv, 0, 0, 0, 0);
9083 }
9084 void probe_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
9085         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9086         LDKPath path_var = *path;
9087         uint64_t path_ref = 0;
9088         path_var = Path_clone(&path_var);
9089         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9090         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
9091         js_invoke_function_buuuuu(j_calls->instance_ptr, 46, path_ref, 0, 0, 0, 0, 0);
9092 }
9093 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
9094         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9095         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, 0, 0, 0, 0, 0, 0);
9096         LDKCVec_u8Z ret_ref;
9097         ret_ref.datalen = ret->arr_len;
9098         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9099         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9100         return ret_ref;
9101 }
9102 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
9103         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
9104         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9105 }
9106 static inline LDKScore LDKScore_init (JSValue o) {
9107         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
9108         atomic_init(&calls->refcnt, 1);
9109         calls->instance_ptr = o;
9110
9111         LDKScore ret = {
9112                 .this_arg = (void*) calls,
9113                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
9114                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
9115                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
9116                 .probe_failed = probe_failed_LDKScore_jcall,
9117                 .probe_successful = probe_successful_LDKScore_jcall,
9118                 .write = write_LDKScore_jcall,
9119                 .free = LDKScore_JCalls_free,
9120         };
9121         return ret;
9122 }
9123 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
9124         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
9125         *res_ptr = LDKScore_init(o);
9126         return tag_ptr(res_ptr, true);
9127 }
9128 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) {
9129         void* this_arg_ptr = untag_ptr(this_arg);
9130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9131         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9132         LDKNodeId source_conv;
9133         source_conv.inner = untag_ptr(source);
9134         source_conv.is_owned = ptr_is_owned(source);
9135         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
9136         source_conv.is_owned = false;
9137         LDKNodeId target_conv;
9138         target_conv.inner = untag_ptr(target);
9139         target_conv.is_owned = ptr_is_owned(target);
9140         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
9141         target_conv.is_owned = false;
9142         LDKChannelUsage usage_conv;
9143         usage_conv.inner = untag_ptr(usage);
9144         usage_conv.is_owned = ptr_is_owned(usage);
9145         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
9146         usage_conv = ChannelUsage_clone(&usage_conv);
9147         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
9148         return ret_conv;
9149 }
9150
9151 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) {
9152         void* this_arg_ptr = untag_ptr(this_arg);
9153         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9154         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9155         LDKPath path_conv;
9156         path_conv.inner = untag_ptr(path);
9157         path_conv.is_owned = ptr_is_owned(path);
9158         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
9159         path_conv.is_owned = false;
9160         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
9161 }
9162
9163 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_t path) {
9164         void* this_arg_ptr = untag_ptr(this_arg);
9165         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9166         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9167         LDKPath path_conv;
9168         path_conv.inner = untag_ptr(path);
9169         path_conv.is_owned = ptr_is_owned(path);
9170         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
9171         path_conv.is_owned = false;
9172         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
9173 }
9174
9175 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
9176         void* this_arg_ptr = untag_ptr(this_arg);
9177         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9178         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9179         LDKPath path_conv;
9180         path_conv.inner = untag_ptr(path);
9181         path_conv.is_owned = ptr_is_owned(path);
9182         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
9183         path_conv.is_owned = false;
9184         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
9185 }
9186
9187 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_t path) {
9188         void* this_arg_ptr = untag_ptr(this_arg);
9189         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9190         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9191         LDKPath path_conv;
9192         path_conv.inner = untag_ptr(path);
9193         path_conv.is_owned = ptr_is_owned(path);
9194         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
9195         path_conv.is_owned = false;
9196         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
9197 }
9198
9199 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
9200         void* this_arg_ptr = untag_ptr(this_arg);
9201         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9202         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9203         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9204         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9205         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9206         CVec_u8Z_free(ret_var);
9207         return ret_arr;
9208 }
9209
9210 typedef struct LDKLockableScore_JCalls {
9211         atomic_size_t refcnt;
9212         uint32_t instance_ptr;
9213 } LDKLockableScore_JCalls;
9214 static void LDKLockableScore_JCalls_free(void* this_arg) {
9215         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9216         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9217                 FREE(j_calls);
9218         }
9219 }
9220 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
9221         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9222         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, 0, 0, 0, 0, 0, 0);
9223         void* ret_ptr = untag_ptr(ret);
9224         CHECK_ACCESS(ret_ptr);
9225         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
9226         if (ret_conv.free == LDKScore_JCalls_free) {
9227                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9228                 LDKScore_JCalls_cloned(&ret_conv);
9229         }// WARNING: we may need a move here but no clone is available for LDKScore
9230         
9231         return ret_conv;
9232 }
9233 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
9234         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
9235         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9236 }
9237 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
9238         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
9239         atomic_init(&calls->refcnt, 1);
9240         calls->instance_ptr = o;
9241
9242         LDKLockableScore ret = {
9243                 .this_arg = (void*) calls,
9244                 .lock = lock_LDKLockableScore_jcall,
9245                 .free = LDKLockableScore_JCalls_free,
9246         };
9247         return ret;
9248 }
9249 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
9250         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
9251         *res_ptr = LDKLockableScore_init(o);
9252         return tag_ptr(res_ptr, true);
9253 }
9254 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
9255         void* this_arg_ptr = untag_ptr(this_arg);
9256         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9257         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
9258         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
9259         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
9260         return tag_ptr(ret_ret, true);
9261 }
9262
9263 typedef struct LDKWriteableScore_JCalls {
9264         atomic_size_t refcnt;
9265         uint32_t instance_ptr;
9266         LDKLockableScore_JCalls* LockableScore;
9267 } LDKWriteableScore_JCalls;
9268 static void LDKWriteableScore_JCalls_free(void* this_arg) {
9269         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
9270         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9271                 FREE(j_calls);
9272         }
9273 }
9274 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
9275         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
9276         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
9277         LDKCVec_u8Z ret_ref;
9278         ret_ref.datalen = ret->arr_len;
9279         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9280         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9281         return ret_ref;
9282 }
9283 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
9284         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
9285         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9286         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
9287 }
9288 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
9289         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
9290         atomic_init(&calls->refcnt, 1);
9291         calls->instance_ptr = o;
9292
9293         LDKWriteableScore ret = {
9294                 .this_arg = (void*) calls,
9295                 .write = write_LDKWriteableScore_jcall,
9296                 .free = LDKWriteableScore_JCalls_free,
9297                 .LockableScore = LDKLockableScore_init(LockableScore),
9298         };
9299         calls->LockableScore = ret.LockableScore.this_arg;
9300         return ret;
9301 }
9302 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
9303         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
9304         *res_ptr = LDKWriteableScore_init(o, LockableScore);
9305         return tag_ptr(res_ptr, true);
9306 }
9307 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
9308         void* this_arg_ptr = untag_ptr(this_arg);
9309         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9310         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
9311         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9312         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9313         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9314         CVec_u8Z_free(ret_var);
9315         return ret_arr;
9316 }
9317
9318 typedef struct LDKPersister_JCalls {
9319         atomic_size_t refcnt;
9320         uint32_t instance_ptr;
9321 } LDKPersister_JCalls;
9322 static void LDKPersister_JCalls_free(void* this_arg) {
9323         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9324         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9325                 FREE(j_calls);
9326         }
9327 }
9328 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
9329         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9330         LDKChannelManager channel_manager_var = *channel_manager;
9331         uint64_t channel_manager_ref = 0;
9332         // WARNING: we may need a move here but no clone is available for LDKChannelManager
9333         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
9334         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
9335         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 50, channel_manager_ref, 0, 0, 0, 0, 0);
9336         void* ret_ptr = untag_ptr(ret);
9337         CHECK_ACCESS(ret_ptr);
9338         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9339         FREE(untag_ptr(ret));
9340         return ret_conv;
9341 }
9342 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
9343         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9344         LDKNetworkGraph network_graph_var = *network_graph;
9345         uint64_t network_graph_ref = 0;
9346         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
9347         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
9348         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
9349         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 51, network_graph_ref, 0, 0, 0, 0, 0);
9350         void* ret_ptr = untag_ptr(ret);
9351         CHECK_ACCESS(ret_ptr);
9352         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9353         FREE(untag_ptr(ret));
9354         return ret_conv;
9355 }
9356 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
9357         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9358         // WARNING: This object doesn't live past this scope, needs clone!
9359         uint64_t ret_scorer = tag_ptr(scorer, false);
9360         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, ret_scorer, 0, 0, 0, 0, 0);
9361         void* ret_ptr = untag_ptr(ret);
9362         CHECK_ACCESS(ret_ptr);
9363         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9364         FREE(untag_ptr(ret));
9365         return ret_conv;
9366 }
9367 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
9368         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
9369         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9370 }
9371 static inline LDKPersister LDKPersister_init (JSValue o) {
9372         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
9373         atomic_init(&calls->refcnt, 1);
9374         calls->instance_ptr = o;
9375
9376         LDKPersister ret = {
9377                 .this_arg = (void*) calls,
9378                 .persist_manager = persist_manager_LDKPersister_jcall,
9379                 .persist_graph = persist_graph_LDKPersister_jcall,
9380                 .persist_scorer = persist_scorer_LDKPersister_jcall,
9381                 .free = LDKPersister_JCalls_free,
9382         };
9383         return ret;
9384 }
9385 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
9386         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
9387         *res_ptr = LDKPersister_init(o);
9388         return tag_ptr(res_ptr, true);
9389 }
9390 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
9391         void* this_arg_ptr = untag_ptr(this_arg);
9392         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9393         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9394         LDKChannelManager channel_manager_conv;
9395         channel_manager_conv.inner = untag_ptr(channel_manager);
9396         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
9397         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
9398         channel_manager_conv.is_owned = false;
9399         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9400         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
9401         return tag_ptr(ret_conv, true);
9402 }
9403
9404 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
9405         void* this_arg_ptr = untag_ptr(this_arg);
9406         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9407         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9408         LDKNetworkGraph network_graph_conv;
9409         network_graph_conv.inner = untag_ptr(network_graph);
9410         network_graph_conv.is_owned = ptr_is_owned(network_graph);
9411         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
9412         network_graph_conv.is_owned = false;
9413         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9414         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
9415         return tag_ptr(ret_conv, true);
9416 }
9417
9418 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
9419         void* this_arg_ptr = untag_ptr(this_arg);
9420         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9421         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9422         void* scorer_ptr = untag_ptr(scorer);
9423         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
9424         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
9425         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9426         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
9427         return tag_ptr(ret_conv, true);
9428 }
9429
9430 typedef struct LDKFutureCallback_JCalls {
9431         atomic_size_t refcnt;
9432         uint32_t instance_ptr;
9433 } LDKFutureCallback_JCalls;
9434 static void LDKFutureCallback_JCalls_free(void* this_arg) {
9435         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
9436         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9437                 FREE(j_calls);
9438         }
9439 }
9440 void call_LDKFutureCallback_jcall(const void* this_arg) {
9441         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
9442         js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, 0, 0, 0, 0, 0, 0);
9443 }
9444 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
9445         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
9446         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9447 }
9448 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
9449         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
9450         atomic_init(&calls->refcnt, 1);
9451         calls->instance_ptr = o;
9452
9453         LDKFutureCallback ret = {
9454                 .this_arg = (void*) calls,
9455                 .call = call_LDKFutureCallback_jcall,
9456                 .free = LDKFutureCallback_JCalls_free,
9457         };
9458         return ret;
9459 }
9460 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
9461         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
9462         *res_ptr = LDKFutureCallback_init(o);
9463         return tag_ptr(res_ptr, true);
9464 }
9465 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
9466         void* this_arg_ptr = untag_ptr(this_arg);
9467         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9468         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
9469         (this_arg_conv->call)(this_arg_conv->this_arg);
9470 }
9471
9472 typedef struct LDKListen_JCalls {
9473         atomic_size_t refcnt;
9474         uint32_t instance_ptr;
9475 } LDKListen_JCalls;
9476 static void LDKListen_JCalls_free(void* this_arg) {
9477         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9478         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9479                 FREE(j_calls);
9480         }
9481 }
9482 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9483         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9484         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9485         memcpy(header_arr->elems, *header, 80);
9486         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9487         uint64_tArray txdata_arr = NULL;
9488         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9489         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9490         for (size_t c = 0; c < txdata_var.datalen; c++) {
9491                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9492                 *txdata_conv_28_conv = txdata_var.data[c];
9493                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9494         }
9495         
9496         FREE(txdata_var.data);
9497         int32_t height_conv = height;
9498         js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9499 }
9500 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
9501         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9502         LDKu8slice block_var = block;
9503         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
9504         memcpy(block_arr->elems, block_var.data, block_var.datalen);
9505         int32_t height_conv = height;
9506         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
9507 }
9508 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9509         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9510         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9511         memcpy(header_arr->elems, *header, 80);
9512         int32_t height_conv = height;
9513         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9514 }
9515 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
9516         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
9517         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9518 }
9519 static inline LDKListen LDKListen_init (JSValue o) {
9520         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
9521         atomic_init(&calls->refcnt, 1);
9522         calls->instance_ptr = o;
9523
9524         LDKListen ret = {
9525                 .this_arg = (void*) calls,
9526                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
9527                 .block_connected = block_connected_LDKListen_jcall,
9528                 .block_disconnected = block_disconnected_LDKListen_jcall,
9529                 .free = LDKListen_JCalls_free,
9530         };
9531         return ret;
9532 }
9533 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
9534         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
9535         *res_ptr = LDKListen_init(o);
9536         return tag_ptr(res_ptr, true);
9537 }
9538 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) {
9539         void* this_arg_ptr = untag_ptr(this_arg);
9540         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9541         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9542         uint8_t header_arr[80];
9543         CHECK(header->arr_len == 80);
9544         memcpy(header_arr, header->elems, 80); FREE(header);
9545         uint8_t (*header_ref)[80] = &header_arr;
9546         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9547         txdata_constr.datalen = txdata->arr_len;
9548         if (txdata_constr.datalen > 0)
9549                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9550         else
9551                 txdata_constr.data = NULL;
9552         uint64_t* txdata_vals = txdata->elems;
9553         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9554                 uint64_t txdata_conv_28 = txdata_vals[c];
9555                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9556                 CHECK_ACCESS(txdata_conv_28_ptr);
9557                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9558                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9559                 txdata_constr.data[c] = txdata_conv_28_conv;
9560         }
9561         FREE(txdata);
9562         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9563 }
9564
9565 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
9566         void* this_arg_ptr = untag_ptr(this_arg);
9567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9568         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9569         LDKu8slice block_ref;
9570         block_ref.datalen = block->arr_len;
9571         block_ref.data = block->elems;
9572         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9573         FREE(block);
9574 }
9575
9576 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
9577         void* this_arg_ptr = untag_ptr(this_arg);
9578         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9579         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9580         uint8_t header_arr[80];
9581         CHECK(header->arr_len == 80);
9582         memcpy(header_arr, header->elems, 80); FREE(header);
9583         uint8_t (*header_ref)[80] = &header_arr;
9584         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9585 }
9586
9587 typedef struct LDKConfirm_JCalls {
9588         atomic_size_t refcnt;
9589         uint32_t instance_ptr;
9590 } LDKConfirm_JCalls;
9591 static void LDKConfirm_JCalls_free(void* this_arg) {
9592         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9593         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9594                 FREE(j_calls);
9595         }
9596 }
9597 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9598         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9599         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9600         memcpy(header_arr->elems, *header, 80);
9601         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9602         uint64_tArray txdata_arr = NULL;
9603         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9604         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9605         for (size_t c = 0; c < txdata_var.datalen; c++) {
9606                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9607                 *txdata_conv_28_conv = txdata_var.data[c];
9608                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9609         }
9610         
9611         FREE(txdata_var.data);
9612         int32_t height_conv = height;
9613         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9614 }
9615 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
9616         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9617         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
9618         memcpy(txid_arr->elems, *txid, 32);
9619         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
9620 }
9621 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9622         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9623         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9624         memcpy(header_arr->elems, *header, 80);
9625         int32_t height_conv = height;
9626         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9627 }
9628 LDKCVec_C2Tuple_TxidBlockHashZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
9629         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9630         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, 0, 0, 0, 0, 0, 0);
9631         LDKCVec_C2Tuple_TxidBlockHashZZ ret_constr;
9632         ret_constr.datalen = ret->arr_len;
9633         if (ret_constr.datalen > 0)
9634                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
9635         else
9636                 ret_constr.data = NULL;
9637         uint64_t* ret_vals = ret->elems;
9638         for (size_t z = 0; z < ret_constr.datalen; z++) {
9639                 uint64_t ret_conv_25 = ret_vals[z];
9640                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
9641                 CHECK_ACCESS(ret_conv_25_ptr);
9642                 LDKC2Tuple_TxidBlockHashZ ret_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(ret_conv_25_ptr);
9643                 FREE(untag_ptr(ret_conv_25));
9644                 ret_constr.data[z] = ret_conv_25_conv;
9645         }
9646         FREE(ret);
9647         return ret_constr;
9648 }
9649 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
9650         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
9651         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9652 }
9653 static inline LDKConfirm LDKConfirm_init (JSValue o) {
9654         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
9655         atomic_init(&calls->refcnt, 1);
9656         calls->instance_ptr = o;
9657
9658         LDKConfirm ret = {
9659                 .this_arg = (void*) calls,
9660                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
9661                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
9662                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
9663                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
9664                 .free = LDKConfirm_JCalls_free,
9665         };
9666         return ret;
9667 }
9668 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
9669         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
9670         *res_ptr = LDKConfirm_init(o);
9671         return tag_ptr(res_ptr, true);
9672 }
9673 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) {
9674         void* this_arg_ptr = untag_ptr(this_arg);
9675         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9676         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9677         uint8_t header_arr[80];
9678         CHECK(header->arr_len == 80);
9679         memcpy(header_arr, header->elems, 80); FREE(header);
9680         uint8_t (*header_ref)[80] = &header_arr;
9681         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9682         txdata_constr.datalen = txdata->arr_len;
9683         if (txdata_constr.datalen > 0)
9684                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9685         else
9686                 txdata_constr.data = NULL;
9687         uint64_t* txdata_vals = txdata->elems;
9688         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9689                 uint64_t txdata_conv_28 = txdata_vals[c];
9690                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9691                 CHECK_ACCESS(txdata_conv_28_ptr);
9692                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9693                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9694                 txdata_constr.data[c] = txdata_conv_28_conv;
9695         }
9696         FREE(txdata);
9697         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9698 }
9699
9700 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
9701         void* this_arg_ptr = untag_ptr(this_arg);
9702         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9703         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9704         uint8_t txid_arr[32];
9705         CHECK(txid->arr_len == 32);
9706         memcpy(txid_arr, txid->elems, 32); FREE(txid);
9707         uint8_t (*txid_ref)[32] = &txid_arr;
9708         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
9709 }
9710
9711 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
9712         void* this_arg_ptr = untag_ptr(this_arg);
9713         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9714         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9715         uint8_t header_arr[80];
9716         CHECK(header->arr_len == 80);
9717         memcpy(header_arr, header->elems, 80); FREE(header);
9718         uint8_t (*header_ref)[80] = &header_arr;
9719         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
9720 }
9721
9722 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
9723         void* this_arg_ptr = untag_ptr(this_arg);
9724         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9725         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9726         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
9727         uint64_tArray ret_arr = NULL;
9728         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9729         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9730         for (size_t z = 0; z < ret_var.datalen; z++) {
9731                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
9732                 *ret_conv_25_conv = ret_var.data[z];
9733                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
9734         }
9735         
9736         FREE(ret_var.data);
9737         return ret_arr;
9738 }
9739
9740 typedef struct LDKPersist_JCalls {
9741         atomic_size_t refcnt;
9742         uint32_t instance_ptr;
9743 } LDKPersist_JCalls;
9744 static void LDKPersist_JCalls_free(void* this_arg) {
9745         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9746         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9747                 FREE(j_calls);
9748         }
9749 }
9750 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9751         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9752         LDKOutPoint channel_id_var = channel_id;
9753         uint64_t channel_id_ref = 0;
9754         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9755         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9756         LDKChannelMonitor data_var = *data;
9757         uint64_t data_ref = 0;
9758         data_var = ChannelMonitor_clone(&data_var);
9759         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9760         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9761         LDKMonitorUpdateId update_id_var = update_id;
9762         uint64_t update_id_ref = 0;
9763         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9764         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9765         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 61, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
9766         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9767         return ret_conv;
9768 }
9769 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9770         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9771         LDKOutPoint channel_id_var = channel_id;
9772         uint64_t channel_id_ref = 0;
9773         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9774         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9775         LDKChannelMonitorUpdate update_var = update;
9776         uint64_t update_ref = 0;
9777         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9778         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
9779         LDKChannelMonitor data_var = *data;
9780         uint64_t data_ref = 0;
9781         data_var = ChannelMonitor_clone(&data_var);
9782         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9783         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9784         LDKMonitorUpdateId update_id_var = update_id;
9785         uint64_t update_id_ref = 0;
9786         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9787         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9788         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 62, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
9789         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9790         return ret_conv;
9791 }
9792 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9793         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9794         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9795 }
9796 static inline LDKPersist LDKPersist_init (JSValue o) {
9797         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9798         atomic_init(&calls->refcnt, 1);
9799         calls->instance_ptr = o;
9800
9801         LDKPersist ret = {
9802                 .this_arg = (void*) calls,
9803                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9804                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9805                 .free = LDKPersist_JCalls_free,
9806         };
9807         return ret;
9808 }
9809 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9810         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9811         *res_ptr = LDKPersist_init(o);
9812         return tag_ptr(res_ptr, true);
9813 }
9814 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) {
9815         void* this_arg_ptr = untag_ptr(this_arg);
9816         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9817         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9818         LDKOutPoint channel_id_conv;
9819         channel_id_conv.inner = untag_ptr(channel_id);
9820         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9821         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9822         channel_id_conv = OutPoint_clone(&channel_id_conv);
9823         LDKChannelMonitor data_conv;
9824         data_conv.inner = untag_ptr(data);
9825         data_conv.is_owned = ptr_is_owned(data);
9826         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9827         data_conv.is_owned = false;
9828         LDKMonitorUpdateId update_id_conv;
9829         update_id_conv.inner = untag_ptr(update_id);
9830         update_id_conv.is_owned = ptr_is_owned(update_id);
9831         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9832         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9833         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));
9834         return ret_conv;
9835 }
9836
9837 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) {
9838         void* this_arg_ptr = untag_ptr(this_arg);
9839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9840         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9841         LDKOutPoint channel_id_conv;
9842         channel_id_conv.inner = untag_ptr(channel_id);
9843         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9844         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9845         channel_id_conv = OutPoint_clone(&channel_id_conv);
9846         LDKChannelMonitorUpdate update_conv;
9847         update_conv.inner = untag_ptr(update);
9848         update_conv.is_owned = ptr_is_owned(update);
9849         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9850         update_conv = ChannelMonitorUpdate_clone(&update_conv);
9851         LDKChannelMonitor data_conv;
9852         data_conv.inner = untag_ptr(data);
9853         data_conv.is_owned = ptr_is_owned(data);
9854         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9855         data_conv.is_owned = false;
9856         LDKMonitorUpdateId update_id_conv;
9857         update_id_conv.inner = untag_ptr(update_id);
9858         update_id_conv.is_owned = ptr_is_owned(update_id);
9859         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9860         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9861         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));
9862         return ret_conv;
9863 }
9864
9865 typedef struct LDKEventHandler_JCalls {
9866         atomic_size_t refcnt;
9867         uint32_t instance_ptr;
9868 } LDKEventHandler_JCalls;
9869 static void LDKEventHandler_JCalls_free(void* this_arg) {
9870         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9871         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9872                 FREE(j_calls);
9873         }
9874 }
9875 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
9876         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9877         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9878         *event_copy = event;
9879         uint64_t event_ref = tag_ptr(event_copy, true);
9880         js_invoke_function_buuuuu(j_calls->instance_ptr, 63, event_ref, 0, 0, 0, 0, 0);
9881 }
9882 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
9883         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
9884         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9885 }
9886 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
9887         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
9888         atomic_init(&calls->refcnt, 1);
9889         calls->instance_ptr = o;
9890
9891         LDKEventHandler ret = {
9892                 .this_arg = (void*) calls,
9893                 .handle_event = handle_event_LDKEventHandler_jcall,
9894                 .free = LDKEventHandler_JCalls_free,
9895         };
9896         return ret;
9897 }
9898 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
9899         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9900         *res_ptr = LDKEventHandler_init(o);
9901         return tag_ptr(res_ptr, true);
9902 }
9903 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
9904         void* this_arg_ptr = untag_ptr(this_arg);
9905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9906         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
9907         void* event_ptr = untag_ptr(event);
9908         CHECK_ACCESS(event_ptr);
9909         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
9910         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
9911         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
9912 }
9913
9914 typedef struct LDKEventsProvider_JCalls {
9915         atomic_size_t refcnt;
9916         uint32_t instance_ptr;
9917 } LDKEventsProvider_JCalls;
9918 static void LDKEventsProvider_JCalls_free(void* this_arg) {
9919         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9920         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9921                 FREE(j_calls);
9922         }
9923 }
9924 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
9925         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9926         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9927         *handler_ret = handler;
9928         js_invoke_function_buuuuu(j_calls->instance_ptr, 64, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
9929 }
9930 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
9931         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
9932         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9933 }
9934 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
9935         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
9936         atomic_init(&calls->refcnt, 1);
9937         calls->instance_ptr = o;
9938
9939         LDKEventsProvider ret = {
9940                 .this_arg = (void*) calls,
9941                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
9942                 .free = LDKEventsProvider_JCalls_free,
9943         };
9944         return ret;
9945 }
9946 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
9947         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9948         *res_ptr = LDKEventsProvider_init(o);
9949         return tag_ptr(res_ptr, true);
9950 }
9951 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
9952         void* this_arg_ptr = untag_ptr(this_arg);
9953         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9954         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
9955         void* handler_ptr = untag_ptr(handler);
9956         CHECK_ACCESS(handler_ptr);
9957         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
9958         if (handler_conv.free == LDKEventHandler_JCalls_free) {
9959                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9960                 LDKEventHandler_JCalls_cloned(&handler_conv);
9961         }
9962         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
9963 }
9964
9965 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
9966         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
9967         switch(obj->tag) {
9968                 case LDKRetry_Attempts: return 0;
9969                 default: abort();
9970         }
9971 }
9972 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
9973         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
9974         assert(obj->tag == LDKRetry_Attempts);
9975                         uint32_t attempts_conv = obj->attempts;
9976         return attempts_conv;
9977 }
9978 typedef struct LDKMessageSendEventsProvider_JCalls {
9979         atomic_size_t refcnt;
9980         uint32_t instance_ptr;
9981 } LDKMessageSendEventsProvider_JCalls;
9982 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9983         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9984         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9985                 FREE(j_calls);
9986         }
9987 }
9988 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9989         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9990         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 65, 0, 0, 0, 0, 0, 0);
9991         LDKCVec_MessageSendEventZ ret_constr;
9992         ret_constr.datalen = ret->arr_len;
9993         if (ret_constr.datalen > 0)
9994                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9995         else
9996                 ret_constr.data = NULL;
9997         uint64_t* ret_vals = ret->elems;
9998         for (size_t s = 0; s < ret_constr.datalen; s++) {
9999                 uint64_t ret_conv_18 = ret_vals[s];
10000                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
10001                 CHECK_ACCESS(ret_conv_18_ptr);
10002                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
10003                 FREE(untag_ptr(ret_conv_18));
10004                 ret_constr.data[s] = ret_conv_18_conv;
10005         }
10006         FREE(ret);
10007         return ret_constr;
10008 }
10009 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
10010         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
10011         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10012 }
10013 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
10014         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
10015         atomic_init(&calls->refcnt, 1);
10016         calls->instance_ptr = o;
10017
10018         LDKMessageSendEventsProvider ret = {
10019                 .this_arg = (void*) calls,
10020                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
10021                 .free = LDKMessageSendEventsProvider_JCalls_free,
10022         };
10023         return ret;
10024 }
10025 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
10026         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10027         *res_ptr = LDKMessageSendEventsProvider_init(o);
10028         return tag_ptr(res_ptr, true);
10029 }
10030 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) {
10031         void* this_arg_ptr = untag_ptr(this_arg);
10032         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10033         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
10034         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
10035         uint64_tArray ret_arr = NULL;
10036         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10037         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10038         for (size_t s = 0; s < ret_var.datalen; s++) {
10039                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10040                 *ret_conv_18_copy = ret_var.data[s];
10041                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
10042                 ret_arr_ptr[s] = ret_conv_18_ref;
10043         }
10044         
10045         FREE(ret_var.data);
10046         return ret_arr;
10047 }
10048
10049 typedef struct LDKChannelMessageHandler_JCalls {
10050         atomic_size_t refcnt;
10051         uint32_t instance_ptr;
10052         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10053 } LDKChannelMessageHandler_JCalls;
10054 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
10055         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10056         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10057                 FREE(j_calls);
10058         }
10059 }
10060 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
10061         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10062         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10063         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10064         LDKOpenChannel msg_var = *msg;
10065         uint64_t msg_ref = 0;
10066         msg_var = OpenChannel_clone(&msg_var);
10067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10068         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10069         js_invoke_function_ubuuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10070 }
10071 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
10072         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10073         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10074         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10075         LDKAcceptChannel msg_var = *msg;
10076         uint64_t msg_ref = 0;
10077         msg_var = AcceptChannel_clone(&msg_var);
10078         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10079         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10080         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10081 }
10082 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
10083         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10084         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10085         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10086         LDKFundingCreated msg_var = *msg;
10087         uint64_t msg_ref = 0;
10088         msg_var = FundingCreated_clone(&msg_var);
10089         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10090         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10091         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10092 }
10093 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
10094         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10095         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10096         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10097         LDKFundingSigned msg_var = *msg;
10098         uint64_t msg_ref = 0;
10099         msg_var = FundingSigned_clone(&msg_var);
10100         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10101         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10102         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10103 }
10104 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
10105         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10106         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10107         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10108         LDKChannelReady msg_var = *msg;
10109         uint64_t msg_ref = 0;
10110         msg_var = ChannelReady_clone(&msg_var);
10111         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10112         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10113         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10114 }
10115 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
10116         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10117         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10118         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10119         LDKShutdown msg_var = *msg;
10120         uint64_t msg_ref = 0;
10121         msg_var = Shutdown_clone(&msg_var);
10122         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10123         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10124         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10125 }
10126 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
10127         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10128         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10129         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10130         LDKClosingSigned msg_var = *msg;
10131         uint64_t msg_ref = 0;
10132         msg_var = ClosingSigned_clone(&msg_var);
10133         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10134         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10135         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10136 }
10137 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
10138         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10139         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10140         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10141         LDKUpdateAddHTLC msg_var = *msg;
10142         uint64_t msg_ref = 0;
10143         msg_var = UpdateAddHTLC_clone(&msg_var);
10144         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10145         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10146         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10147 }
10148 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
10149         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10150         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10151         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10152         LDKUpdateFulfillHTLC msg_var = *msg;
10153         uint64_t msg_ref = 0;
10154         msg_var = UpdateFulfillHTLC_clone(&msg_var);
10155         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10156         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10157         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10158 }
10159 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
10160         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10161         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10162         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10163         LDKUpdateFailHTLC msg_var = *msg;
10164         uint64_t msg_ref = 0;
10165         msg_var = UpdateFailHTLC_clone(&msg_var);
10166         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10167         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10168         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10169 }
10170 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
10171         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10172         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10173         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10174         LDKUpdateFailMalformedHTLC msg_var = *msg;
10175         uint64_t msg_ref = 0;
10176         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
10177         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10178         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10179         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10180 }
10181 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
10182         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10183         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10184         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10185         LDKCommitmentSigned msg_var = *msg;
10186         uint64_t msg_ref = 0;
10187         msg_var = CommitmentSigned_clone(&msg_var);
10188         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10189         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10190         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10191 }
10192 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
10193         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10194         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10195         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10196         LDKRevokeAndACK msg_var = *msg;
10197         uint64_t msg_ref = 0;
10198         msg_var = RevokeAndACK_clone(&msg_var);
10199         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10200         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10201         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10202 }
10203 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
10204         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10205         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10206         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10207         LDKUpdateFee msg_var = *msg;
10208         uint64_t msg_ref = 0;
10209         msg_var = UpdateFee_clone(&msg_var);
10210         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10211         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10212         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10213 }
10214 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
10215         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10216         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10217         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10218         LDKAnnouncementSignatures msg_var = *msg;
10219         uint64_t msg_ref = 0;
10220         msg_var = AnnouncementSignatures_clone(&msg_var);
10221         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10222         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10223         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10224 }
10225 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10226         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10227         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10228         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10229         js_invoke_function_uuuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10230 }
10231 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
10232         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10233         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10234         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10235         LDKInit msg_var = *msg;
10236         uint64_t msg_ref = 0;
10237         msg_var = Init_clone(&msg_var);
10238         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10239         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10240         jboolean inbound_conv = inbound;
10241         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);
10242         void* ret_ptr = untag_ptr(ret);
10243         CHECK_ACCESS(ret_ptr);
10244         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10245         FREE(untag_ptr(ret));
10246         return ret_conv;
10247 }
10248 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
10249         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10250         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10251         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10252         LDKChannelReestablish msg_var = *msg;
10253         uint64_t msg_ref = 0;
10254         msg_var = ChannelReestablish_clone(&msg_var);
10255         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10256         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10257         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10258 }
10259 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
10260         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10261         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10262         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10263         LDKChannelUpdate msg_var = *msg;
10264         uint64_t msg_ref = 0;
10265         msg_var = ChannelUpdate_clone(&msg_var);
10266         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10267         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10268         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10269 }
10270 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
10271         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10272         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10273         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10274         LDKErrorMessage msg_var = *msg;
10275         uint64_t msg_ref = 0;
10276         msg_var = ErrorMessage_clone(&msg_var);
10277         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10278         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10279         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10280 }
10281 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
10282         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10283         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 86, 0, 0, 0, 0, 0, 0);
10284         LDKNodeFeatures ret_conv;
10285         ret_conv.inner = untag_ptr(ret);
10286         ret_conv.is_owned = ptr_is_owned(ret);
10287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10288         return ret_conv;
10289 }
10290 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10291         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10292         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10293         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10294         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10295         LDKInitFeatures ret_conv;
10296         ret_conv.inner = untag_ptr(ret);
10297         ret_conv.is_owned = ptr_is_owned(ret);
10298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10299         return ret_conv;
10300 }
10301 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
10302         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
10303         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10304         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10305 }
10306 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10307         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
10308         atomic_init(&calls->refcnt, 1);
10309         calls->instance_ptr = o;
10310
10311         LDKChannelMessageHandler ret = {
10312                 .this_arg = (void*) calls,
10313                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
10314                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
10315                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
10316                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
10317                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
10318                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
10319                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
10320                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
10321                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
10322                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
10323                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
10324                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
10325                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
10326                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
10327                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
10328                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
10329                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
10330                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
10331                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
10332                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
10333                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
10334                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
10335                 .free = LDKChannelMessageHandler_JCalls_free,
10336                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10337         };
10338         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10339         return ret;
10340 }
10341 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10342         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
10343         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
10344         return tag_ptr(res_ptr, true);
10345 }
10346 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) {
10347         void* this_arg_ptr = untag_ptr(this_arg);
10348         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10349         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10350         LDKPublicKey their_node_id_ref;
10351         CHECK(their_node_id->arr_len == 33);
10352         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10353         LDKOpenChannel msg_conv;
10354         msg_conv.inner = untag_ptr(msg);
10355         msg_conv.is_owned = ptr_is_owned(msg);
10356         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10357         msg_conv.is_owned = false;
10358         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10359 }
10360
10361 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) {
10362         void* this_arg_ptr = untag_ptr(this_arg);
10363         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10364         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10365         LDKPublicKey their_node_id_ref;
10366         CHECK(their_node_id->arr_len == 33);
10367         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10368         LDKAcceptChannel msg_conv;
10369         msg_conv.inner = untag_ptr(msg);
10370         msg_conv.is_owned = ptr_is_owned(msg);
10371         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10372         msg_conv.is_owned = false;
10373         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10374 }
10375
10376 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) {
10377         void* this_arg_ptr = untag_ptr(this_arg);
10378         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10379         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10380         LDKPublicKey their_node_id_ref;
10381         CHECK(their_node_id->arr_len == 33);
10382         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10383         LDKFundingCreated msg_conv;
10384         msg_conv.inner = untag_ptr(msg);
10385         msg_conv.is_owned = ptr_is_owned(msg);
10386         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10387         msg_conv.is_owned = false;
10388         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10389 }
10390
10391 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) {
10392         void* this_arg_ptr = untag_ptr(this_arg);
10393         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10394         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10395         LDKPublicKey their_node_id_ref;
10396         CHECK(their_node_id->arr_len == 33);
10397         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10398         LDKFundingSigned msg_conv;
10399         msg_conv.inner = untag_ptr(msg);
10400         msg_conv.is_owned = ptr_is_owned(msg);
10401         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10402         msg_conv.is_owned = false;
10403         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10404 }
10405
10406 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) {
10407         void* this_arg_ptr = untag_ptr(this_arg);
10408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10409         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10410         LDKPublicKey their_node_id_ref;
10411         CHECK(their_node_id->arr_len == 33);
10412         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10413         LDKChannelReady msg_conv;
10414         msg_conv.inner = untag_ptr(msg);
10415         msg_conv.is_owned = ptr_is_owned(msg);
10416         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10417         msg_conv.is_owned = false;
10418         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10419 }
10420
10421 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10422         void* this_arg_ptr = untag_ptr(this_arg);
10423         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10424         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10425         LDKPublicKey their_node_id_ref;
10426         CHECK(their_node_id->arr_len == 33);
10427         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10428         LDKShutdown msg_conv;
10429         msg_conv.inner = untag_ptr(msg);
10430         msg_conv.is_owned = ptr_is_owned(msg);
10431         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10432         msg_conv.is_owned = false;
10433         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10434 }
10435
10436 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) {
10437         void* this_arg_ptr = untag_ptr(this_arg);
10438         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10439         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10440         LDKPublicKey their_node_id_ref;
10441         CHECK(their_node_id->arr_len == 33);
10442         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10443         LDKClosingSigned msg_conv;
10444         msg_conv.inner = untag_ptr(msg);
10445         msg_conv.is_owned = ptr_is_owned(msg);
10446         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10447         msg_conv.is_owned = false;
10448         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10449 }
10450
10451 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) {
10452         void* this_arg_ptr = untag_ptr(this_arg);
10453         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10454         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10455         LDKPublicKey their_node_id_ref;
10456         CHECK(their_node_id->arr_len == 33);
10457         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10458         LDKUpdateAddHTLC msg_conv;
10459         msg_conv.inner = untag_ptr(msg);
10460         msg_conv.is_owned = ptr_is_owned(msg);
10461         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10462         msg_conv.is_owned = false;
10463         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10464 }
10465
10466 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) {
10467         void* this_arg_ptr = untag_ptr(this_arg);
10468         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10469         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10470         LDKPublicKey their_node_id_ref;
10471         CHECK(their_node_id->arr_len == 33);
10472         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10473         LDKUpdateFulfillHTLC msg_conv;
10474         msg_conv.inner = untag_ptr(msg);
10475         msg_conv.is_owned = ptr_is_owned(msg);
10476         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10477         msg_conv.is_owned = false;
10478         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10479 }
10480
10481 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) {
10482         void* this_arg_ptr = untag_ptr(this_arg);
10483         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10484         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10485         LDKPublicKey their_node_id_ref;
10486         CHECK(their_node_id->arr_len == 33);
10487         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10488         LDKUpdateFailHTLC msg_conv;
10489         msg_conv.inner = untag_ptr(msg);
10490         msg_conv.is_owned = ptr_is_owned(msg);
10491         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10492         msg_conv.is_owned = false;
10493         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10494 }
10495
10496 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) {
10497         void* this_arg_ptr = untag_ptr(this_arg);
10498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10499         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10500         LDKPublicKey their_node_id_ref;
10501         CHECK(their_node_id->arr_len == 33);
10502         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10503         LDKUpdateFailMalformedHTLC msg_conv;
10504         msg_conv.inner = untag_ptr(msg);
10505         msg_conv.is_owned = ptr_is_owned(msg);
10506         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10507         msg_conv.is_owned = false;
10508         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10509 }
10510
10511 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) {
10512         void* this_arg_ptr = untag_ptr(this_arg);
10513         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10514         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10515         LDKPublicKey their_node_id_ref;
10516         CHECK(their_node_id->arr_len == 33);
10517         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10518         LDKCommitmentSigned msg_conv;
10519         msg_conv.inner = untag_ptr(msg);
10520         msg_conv.is_owned = ptr_is_owned(msg);
10521         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10522         msg_conv.is_owned = false;
10523         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10524 }
10525
10526 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) {
10527         void* this_arg_ptr = untag_ptr(this_arg);
10528         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10529         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10530         LDKPublicKey their_node_id_ref;
10531         CHECK(their_node_id->arr_len == 33);
10532         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10533         LDKRevokeAndACK msg_conv;
10534         msg_conv.inner = untag_ptr(msg);
10535         msg_conv.is_owned = ptr_is_owned(msg);
10536         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10537         msg_conv.is_owned = false;
10538         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10539 }
10540
10541 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) {
10542         void* this_arg_ptr = untag_ptr(this_arg);
10543         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10544         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10545         LDKPublicKey their_node_id_ref;
10546         CHECK(their_node_id->arr_len == 33);
10547         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10548         LDKUpdateFee msg_conv;
10549         msg_conv.inner = untag_ptr(msg);
10550         msg_conv.is_owned = ptr_is_owned(msg);
10551         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10552         msg_conv.is_owned = false;
10553         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10554 }
10555
10556 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) {
10557         void* this_arg_ptr = untag_ptr(this_arg);
10558         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10559         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10560         LDKPublicKey their_node_id_ref;
10561         CHECK(their_node_id->arr_len == 33);
10562         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10563         LDKAnnouncementSignatures msg_conv;
10564         msg_conv.inner = untag_ptr(msg);
10565         msg_conv.is_owned = ptr_is_owned(msg);
10566         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10567         msg_conv.is_owned = false;
10568         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10569 }
10570
10571 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
10572         void* this_arg_ptr = untag_ptr(this_arg);
10573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10574         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10575         LDKPublicKey their_node_id_ref;
10576         CHECK(their_node_id->arr_len == 33);
10577         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10578         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
10579 }
10580
10581 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) {
10582         void* this_arg_ptr = untag_ptr(this_arg);
10583         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10584         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10585         LDKPublicKey their_node_id_ref;
10586         CHECK(their_node_id->arr_len == 33);
10587         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10588         LDKInit msg_conv;
10589         msg_conv.inner = untag_ptr(msg);
10590         msg_conv.is_owned = ptr_is_owned(msg);
10591         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10592         msg_conv.is_owned = false;
10593         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10594         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
10595         return tag_ptr(ret_conv, true);
10596 }
10597
10598 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) {
10599         void* this_arg_ptr = untag_ptr(this_arg);
10600         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10601         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10602         LDKPublicKey their_node_id_ref;
10603         CHECK(their_node_id->arr_len == 33);
10604         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10605         LDKChannelReestablish msg_conv;
10606         msg_conv.inner = untag_ptr(msg);
10607         msg_conv.is_owned = ptr_is_owned(msg);
10608         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10609         msg_conv.is_owned = false;
10610         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10611 }
10612
10613 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) {
10614         void* this_arg_ptr = untag_ptr(this_arg);
10615         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10616         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10617         LDKPublicKey their_node_id_ref;
10618         CHECK(their_node_id->arr_len == 33);
10619         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10620         LDKChannelUpdate msg_conv;
10621         msg_conv.inner = untag_ptr(msg);
10622         msg_conv.is_owned = ptr_is_owned(msg);
10623         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10624         msg_conv.is_owned = false;
10625         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10626 }
10627
10628 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10629         void* this_arg_ptr = untag_ptr(this_arg);
10630         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10631         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10632         LDKPublicKey their_node_id_ref;
10633         CHECK(their_node_id->arr_len == 33);
10634         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10635         LDKErrorMessage msg_conv;
10636         msg_conv.inner = untag_ptr(msg);
10637         msg_conv.is_owned = ptr_is_owned(msg);
10638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10639         msg_conv.is_owned = false;
10640         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10641 }
10642
10643 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
10644         void* this_arg_ptr = untag_ptr(this_arg);
10645         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10646         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10647         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10648         uint64_t ret_ref = 0;
10649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10651         return ret_ref;
10652 }
10653
10654 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10655         void* this_arg_ptr = untag_ptr(this_arg);
10656         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10657         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10658         LDKPublicKey their_node_id_ref;
10659         CHECK(their_node_id->arr_len == 33);
10660         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10661         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10662         uint64_t ret_ref = 0;
10663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10665         return ret_ref;
10666 }
10667
10668 typedef struct LDKRoutingMessageHandler_JCalls {
10669         atomic_size_t refcnt;
10670         uint32_t instance_ptr;
10671         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10672 } LDKRoutingMessageHandler_JCalls;
10673 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
10674         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10675         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10676                 FREE(j_calls);
10677         }
10678 }
10679 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
10680         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10681         LDKNodeAnnouncement msg_var = *msg;
10682         uint64_t msg_ref = 0;
10683         msg_var = NodeAnnouncement_clone(&msg_var);
10684         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10685         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10686         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 88, msg_ref, 0, 0, 0, 0, 0);
10687         void* ret_ptr = untag_ptr(ret);
10688         CHECK_ACCESS(ret_ptr);
10689         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10690         FREE(untag_ptr(ret));
10691         return ret_conv;
10692 }
10693 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
10694         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10695         LDKChannelAnnouncement msg_var = *msg;
10696         uint64_t msg_ref = 0;
10697         msg_var = ChannelAnnouncement_clone(&msg_var);
10698         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10699         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10700         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, msg_ref, 0, 0, 0, 0, 0);
10701         void* ret_ptr = untag_ptr(ret);
10702         CHECK_ACCESS(ret_ptr);
10703         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10704         FREE(untag_ptr(ret));
10705         return ret_conv;
10706 }
10707 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
10708         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10709         LDKChannelUpdate msg_var = *msg;
10710         uint64_t msg_ref = 0;
10711         msg_var = ChannelUpdate_clone(&msg_var);
10712         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10713         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10714         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 90, msg_ref, 0, 0, 0, 0, 0);
10715         void* ret_ptr = untag_ptr(ret);
10716         CHECK_ACCESS(ret_ptr);
10717         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10718         FREE(untag_ptr(ret));
10719         return ret_conv;
10720 }
10721 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
10722         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10723         int64_t starting_point_conv = starting_point;
10724         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 91, starting_point_conv, 0, 0, 0, 0, 0);
10725         void* ret_ptr = untag_ptr(ret);
10726         CHECK_ACCESS(ret_ptr);
10727         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
10728         FREE(untag_ptr(ret));
10729         return ret_conv;
10730 }
10731 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
10732         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10733         LDKNodeId starting_point_var = starting_point;
10734         uint64_t starting_point_ref = 0;
10735         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
10736         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
10737         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 92, starting_point_ref, 0, 0, 0, 0, 0);
10738         LDKNodeAnnouncement ret_conv;
10739         ret_conv.inner = untag_ptr(ret);
10740         ret_conv.is_owned = ptr_is_owned(ret);
10741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10742         return ret_conv;
10743 }
10744 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
10745         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10746         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10747         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10748         LDKInit init_var = *init;
10749         uint64_t init_ref = 0;
10750         init_var = Init_clone(&init_var);
10751         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10752         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10753         jboolean inbound_conv = inbound;
10754         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);
10755         void* ret_ptr = untag_ptr(ret);
10756         CHECK_ACCESS(ret_ptr);
10757         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10758         FREE(untag_ptr(ret));
10759         return ret_conv;
10760 }
10761 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
10762         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10763         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10764         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10765         LDKReplyChannelRange msg_var = msg;
10766         uint64_t msg_ref = 0;
10767         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10768         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10769         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10770         void* ret_ptr = untag_ptr(ret);
10771         CHECK_ACCESS(ret_ptr);
10772         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10773         FREE(untag_ptr(ret));
10774         return ret_conv;
10775 }
10776 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
10777         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10778         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10779         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10780         LDKReplyShortChannelIdsEnd msg_var = msg;
10781         uint64_t msg_ref = 0;
10782         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10783         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10784         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10785         void* ret_ptr = untag_ptr(ret);
10786         CHECK_ACCESS(ret_ptr);
10787         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10788         FREE(untag_ptr(ret));
10789         return ret_conv;
10790 }
10791 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
10792         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10793         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10794         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10795         LDKQueryChannelRange msg_var = msg;
10796         uint64_t msg_ref = 0;
10797         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10798         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10799         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10800         void* ret_ptr = untag_ptr(ret);
10801         CHECK_ACCESS(ret_ptr);
10802         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10803         FREE(untag_ptr(ret));
10804         return ret_conv;
10805 }
10806 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
10807         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10808         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10809         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10810         LDKQueryShortChannelIds msg_var = msg;
10811         uint64_t msg_ref = 0;
10812         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10813         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10814         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10815         void* ret_ptr = untag_ptr(ret);
10816         CHECK_ACCESS(ret_ptr);
10817         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10818         FREE(untag_ptr(ret));
10819         return ret_conv;
10820 }
10821 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10822         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10823         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, 0, 0, 0, 0, 0, 0);
10824 }
10825 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10826         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10827         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, 0, 0, 0, 0, 0, 0);
10828         LDKNodeFeatures ret_conv;
10829         ret_conv.inner = untag_ptr(ret);
10830         ret_conv.is_owned = ptr_is_owned(ret);
10831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10832         return ret_conv;
10833 }
10834 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10835         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10836         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10837         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10838         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10839         LDKInitFeatures ret_conv;
10840         ret_conv.inner = untag_ptr(ret);
10841         ret_conv.is_owned = ptr_is_owned(ret);
10842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10843         return ret_conv;
10844 }
10845 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
10846         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
10847         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10848         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10849 }
10850 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10851         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
10852         atomic_init(&calls->refcnt, 1);
10853         calls->instance_ptr = o;
10854
10855         LDKRoutingMessageHandler ret = {
10856                 .this_arg = (void*) calls,
10857                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
10858                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
10859                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
10860                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
10861                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
10862                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
10863                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
10864                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
10865                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
10866                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
10867                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
10868                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
10869                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
10870                 .free = LDKRoutingMessageHandler_JCalls_free,
10871                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10872         };
10873         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10874         return ret;
10875 }
10876 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10877         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10878         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
10879         return tag_ptr(res_ptr, true);
10880 }
10881 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
10882         void* this_arg_ptr = untag_ptr(this_arg);
10883         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10884         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10885         LDKNodeAnnouncement msg_conv;
10886         msg_conv.inner = untag_ptr(msg);
10887         msg_conv.is_owned = ptr_is_owned(msg);
10888         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10889         msg_conv.is_owned = false;
10890         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10891         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10892         return tag_ptr(ret_conv, true);
10893 }
10894
10895 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
10896         void* this_arg_ptr = untag_ptr(this_arg);
10897         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10898         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10899         LDKChannelAnnouncement msg_conv;
10900         msg_conv.inner = untag_ptr(msg);
10901         msg_conv.is_owned = ptr_is_owned(msg);
10902         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10903         msg_conv.is_owned = false;
10904         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10905         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10906         return tag_ptr(ret_conv, true);
10907 }
10908
10909 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
10910         void* this_arg_ptr = untag_ptr(this_arg);
10911         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10912         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10913         LDKChannelUpdate msg_conv;
10914         msg_conv.inner = untag_ptr(msg);
10915         msg_conv.is_owned = ptr_is_owned(msg);
10916         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10917         msg_conv.is_owned = false;
10918         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10919         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10920         return tag_ptr(ret_conv, true);
10921 }
10922
10923 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) {
10924         void* this_arg_ptr = untag_ptr(this_arg);
10925         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10926         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10927         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
10928         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
10929         uint64_t ret_ref = tag_ptr(ret_copy, true);
10930         return ret_ref;
10931 }
10932
10933 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) {
10934         void* this_arg_ptr = untag_ptr(this_arg);
10935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10936         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10937         LDKNodeId starting_point_conv;
10938         starting_point_conv.inner = untag_ptr(starting_point);
10939         starting_point_conv.is_owned = ptr_is_owned(starting_point);
10940         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
10941         starting_point_conv = NodeId_clone(&starting_point_conv);
10942         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
10943         uint64_t ret_ref = 0;
10944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10946         return ret_ref;
10947 }
10948
10949 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) {
10950         void* this_arg_ptr = untag_ptr(this_arg);
10951         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10952         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10953         LDKPublicKey their_node_id_ref;
10954         CHECK(their_node_id->arr_len == 33);
10955         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10956         LDKInit init_conv;
10957         init_conv.inner = untag_ptr(init);
10958         init_conv.is_owned = ptr_is_owned(init);
10959         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10960         init_conv.is_owned = false;
10961         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10962         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
10963         return tag_ptr(ret_conv, true);
10964 }
10965
10966 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) {
10967         void* this_arg_ptr = untag_ptr(this_arg);
10968         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10969         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10970         LDKPublicKey their_node_id_ref;
10971         CHECK(their_node_id->arr_len == 33);
10972         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10973         LDKReplyChannelRange msg_conv;
10974         msg_conv.inner = untag_ptr(msg);
10975         msg_conv.is_owned = ptr_is_owned(msg);
10976         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10977         msg_conv = ReplyChannelRange_clone(&msg_conv);
10978         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10979         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10980         return tag_ptr(ret_conv, true);
10981 }
10982
10983 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) {
10984         void* this_arg_ptr = untag_ptr(this_arg);
10985         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10986         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10987         LDKPublicKey their_node_id_ref;
10988         CHECK(their_node_id->arr_len == 33);
10989         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10990         LDKReplyShortChannelIdsEnd msg_conv;
10991         msg_conv.inner = untag_ptr(msg);
10992         msg_conv.is_owned = ptr_is_owned(msg);
10993         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10994         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10995         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10996         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10997         return tag_ptr(ret_conv, true);
10998 }
10999
11000 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) {
11001         void* this_arg_ptr = untag_ptr(this_arg);
11002         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11003         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11004         LDKPublicKey their_node_id_ref;
11005         CHECK(their_node_id->arr_len == 33);
11006         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11007         LDKQueryChannelRange msg_conv;
11008         msg_conv.inner = untag_ptr(msg);
11009         msg_conv.is_owned = ptr_is_owned(msg);
11010         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11011         msg_conv = QueryChannelRange_clone(&msg_conv);
11012         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11013         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
11014         return tag_ptr(ret_conv, true);
11015 }
11016
11017 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) {
11018         void* this_arg_ptr = untag_ptr(this_arg);
11019         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11020         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11021         LDKPublicKey their_node_id_ref;
11022         CHECK(their_node_id->arr_len == 33);
11023         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11024         LDKQueryShortChannelIds msg_conv;
11025         msg_conv.inner = untag_ptr(msg);
11026         msg_conv.is_owned = ptr_is_owned(msg);
11027         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11028         msg_conv = QueryShortChannelIds_clone(&msg_conv);
11029         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11030         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
11031         return tag_ptr(ret_conv, true);
11032 }
11033
11034 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
11035         void* this_arg_ptr = untag_ptr(this_arg);
11036         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11037         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11038         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
11039         return ret_conv;
11040 }
11041
11042 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
11043         void* this_arg_ptr = untag_ptr(this_arg);
11044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11045         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11046         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
11047         uint64_t ret_ref = 0;
11048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11050         return ret_ref;
11051 }
11052
11053 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
11054         void* this_arg_ptr = untag_ptr(this_arg);
11055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11056         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11057         LDKPublicKey their_node_id_ref;
11058         CHECK(their_node_id->arr_len == 33);
11059         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11060         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
11061         uint64_t ret_ref = 0;
11062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11064         return ret_ref;
11065 }
11066
11067 typedef struct LDKOnionMessageProvider_JCalls {
11068         atomic_size_t refcnt;
11069         uint32_t instance_ptr;
11070 } LDKOnionMessageProvider_JCalls;
11071 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
11072         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
11073         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11074                 FREE(j_calls);
11075         }
11076 }
11077 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
11078         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
11079         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
11080         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
11081         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
11082         LDKOnionMessage ret_conv;
11083         ret_conv.inner = untag_ptr(ret);
11084         ret_conv.is_owned = ptr_is_owned(ret);
11085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11086         return ret_conv;
11087 }
11088 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
11089         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
11090         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11091 }
11092 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
11093         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
11094         atomic_init(&calls->refcnt, 1);
11095         calls->instance_ptr = o;
11096
11097         LDKOnionMessageProvider ret = {
11098                 .this_arg = (void*) calls,
11099                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
11100                 .free = LDKOnionMessageProvider_JCalls_free,
11101         };
11102         return ret;
11103 }
11104 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
11105         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
11106         *res_ptr = LDKOnionMessageProvider_init(o);
11107         return tag_ptr(res_ptr, true);
11108 }
11109 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) {
11110         void* this_arg_ptr = untag_ptr(this_arg);
11111         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11112         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
11113         LDKPublicKey peer_node_id_ref;
11114         CHECK(peer_node_id->arr_len == 33);
11115         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
11116         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
11117         uint64_t ret_ref = 0;
11118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11120         return ret_ref;
11121 }
11122
11123 typedef struct LDKOnionMessageHandler_JCalls {
11124         atomic_size_t refcnt;
11125         uint32_t instance_ptr;
11126         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
11127 } LDKOnionMessageHandler_JCalls;
11128 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
11129         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11130         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11131                 FREE(j_calls);
11132         }
11133 }
11134 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
11135         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11136         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
11137         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
11138         LDKOnionMessage msg_var = *msg;
11139         uint64_t msg_ref = 0;
11140         msg_var = OnionMessage_clone(&msg_var);
11141         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11142         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11143         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
11144 }
11145 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
11146         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11147         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11148         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11149         LDKInit init_var = *init;
11150         uint64_t init_ref = 0;
11151         init_var = Init_clone(&init_var);
11152         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
11153         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
11154         jboolean inbound_conv = inbound;
11155         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);
11156         void* ret_ptr = untag_ptr(ret);
11157         CHECK_ACCESS(ret_ptr);
11158         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
11159         FREE(untag_ptr(ret));
11160         return ret_conv;
11161 }
11162 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
11163         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11164         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11165         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11166         js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
11167 }
11168 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
11169         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11170         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0);
11171         LDKNodeFeatures ret_conv;
11172         ret_conv.inner = untag_ptr(ret);
11173         ret_conv.is_owned = ptr_is_owned(ret);
11174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11175         return ret_conv;
11176 }
11177 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
11178         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11179         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11180         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11181         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
11182         LDKInitFeatures ret_conv;
11183         ret_conv.inner = untag_ptr(ret);
11184         ret_conv.is_owned = ptr_is_owned(ret);
11185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11186         return ret_conv;
11187 }
11188 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
11189         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
11190         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11191         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
11192 }
11193 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
11194         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
11195         atomic_init(&calls->refcnt, 1);
11196         calls->instance_ptr = o;
11197
11198         LDKOnionMessageHandler ret = {
11199                 .this_arg = (void*) calls,
11200                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
11201                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
11202                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
11203                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
11204                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
11205                 .free = LDKOnionMessageHandler_JCalls_free,
11206                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
11207         };
11208         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
11209         return ret;
11210 }
11211 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
11212         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
11213         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
11214         return tag_ptr(res_ptr, true);
11215 }
11216 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) {
11217         void* this_arg_ptr = untag_ptr(this_arg);
11218         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11219         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11220         LDKPublicKey peer_node_id_ref;
11221         CHECK(peer_node_id->arr_len == 33);
11222         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
11223         LDKOnionMessage msg_conv;
11224         msg_conv.inner = untag_ptr(msg);
11225         msg_conv.is_owned = ptr_is_owned(msg);
11226         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11227         msg_conv.is_owned = false;
11228         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
11229 }
11230
11231 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) {
11232         void* this_arg_ptr = untag_ptr(this_arg);
11233         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11234         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11235         LDKPublicKey their_node_id_ref;
11236         CHECK(their_node_id->arr_len == 33);
11237         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11238         LDKInit init_conv;
11239         init_conv.inner = untag_ptr(init);
11240         init_conv.is_owned = ptr_is_owned(init);
11241         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
11242         init_conv.is_owned = false;
11243         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11244         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
11245         return tag_ptr(ret_conv, true);
11246 }
11247
11248 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
11249         void* this_arg_ptr = untag_ptr(this_arg);
11250         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11251         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11252         LDKPublicKey their_node_id_ref;
11253         CHECK(their_node_id->arr_len == 33);
11254         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11255         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
11256 }
11257
11258 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
11259         void* this_arg_ptr = untag_ptr(this_arg);
11260         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11261         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11262         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
11263         uint64_t ret_ref = 0;
11264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11266         return ret_ref;
11267 }
11268
11269 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
11270         void* this_arg_ptr = untag_ptr(this_arg);
11271         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11272         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11273         LDKPublicKey their_node_id_ref;
11274         CHECK(their_node_id->arr_len == 33);
11275         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11276         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
11277         uint64_t ret_ref = 0;
11278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11280         return ret_ref;
11281 }
11282
11283 typedef struct LDKCustomMessageReader_JCalls {
11284         atomic_size_t refcnt;
11285         uint32_t instance_ptr;
11286 } LDKCustomMessageReader_JCalls;
11287 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
11288         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11289         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11290                 FREE(j_calls);
11291         }
11292 }
11293 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
11294         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11295         int16_t message_type_conv = message_type;
11296         LDKu8slice buffer_var = buffer;
11297         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
11298         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
11299         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 107, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
11300         void* ret_ptr = untag_ptr(ret);
11301         CHECK_ACCESS(ret_ptr);
11302         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
11303         FREE(untag_ptr(ret));
11304         return ret_conv;
11305 }
11306 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
11307         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
11308         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11309 }
11310 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
11311         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
11312         atomic_init(&calls->refcnt, 1);
11313         calls->instance_ptr = o;
11314
11315         LDKCustomMessageReader ret = {
11316                 .this_arg = (void*) calls,
11317                 .read = read_LDKCustomMessageReader_jcall,
11318                 .free = LDKCustomMessageReader_JCalls_free,
11319         };
11320         return ret;
11321 }
11322 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
11323         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
11324         *res_ptr = LDKCustomMessageReader_init(o);
11325         return tag_ptr(res_ptr, true);
11326 }
11327 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
11328         void* this_arg_ptr = untag_ptr(this_arg);
11329         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11330         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
11331         LDKu8slice buffer_ref;
11332         buffer_ref.datalen = buffer->arr_len;
11333         buffer_ref.data = buffer->elems;
11334         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11335         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
11336         FREE(buffer);
11337         return tag_ptr(ret_conv, true);
11338 }
11339
11340 typedef struct LDKCustomMessageHandler_JCalls {
11341         atomic_size_t refcnt;
11342         uint32_t instance_ptr;
11343         LDKCustomMessageReader_JCalls* CustomMessageReader;
11344 } LDKCustomMessageHandler_JCalls;
11345 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
11346         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11347         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11348                 FREE(j_calls);
11349         }
11350 }
11351 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
11352         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11353         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
11354         *msg_ret = msg;
11355         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
11356         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
11357         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);
11358         void* ret_ptr = untag_ptr(ret);
11359         CHECK_ACCESS(ret_ptr);
11360         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11361         FREE(untag_ptr(ret));
11362         return ret_conv;
11363 }
11364 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
11365         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11366         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, 0, 0, 0, 0, 0, 0);
11367         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
11368         ret_constr.datalen = ret->arr_len;
11369         if (ret_constr.datalen > 0)
11370                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11371         else
11372                 ret_constr.data = NULL;
11373         uint64_t* ret_vals = ret->elems;
11374         for (size_t z = 0; z < ret_constr.datalen; z++) {
11375                 uint64_t ret_conv_25 = ret_vals[z];
11376                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
11377                 CHECK_ACCESS(ret_conv_25_ptr);
11378                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
11379                 FREE(untag_ptr(ret_conv_25));
11380                 ret_constr.data[z] = ret_conv_25_conv;
11381         }
11382         FREE(ret);
11383         return ret_constr;
11384 }
11385 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
11386         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
11387         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11388         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
11389 }
11390 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
11391         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
11392         atomic_init(&calls->refcnt, 1);
11393         calls->instance_ptr = o;
11394
11395         LDKCustomMessageHandler ret = {
11396                 .this_arg = (void*) calls,
11397                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
11398                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
11399                 .free = LDKCustomMessageHandler_JCalls_free,
11400                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
11401         };
11402         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
11403         return ret;
11404 }
11405 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
11406         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
11407         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
11408         return tag_ptr(res_ptr, true);
11409 }
11410 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) {
11411         void* this_arg_ptr = untag_ptr(this_arg);
11412         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11413         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11414         void* msg_ptr = untag_ptr(msg);
11415         CHECK_ACCESS(msg_ptr);
11416         LDKType msg_conv = *(LDKType*)(msg_ptr);
11417         if (msg_conv.free == LDKType_JCalls_free) {
11418                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11419                 LDKType_JCalls_cloned(&msg_conv);
11420         }
11421         LDKPublicKey sender_node_id_ref;
11422         CHECK(sender_node_id->arr_len == 33);
11423         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
11424         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11425         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
11426         return tag_ptr(ret_conv, true);
11427 }
11428
11429 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
11430         void* this_arg_ptr = untag_ptr(this_arg);
11431         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11432         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11433         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
11434         uint64_tArray ret_arr = NULL;
11435         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11436         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11437         for (size_t z = 0; z < ret_var.datalen; z++) {
11438                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11439                 *ret_conv_25_conv = ret_var.data[z];
11440                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
11441         }
11442         
11443         FREE(ret_var.data);
11444         return ret_arr;
11445 }
11446
11447 typedef struct LDKCustomOnionMessageHandler_JCalls {
11448         atomic_size_t refcnt;
11449         uint32_t instance_ptr;
11450 } LDKCustomOnionMessageHandler_JCalls;
11451 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
11452         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11453         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11454                 FREE(j_calls);
11455         }
11456 }
11457 void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
11458         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11459         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11460         *msg_ret = msg;
11461         js_invoke_function_buuuuu(j_calls->instance_ptr, 110, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
11462 }
11463 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
11464         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11465         int64_t message_type_conv = message_type;
11466         LDKu8slice buffer_var = buffer;
11467         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
11468         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
11469         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 111, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
11470         void* ret_ptr = untag_ptr(ret);
11471         CHECK_ACCESS(ret_ptr);
11472         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
11473         FREE(untag_ptr(ret));
11474         return ret_conv;
11475 }
11476 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
11477         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
11478         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11479 }
11480 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
11481         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
11482         atomic_init(&calls->refcnt, 1);
11483         calls->instance_ptr = o;
11484
11485         LDKCustomOnionMessageHandler ret = {
11486                 .this_arg = (void*) calls,
11487                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
11488                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
11489                 .free = LDKCustomOnionMessageHandler_JCalls_free,
11490         };
11491         return ret;
11492 }
11493 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
11494         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
11495         *res_ptr = LDKCustomOnionMessageHandler_init(o);
11496         return tag_ptr(res_ptr, true);
11497 }
11498 void  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
11499         void* this_arg_ptr = untag_ptr(this_arg);
11500         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11501         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
11502         void* msg_ptr = untag_ptr(msg);
11503         CHECK_ACCESS(msg_ptr);
11504         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
11505         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
11506                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11507                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
11508         }
11509         (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
11510 }
11511
11512 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) {
11513         void* this_arg_ptr = untag_ptr(this_arg);
11514         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11515         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
11516         LDKu8slice buffer_ref;
11517         buffer_ref.datalen = buffer->arr_len;
11518         buffer_ref.data = buffer->elems;
11519         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
11520         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
11521         FREE(buffer);
11522         return tag_ptr(ret_conv, true);
11523 }
11524
11525 typedef struct LDKSocketDescriptor_JCalls {
11526         atomic_size_t refcnt;
11527         uint32_t instance_ptr;
11528 } LDKSocketDescriptor_JCalls;
11529 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
11530         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11531         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11532                 FREE(j_calls);
11533         }
11534 }
11535 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
11536         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11537         LDKu8slice data_var = data;
11538         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
11539         memcpy(data_arr->elems, data_var.data, data_var.datalen);
11540         jboolean resume_read_conv = resume_read;
11541         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
11542 }
11543 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
11544         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11545         js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
11546 }
11547 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
11548         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11549         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11550         *other_arg_clone = SocketDescriptor_clone(other_arg);
11551         return js_invoke_function_buuuuu(j_calls->instance_ptr, 114, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
11552 }
11553 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
11554         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11555         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0);
11556 }
11557 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
11558         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
11559         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11560 }
11561 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
11562         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
11563         atomic_init(&calls->refcnt, 1);
11564         calls->instance_ptr = o;
11565
11566         LDKSocketDescriptor ret = {
11567                 .this_arg = (void*) calls,
11568                 .send_data = send_data_LDKSocketDescriptor_jcall,
11569                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
11570                 .eq = eq_LDKSocketDescriptor_jcall,
11571                 .hash = hash_LDKSocketDescriptor_jcall,
11572                 .cloned = LDKSocketDescriptor_JCalls_cloned,
11573                 .free = LDKSocketDescriptor_JCalls_free,
11574         };
11575         return ret;
11576 }
11577 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
11578         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11579         *res_ptr = LDKSocketDescriptor_init(o);
11580         return tag_ptr(res_ptr, true);
11581 }
11582 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
11583         void* this_arg_ptr = untag_ptr(this_arg);
11584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11585         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11586         LDKu8slice data_ref;
11587         data_ref.datalen = data->arr_len;
11588         data_ref.data = data->elems;
11589         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
11590         FREE(data);
11591         return ret_conv;
11592 }
11593
11594 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
11595         void* this_arg_ptr = untag_ptr(this_arg);
11596         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11597         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11598         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
11599 }
11600
11601 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
11602         void* this_arg_ptr = untag_ptr(this_arg);
11603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11604         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11605         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
11606         return ret_conv;
11607 }
11608
11609 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
11610         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11611         switch(obj->tag) {
11612                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
11613                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
11614                 case LDKEffectiveCapacity_Total: return 2;
11615                 case LDKEffectiveCapacity_Infinite: return 3;
11616                 case LDKEffectiveCapacity_Unknown: return 4;
11617                 default: abort();
11618         }
11619 }
11620 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
11621         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11622         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
11623                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
11624         return liquidity_msat_conv;
11625 }
11626 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
11627         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11628         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
11629                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
11630         return amount_msat_conv;
11631 }
11632 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
11633         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11634         assert(obj->tag == LDKEffectiveCapacity_Total);
11635                         int64_t capacity_msat_conv = obj->total.capacity_msat;
11636         return capacity_msat_conv;
11637 }
11638 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
11639         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11640         assert(obj->tag == LDKEffectiveCapacity_Total);
11641                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
11642         return htlc_maximum_msat_conv;
11643 }
11644 uint32_t __attribute__((export_name("TS_LDKHints_ty_from_ptr"))) TS_LDKHints_ty_from_ptr(uint64_t ptr) {
11645         LDKHints *obj = (LDKHints*)untag_ptr(ptr);
11646         switch(obj->tag) {
11647                 case LDKHints_Blinded: return 0;
11648                 case LDKHints_Clear: return 1;
11649                 default: abort();
11650         }
11651 }
11652 uint64_tArray __attribute__((export_name("TS_LDKHints_Blinded_get_blinded"))) TS_LDKHints_Blinded_get_blinded(uint64_t ptr) {
11653         LDKHints *obj = (LDKHints*)untag_ptr(ptr);
11654         assert(obj->tag == LDKHints_Blinded);
11655                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_var = obj->blinded;
11656                         uint64_tArray blinded_arr = NULL;
11657                         blinded_arr = init_uint64_tArray(blinded_var.datalen, __LINE__);
11658                         uint64_t *blinded_arr_ptr = (uint64_t*)(((uint8_t*)blinded_arr) + 8);
11659                         for (size_t l = 0; l < blinded_var.datalen; l++) {
11660                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* blinded_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
11661                                 *blinded_conv_37_conv = blinded_var.data[l];
11662                                 *blinded_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(blinded_conv_37_conv);
11663                                 blinded_arr_ptr[l] = tag_ptr(blinded_conv_37_conv, true);
11664                         }
11665                         
11666         return blinded_arr;
11667 }
11668 uint64_tArray __attribute__((export_name("TS_LDKHints_Clear_get_clear"))) TS_LDKHints_Clear_get_clear(uint64_t ptr) {
11669         LDKHints *obj = (LDKHints*)untag_ptr(ptr);
11670         assert(obj->tag == LDKHints_Clear);
11671                         LDKCVec_RouteHintZ clear_var = obj->clear;
11672                         uint64_tArray clear_arr = NULL;
11673                         clear_arr = init_uint64_tArray(clear_var.datalen, __LINE__);
11674                         uint64_t *clear_arr_ptr = (uint64_t*)(((uint8_t*)clear_arr) + 8);
11675                         for (size_t l = 0; l < clear_var.datalen; l++) {
11676                                 LDKRouteHint clear_conv_11_var = clear_var.data[l];
11677                                 uint64_t clear_conv_11_ref = 0;
11678                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(clear_conv_11_var);
11679                                 clear_conv_11_ref = tag_ptr(clear_conv_11_var.inner, false);
11680                                 clear_arr_ptr[l] = clear_conv_11_ref;
11681                         }
11682                         
11683         return clear_arr;
11684 }
11685 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
11686         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11687         switch(obj->tag) {
11688                 case LDKDestination_Node: return 0;
11689                 case LDKDestination_BlindedPath: return 1;
11690                 default: abort();
11691         }
11692 }
11693 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
11694         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11695         assert(obj->tag == LDKDestination_Node);
11696                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
11697                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
11698         return node_arr;
11699 }
11700 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
11701         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11702         assert(obj->tag == LDKDestination_BlindedPath);
11703                         LDKBlindedPath blinded_path_var = obj->blinded_path;
11704                         uint64_t blinded_path_ref = 0;
11705                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
11706                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
11707         return blinded_path_ref;
11708 }
11709 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11710         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11711         switch(obj->tag) {
11712                 case LDKOnionMessageContents_Custom: return 0;
11713                 default: abort();
11714         }
11715 }
11716 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11717         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11718         assert(obj->tag == LDKOnionMessageContents_Custom);
11719                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11720                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
11721         return tag_ptr(custom_ret, true);
11722 }
11723 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
11724         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11725         switch(obj->tag) {
11726                 case LDKGossipSync_P2P: return 0;
11727                 case LDKGossipSync_Rapid: return 1;
11728                 case LDKGossipSync_None: return 2;
11729                 default: abort();
11730         }
11731 }
11732 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
11733         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11734         assert(obj->tag == LDKGossipSync_P2P);
11735                         LDKP2PGossipSync p2p_var = obj->p2p;
11736                         uint64_t p2p_ref = 0;
11737                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
11738                         p2p_ref = tag_ptr(p2p_var.inner, false);
11739         return p2p_ref;
11740 }
11741 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
11742         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11743         assert(obj->tag == LDKGossipSync_Rapid);
11744                         LDKRapidGossipSync rapid_var = obj->rapid;
11745                         uint64_t rapid_ref = 0;
11746                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
11747                         rapid_ref = tag_ptr(rapid_var.inner, false);
11748         return rapid_ref;
11749 }
11750 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
11751         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11752         switch(obj->tag) {
11753                 case LDKFallback_SegWitProgram: return 0;
11754                 case LDKFallback_PubKeyHash: return 1;
11755                 case LDKFallback_ScriptHash: return 2;
11756                 default: abort();
11757         }
11758 }
11759 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
11760         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11761         assert(obj->tag == LDKFallback_SegWitProgram);
11762                         uint8_t version_val = obj->seg_wit_program.version._0;
11763         return version_val;
11764 }
11765 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
11766         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11767         assert(obj->tag == LDKFallback_SegWitProgram);
11768                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
11769                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
11770                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
11771         return program_arr;
11772 }
11773 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
11774         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11775         assert(obj->tag == LDKFallback_PubKeyHash);
11776                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
11777                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
11778         return pub_key_hash_arr;
11779 }
11780 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
11781         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11782         assert(obj->tag == LDKFallback_ScriptHash);
11783                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
11784                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
11785         return script_hash_arr;
11786 }
11787 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11788         LDKStr ret_str = _ldk_get_compiled_version();
11789         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11790         Str_free(ret_str);
11791         return ret_conv;
11792 }
11793
11794 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11795         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11796         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11797         Str_free(ret_str);
11798         return ret_conv;
11799 }
11800
11801 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
11802         LDKU128 val_ref;
11803         CHECK(val->arr_len == 16);
11804         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
11805         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11806         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
11807         return ret_arr;
11808 }
11809
11810 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
11811         LDKSixteenBytes le_bytes_ref;
11812         CHECK(le_bytes->arr_len == 16);
11813         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
11814         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11815         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
11816         return ret_arr;
11817 }
11818
11819 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11820         LDKThirtyTwoBytes big_endian_bytes_ref;
11821         CHECK(big_endian_bytes->arr_len == 32);
11822         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11823         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11824         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11825         return tag_ptr(ret_ref, true);
11826 }
11827
11828 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11829         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11830         *ret_copy = Bech32Error_clone(arg);
11831         uint64_t ret_ref = tag_ptr(ret_copy, true);
11832         return ret_ref;
11833 }
11834 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11835         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11836         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11837         return ret_conv;
11838 }
11839
11840 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11841         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11842         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11843         *ret_copy = Bech32Error_clone(orig_conv);
11844         uint64_t ret_ref = tag_ptr(ret_copy, true);
11845         return ret_ref;
11846 }
11847
11848 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11849         if (!ptr_is_owned(o)) return;
11850         void* o_ptr = untag_ptr(o);
11851         CHECK_ACCESS(o_ptr);
11852         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11853         FREE(untag_ptr(o));
11854         Bech32Error_free(o_conv);
11855 }
11856
11857 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11858         LDKTransaction _res_ref;
11859         _res_ref.datalen = _res->arr_len;
11860         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11861         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11862         _res_ref.data_is_owned = true;
11863         Transaction_free(_res_ref);
11864 }
11865
11866 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
11867         LDKWitness _res_ref;
11868         _res_ref.datalen = _res->arr_len;
11869         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
11870         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11871         _res_ref.data_is_owned = true;
11872         Witness_free(_res_ref);
11873 }
11874
11875 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11876         LDKCVec_u8Z script_pubkey_ref;
11877         script_pubkey_ref.datalen = script_pubkey->arr_len;
11878         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11879         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11880         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11881         *ret_ref = TxOut_new(script_pubkey_ref, value);
11882         return tag_ptr(ret_ref, true);
11883 }
11884
11885 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11886         if (!ptr_is_owned(_res)) return;
11887         void* _res_ptr = untag_ptr(_res);
11888         CHECK_ACCESS(_res_ptr);
11889         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11890         FREE(untag_ptr(_res));
11891         TxOut_free(_res_conv);
11892 }
11893
11894 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11895         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11896         *ret_ref = TxOut_clone(arg);
11897         return tag_ptr(ret_ref, true);
11898 }
11899 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11900         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11901         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11902         return ret_conv;
11903 }
11904
11905 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11906         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11907         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11908         *ret_ref = TxOut_clone(orig_conv);
11909         return tag_ptr(ret_ref, true);
11910 }
11911
11912 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11913         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11914         Str_free(dummy);
11915 }
11916
11917 uint64_t  __attribute__((export_name("TS_COption_DurationZ_some"))) TS_COption_DurationZ_some(int64_t o) {
11918         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
11919         *ret_copy = COption_DurationZ_some(o);
11920         uint64_t ret_ref = tag_ptr(ret_copy, true);
11921         return ret_ref;
11922 }
11923
11924 uint64_t  __attribute__((export_name("TS_COption_DurationZ_none"))) TS_COption_DurationZ_none() {
11925         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
11926         *ret_copy = COption_DurationZ_none();
11927         uint64_t ret_ref = tag_ptr(ret_copy, true);
11928         return ret_ref;
11929 }
11930
11931 void  __attribute__((export_name("TS_COption_DurationZ_free"))) TS_COption_DurationZ_free(uint64_t _res) {
11932         if (!ptr_is_owned(_res)) return;
11933         void* _res_ptr = untag_ptr(_res);
11934         CHECK_ACCESS(_res_ptr);
11935         LDKCOption_DurationZ _res_conv = *(LDKCOption_DurationZ*)(_res_ptr);
11936         FREE(untag_ptr(_res));
11937         COption_DurationZ_free(_res_conv);
11938 }
11939
11940 static inline uint64_t COption_DurationZ_clone_ptr(LDKCOption_DurationZ *NONNULL_PTR arg) {
11941         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
11942         *ret_copy = COption_DurationZ_clone(arg);
11943         uint64_t ret_ref = tag_ptr(ret_copy, true);
11944         return ret_ref;
11945 }
11946 int64_t  __attribute__((export_name("TS_COption_DurationZ_clone_ptr"))) TS_COption_DurationZ_clone_ptr(uint64_t arg) {
11947         LDKCOption_DurationZ* arg_conv = (LDKCOption_DurationZ*)untag_ptr(arg);
11948         int64_t ret_conv = COption_DurationZ_clone_ptr(arg_conv);
11949         return ret_conv;
11950 }
11951
11952 uint64_t  __attribute__((export_name("TS_COption_DurationZ_clone"))) TS_COption_DurationZ_clone(uint64_t orig) {
11953         LDKCOption_DurationZ* orig_conv = (LDKCOption_DurationZ*)untag_ptr(orig);
11954         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
11955         *ret_copy = COption_DurationZ_clone(orig_conv);
11956         uint64_t ret_ref = tag_ptr(ret_copy, true);
11957         return ret_ref;
11958 }
11959
11960 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
11961         LDKCVec_BlindedPathZ _res_constr;
11962         _res_constr.datalen = _res->arr_len;
11963         if (_res_constr.datalen > 0)
11964                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
11965         else
11966                 _res_constr.data = NULL;
11967         uint64_t* _res_vals = _res->elems;
11968         for (size_t n = 0; n < _res_constr.datalen; n++) {
11969                 uint64_t _res_conv_13 = _res_vals[n];
11970                 LDKBlindedPath _res_conv_13_conv;
11971                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
11972                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
11973                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
11974                 _res_constr.data[n] = _res_conv_13_conv;
11975         }
11976         FREE(_res);
11977         CVec_BlindedPathZ_free(_res_constr);
11978 }
11979
11980 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
11981         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11982         *ret_copy = COption_u64Z_some(o);
11983         uint64_t ret_ref = tag_ptr(ret_copy, true);
11984         return ret_ref;
11985 }
11986
11987 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
11988         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11989         *ret_copy = COption_u64Z_none();
11990         uint64_t ret_ref = tag_ptr(ret_copy, true);
11991         return ret_ref;
11992 }
11993
11994 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
11995         if (!ptr_is_owned(_res)) return;
11996         void* _res_ptr = untag_ptr(_res);
11997         CHECK_ACCESS(_res_ptr);
11998         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
11999         FREE(untag_ptr(_res));
12000         COption_u64Z_free(_res_conv);
12001 }
12002
12003 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12004         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12005         *ret_copy = COption_u64Z_clone(arg);
12006         uint64_t ret_ref = tag_ptr(ret_copy, true);
12007         return ret_ref;
12008 }
12009 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12010         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12011         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12012         return ret_conv;
12013 }
12014
12015 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12016         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12017         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12018         *ret_copy = COption_u64Z_clone(orig_conv);
12019         uint64_t ret_ref = tag_ptr(ret_copy, true);
12020         return ret_ref;
12021 }
12022
12023 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
12024         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12025         *ret_conv = CResult_NoneAPIErrorZ_ok();
12026         return tag_ptr(ret_conv, true);
12027 }
12028
12029 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
12030         void* e_ptr = untag_ptr(e);
12031         CHECK_ACCESS(e_ptr);
12032         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
12033         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
12034         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12035         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
12036         return tag_ptr(ret_conv, true);
12037 }
12038
12039 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
12040         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
12041         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
12042         return ret_conv;
12043 }
12044
12045 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
12046         if (!ptr_is_owned(_res)) return;
12047         void* _res_ptr = untag_ptr(_res);
12048         CHECK_ACCESS(_res_ptr);
12049         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
12050         FREE(untag_ptr(_res));
12051         CResult_NoneAPIErrorZ_free(_res_conv);
12052 }
12053
12054 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
12055         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12056         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
12057         return tag_ptr(ret_conv, true);
12058 }
12059 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
12060         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
12061         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
12062         return ret_conv;
12063 }
12064
12065 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
12066         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
12067         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12068         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
12069         return tag_ptr(ret_conv, true);
12070 }
12071
12072 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
12073         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
12074         _res_constr.datalen = _res->arr_len;
12075         if (_res_constr.datalen > 0)
12076                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
12077         else
12078                 _res_constr.data = NULL;
12079         uint64_t* _res_vals = _res->elems;
12080         for (size_t w = 0; w < _res_constr.datalen; w++) {
12081                 uint64_t _res_conv_22 = _res_vals[w];
12082                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
12083                 CHECK_ACCESS(_res_conv_22_ptr);
12084                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
12085                 FREE(untag_ptr(_res_conv_22));
12086                 _res_constr.data[w] = _res_conv_22_conv;
12087         }
12088         FREE(_res);
12089         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
12090 }
12091
12092 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
12093         LDKCVec_APIErrorZ _res_constr;
12094         _res_constr.datalen = _res->arr_len;
12095         if (_res_constr.datalen > 0)
12096                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
12097         else
12098                 _res_constr.data = NULL;
12099         uint64_t* _res_vals = _res->elems;
12100         for (size_t k = 0; k < _res_constr.datalen; k++) {
12101                 uint64_t _res_conv_10 = _res_vals[k];
12102                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
12103                 CHECK_ACCESS(_res_conv_10_ptr);
12104                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
12105                 FREE(untag_ptr(_res_conv_10));
12106                 _res_constr.data[k] = _res_conv_10_conv;
12107         }
12108         FREE(_res);
12109         CVec_APIErrorZ_free(_res_constr);
12110 }
12111
12112 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
12113         LDKCVec_u8Z _res_ref;
12114         _res_ref.datalen = _res->arr_len;
12115         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
12116         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
12117         CVec_u8Z_free(_res_ref);
12118 }
12119
12120 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
12121         LDKCVec_u8Z o_ref;
12122         o_ref.datalen = o->arr_len;
12123         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
12124         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
12125         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
12126         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
12127         uint64_t ret_ref = tag_ptr(ret_copy, true);
12128         return ret_ref;
12129 }
12130
12131 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
12132         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
12133         *ret_copy = COption_CVec_u8ZZ_none();
12134         uint64_t ret_ref = tag_ptr(ret_copy, true);
12135         return ret_ref;
12136 }
12137
12138 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
12139         if (!ptr_is_owned(_res)) return;
12140         void* _res_ptr = untag_ptr(_res);
12141         CHECK_ACCESS(_res_ptr);
12142         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
12143         FREE(untag_ptr(_res));
12144         COption_CVec_u8ZZ_free(_res_conv);
12145 }
12146
12147 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
12148         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
12149         *ret_copy = COption_CVec_u8ZZ_clone(arg);
12150         uint64_t ret_ref = tag_ptr(ret_copy, true);
12151         return ret_ref;
12152 }
12153 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
12154         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
12155         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
12156         return ret_conv;
12157 }
12158
12159 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
12160         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
12161         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
12162         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
12163         uint64_t ret_ref = tag_ptr(ret_copy, true);
12164         return ret_ref;
12165 }
12166
12167 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
12168         LDKRecipientOnionFields o_conv;
12169         o_conv.inner = untag_ptr(o);
12170         o_conv.is_owned = ptr_is_owned(o);
12171         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12172         o_conv = RecipientOnionFields_clone(&o_conv);
12173         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
12174         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
12175         return tag_ptr(ret_conv, true);
12176 }
12177
12178 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
12179         void* e_ptr = untag_ptr(e);
12180         CHECK_ACCESS(e_ptr);
12181         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12182         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12183         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
12184         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
12185         return tag_ptr(ret_conv, true);
12186 }
12187
12188 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
12189         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
12190         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
12191         return ret_conv;
12192 }
12193
12194 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
12195         if (!ptr_is_owned(_res)) return;
12196         void* _res_ptr = untag_ptr(_res);
12197         CHECK_ACCESS(_res_ptr);
12198         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
12199         FREE(untag_ptr(_res));
12200         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
12201 }
12202
12203 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
12204         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
12205         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
12206         return tag_ptr(ret_conv, true);
12207 }
12208 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
12209         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
12210         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
12211         return ret_conv;
12212 }
12213
12214 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
12215         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
12216         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
12217         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
12218         return tag_ptr(ret_conv, true);
12219 }
12220
12221 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
12222         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
12223         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
12224         *ret_copy = COption_HTLCClaimZ_some(o_conv);
12225         uint64_t ret_ref = tag_ptr(ret_copy, true);
12226         return ret_ref;
12227 }
12228
12229 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
12230         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
12231         *ret_copy = COption_HTLCClaimZ_none();
12232         uint64_t ret_ref = tag_ptr(ret_copy, true);
12233         return ret_ref;
12234 }
12235
12236 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
12237         if (!ptr_is_owned(_res)) return;
12238         void* _res_ptr = untag_ptr(_res);
12239         CHECK_ACCESS(_res_ptr);
12240         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
12241         FREE(untag_ptr(_res));
12242         COption_HTLCClaimZ_free(_res_conv);
12243 }
12244
12245 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
12246         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12247         *ret_conv = CResult_NoneNoneZ_ok();
12248         return tag_ptr(ret_conv, true);
12249 }
12250
12251 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
12252         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12253         *ret_conv = CResult_NoneNoneZ_err();
12254         return tag_ptr(ret_conv, true);
12255 }
12256
12257 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
12258         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
12259         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
12260         return ret_conv;
12261 }
12262
12263 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
12264         if (!ptr_is_owned(_res)) return;
12265         void* _res_ptr = untag_ptr(_res);
12266         CHECK_ACCESS(_res_ptr);
12267         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
12268         FREE(untag_ptr(_res));
12269         CResult_NoneNoneZ_free(_res_conv);
12270 }
12271
12272 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
12273         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12274         *ret_conv = CResult_NoneNoneZ_clone(arg);
12275         return tag_ptr(ret_conv, true);
12276 }
12277 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
12278         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
12279         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
12280         return ret_conv;
12281 }
12282
12283 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
12284         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
12285         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12286         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
12287         return tag_ptr(ret_conv, true);
12288 }
12289
12290 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
12291         LDKCounterpartyCommitmentSecrets o_conv;
12292         o_conv.inner = untag_ptr(o);
12293         o_conv.is_owned = ptr_is_owned(o);
12294         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12295         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
12296         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
12297         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
12298         return tag_ptr(ret_conv, true);
12299 }
12300
12301 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
12302         void* e_ptr = untag_ptr(e);
12303         CHECK_ACCESS(e_ptr);
12304         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12305         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12306         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
12307         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
12308         return tag_ptr(ret_conv, true);
12309 }
12310
12311 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
12312         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
12313         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
12314         return ret_conv;
12315 }
12316
12317 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
12318         if (!ptr_is_owned(_res)) return;
12319         void* _res_ptr = untag_ptr(_res);
12320         CHECK_ACCESS(_res_ptr);
12321         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
12322         FREE(untag_ptr(_res));
12323         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
12324 }
12325
12326 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
12327         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
12328         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
12329         return tag_ptr(ret_conv, true);
12330 }
12331 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
12332         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
12333         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
12334         return ret_conv;
12335 }
12336
12337 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
12338         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
12339         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
12340         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
12341         return tag_ptr(ret_conv, true);
12342 }
12343
12344 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
12345         LDKTxCreationKeys o_conv;
12346         o_conv.inner = untag_ptr(o);
12347         o_conv.is_owned = ptr_is_owned(o);
12348         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12349         o_conv = TxCreationKeys_clone(&o_conv);
12350         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
12351         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
12352         return tag_ptr(ret_conv, true);
12353 }
12354
12355 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
12356         void* e_ptr = untag_ptr(e);
12357         CHECK_ACCESS(e_ptr);
12358         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12359         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12360         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
12361         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
12362         return tag_ptr(ret_conv, true);
12363 }
12364
12365 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
12366         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
12367         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
12368         return ret_conv;
12369 }
12370
12371 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
12372         if (!ptr_is_owned(_res)) return;
12373         void* _res_ptr = untag_ptr(_res);
12374         CHECK_ACCESS(_res_ptr);
12375         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
12376         FREE(untag_ptr(_res));
12377         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
12378 }
12379
12380 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
12381         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
12382         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
12383         return tag_ptr(ret_conv, true);
12384 }
12385 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
12386         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
12387         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
12388         return ret_conv;
12389 }
12390
12391 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
12392         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
12393         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
12394         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
12395         return tag_ptr(ret_conv, true);
12396 }
12397
12398 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
12399         LDKChannelPublicKeys o_conv;
12400         o_conv.inner = untag_ptr(o);
12401         o_conv.is_owned = ptr_is_owned(o);
12402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12403         o_conv = ChannelPublicKeys_clone(&o_conv);
12404         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
12405         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
12406         return tag_ptr(ret_conv, true);
12407 }
12408
12409 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
12410         void* e_ptr = untag_ptr(e);
12411         CHECK_ACCESS(e_ptr);
12412         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12413         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12414         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
12415         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
12416         return tag_ptr(ret_conv, true);
12417 }
12418
12419 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
12420         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
12421         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
12422         return ret_conv;
12423 }
12424
12425 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
12426         if (!ptr_is_owned(_res)) return;
12427         void* _res_ptr = untag_ptr(_res);
12428         CHECK_ACCESS(_res_ptr);
12429         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
12430         FREE(untag_ptr(_res));
12431         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
12432 }
12433
12434 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
12435         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
12436         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
12437         return tag_ptr(ret_conv, true);
12438 }
12439 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
12440         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
12441         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
12442         return ret_conv;
12443 }
12444
12445 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
12446         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
12447         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
12448         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
12449         return tag_ptr(ret_conv, true);
12450 }
12451
12452 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
12453         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12454         *ret_copy = COption_u32Z_some(o);
12455         uint64_t ret_ref = tag_ptr(ret_copy, true);
12456         return ret_ref;
12457 }
12458
12459 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
12460         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12461         *ret_copy = COption_u32Z_none();
12462         uint64_t ret_ref = tag_ptr(ret_copy, true);
12463         return ret_ref;
12464 }
12465
12466 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
12467         if (!ptr_is_owned(_res)) return;
12468         void* _res_ptr = untag_ptr(_res);
12469         CHECK_ACCESS(_res_ptr);
12470         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
12471         FREE(untag_ptr(_res));
12472         COption_u32Z_free(_res_conv);
12473 }
12474
12475 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
12476         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12477         *ret_copy = COption_u32Z_clone(arg);
12478         uint64_t ret_ref = tag_ptr(ret_copy, true);
12479         return ret_ref;
12480 }
12481 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
12482         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
12483         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
12484         return ret_conv;
12485 }
12486
12487 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
12488         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
12489         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12490         *ret_copy = COption_u32Z_clone(orig_conv);
12491         uint64_t ret_ref = tag_ptr(ret_copy, true);
12492         return ret_ref;
12493 }
12494
12495 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
12496         LDKHTLCOutputInCommitment o_conv;
12497         o_conv.inner = untag_ptr(o);
12498         o_conv.is_owned = ptr_is_owned(o);
12499         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12500         o_conv = HTLCOutputInCommitment_clone(&o_conv);
12501         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12502         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
12503         return tag_ptr(ret_conv, true);
12504 }
12505
12506 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
12507         void* e_ptr = untag_ptr(e);
12508         CHECK_ACCESS(e_ptr);
12509         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12510         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12511         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12512         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
12513         return tag_ptr(ret_conv, true);
12514 }
12515
12516 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
12517         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
12518         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
12519         return ret_conv;
12520 }
12521
12522 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
12523         if (!ptr_is_owned(_res)) return;
12524         void* _res_ptr = untag_ptr(_res);
12525         CHECK_ACCESS(_res_ptr);
12526         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
12527         FREE(untag_ptr(_res));
12528         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
12529 }
12530
12531 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
12532         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12533         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
12534         return tag_ptr(ret_conv, true);
12535 }
12536 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
12537         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
12538         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
12539         return ret_conv;
12540 }
12541
12542 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
12543         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
12544         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12545         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
12546         return tag_ptr(ret_conv, true);
12547 }
12548
12549 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
12550         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
12551         return ret_conv;
12552 }
12553
12554 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
12555         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
12556         return ret_conv;
12557 }
12558
12559 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
12560         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
12561         COption_NoneZ_free(_res_conv);
12562 }
12563
12564 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12565         LDKCounterpartyChannelTransactionParameters o_conv;
12566         o_conv.inner = untag_ptr(o);
12567         o_conv.is_owned = ptr_is_owned(o);
12568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12569         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
12570         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12571         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12572         return tag_ptr(ret_conv, true);
12573 }
12574
12575 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12576         void* e_ptr = untag_ptr(e);
12577         CHECK_ACCESS(e_ptr);
12578         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12579         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12580         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12581         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
12582         return tag_ptr(ret_conv, true);
12583 }
12584
12585 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12586         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12587         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12588         return ret_conv;
12589 }
12590
12591 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12592         if (!ptr_is_owned(_res)) return;
12593         void* _res_ptr = untag_ptr(_res);
12594         CHECK_ACCESS(_res_ptr);
12595         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12596         FREE(untag_ptr(_res));
12597         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12598 }
12599
12600 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12601         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12602         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
12603         return tag_ptr(ret_conv, true);
12604 }
12605 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12606         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12607         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12608         return ret_conv;
12609 }
12610
12611 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12612         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12613         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12614         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12615         return tag_ptr(ret_conv, true);
12616 }
12617
12618 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12619         LDKChannelTransactionParameters o_conv;
12620         o_conv.inner = untag_ptr(o);
12621         o_conv.is_owned = ptr_is_owned(o);
12622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12623         o_conv = ChannelTransactionParameters_clone(&o_conv);
12624         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12625         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12626         return tag_ptr(ret_conv, true);
12627 }
12628
12629 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12630         void* e_ptr = untag_ptr(e);
12631         CHECK_ACCESS(e_ptr);
12632         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12633         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12634         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12635         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
12636         return tag_ptr(ret_conv, true);
12637 }
12638
12639 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12640         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12641         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12642         return ret_conv;
12643 }
12644
12645 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12646         if (!ptr_is_owned(_res)) return;
12647         void* _res_ptr = untag_ptr(_res);
12648         CHECK_ACCESS(_res_ptr);
12649         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12650         FREE(untag_ptr(_res));
12651         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12652 }
12653
12654 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12655         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12656         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
12657         return tag_ptr(ret_conv, true);
12658 }
12659 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12660         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12661         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12662         return ret_conv;
12663 }
12664
12665 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12666         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12667         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12668         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12669         return tag_ptr(ret_conv, true);
12670 }
12671
12672 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
12673         LDKCVec_SignatureZ _res_constr;
12674         _res_constr.datalen = _res->arr_len;
12675         if (_res_constr.datalen > 0)
12676                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12677         else
12678                 _res_constr.data = NULL;
12679         int8_tArray* _res_vals = (void*) _res->elems;
12680         for (size_t m = 0; m < _res_constr.datalen; m++) {
12681                 int8_tArray _res_conv_12 = _res_vals[m];
12682                 LDKSignature _res_conv_12_ref;
12683                 CHECK(_res_conv_12->arr_len == 64);
12684                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
12685                 _res_constr.data[m] = _res_conv_12_ref;
12686         }
12687         FREE(_res);
12688         CVec_SignatureZ_free(_res_constr);
12689 }
12690
12691 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12692         LDKHolderCommitmentTransaction o_conv;
12693         o_conv.inner = untag_ptr(o);
12694         o_conv.is_owned = ptr_is_owned(o);
12695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12696         o_conv = HolderCommitmentTransaction_clone(&o_conv);
12697         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12698         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
12699         return tag_ptr(ret_conv, true);
12700 }
12701
12702 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12703         void* e_ptr = untag_ptr(e);
12704         CHECK_ACCESS(e_ptr);
12705         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12706         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12707         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12708         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
12709         return tag_ptr(ret_conv, true);
12710 }
12711
12712 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12713         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12714         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12715         return ret_conv;
12716 }
12717
12718 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12719         if (!ptr_is_owned(_res)) return;
12720         void* _res_ptr = untag_ptr(_res);
12721         CHECK_ACCESS(_res_ptr);
12722         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12723         FREE(untag_ptr(_res));
12724         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12725 }
12726
12727 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12728         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12729         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12730         return tag_ptr(ret_conv, true);
12731 }
12732 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12733         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12734         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12735         return ret_conv;
12736 }
12737
12738 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12739         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12740         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12741         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12742         return tag_ptr(ret_conv, true);
12743 }
12744
12745 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12746         LDKBuiltCommitmentTransaction o_conv;
12747         o_conv.inner = untag_ptr(o);
12748         o_conv.is_owned = ptr_is_owned(o);
12749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12750         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12751         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12752         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12753         return tag_ptr(ret_conv, true);
12754 }
12755
12756 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12757         void* e_ptr = untag_ptr(e);
12758         CHECK_ACCESS(e_ptr);
12759         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12760         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12761         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12762         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12763         return tag_ptr(ret_conv, true);
12764 }
12765
12766 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12767         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12768         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12769         return ret_conv;
12770 }
12771
12772 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12773         if (!ptr_is_owned(_res)) return;
12774         void* _res_ptr = untag_ptr(_res);
12775         CHECK_ACCESS(_res_ptr);
12776         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12777         FREE(untag_ptr(_res));
12778         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12779 }
12780
12781 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12782         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12783         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12784         return tag_ptr(ret_conv, true);
12785 }
12786 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12787         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12788         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12789         return ret_conv;
12790 }
12791
12792 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12793         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12794         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12795         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12796         return tag_ptr(ret_conv, true);
12797 }
12798
12799 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12800         LDKTrustedClosingTransaction o_conv;
12801         o_conv.inner = untag_ptr(o);
12802         o_conv.is_owned = ptr_is_owned(o);
12803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12804         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12805         
12806         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12807         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12808         return tag_ptr(ret_conv, true);
12809 }
12810
12811 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12812         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12813         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12814         return tag_ptr(ret_conv, true);
12815 }
12816
12817 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12818         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12819         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12820         return ret_conv;
12821 }
12822
12823 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12824         if (!ptr_is_owned(_res)) return;
12825         void* _res_ptr = untag_ptr(_res);
12826         CHECK_ACCESS(_res_ptr);
12827         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12828         FREE(untag_ptr(_res));
12829         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12830 }
12831
12832 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12833         LDKCommitmentTransaction o_conv;
12834         o_conv.inner = untag_ptr(o);
12835         o_conv.is_owned = ptr_is_owned(o);
12836         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12837         o_conv = CommitmentTransaction_clone(&o_conv);
12838         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12839         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12840         return tag_ptr(ret_conv, true);
12841 }
12842
12843 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12844         void* e_ptr = untag_ptr(e);
12845         CHECK_ACCESS(e_ptr);
12846         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12847         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12848         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12849         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12850         return tag_ptr(ret_conv, true);
12851 }
12852
12853 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12854         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12855         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12856         return ret_conv;
12857 }
12858
12859 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12860         if (!ptr_is_owned(_res)) return;
12861         void* _res_ptr = untag_ptr(_res);
12862         CHECK_ACCESS(_res_ptr);
12863         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12864         FREE(untag_ptr(_res));
12865         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12866 }
12867
12868 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12869         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12870         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12871         return tag_ptr(ret_conv, true);
12872 }
12873 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12874         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12875         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12876         return ret_conv;
12877 }
12878
12879 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12880         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12881         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12882         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12883         return tag_ptr(ret_conv, true);
12884 }
12885
12886 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12887         LDKTrustedCommitmentTransaction o_conv;
12888         o_conv.inner = untag_ptr(o);
12889         o_conv.is_owned = ptr_is_owned(o);
12890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12891         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12892         
12893         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12894         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12895         return tag_ptr(ret_conv, true);
12896 }
12897
12898 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12899         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12900         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12901         return tag_ptr(ret_conv, true);
12902 }
12903
12904 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12905         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12906         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12907         return ret_conv;
12908 }
12909
12910 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12911         if (!ptr_is_owned(_res)) return;
12912         void* _res_ptr = untag_ptr(_res);
12913         CHECK_ACCESS(_res_ptr);
12914         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12915         FREE(untag_ptr(_res));
12916         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12917 }
12918
12919 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12920         LDKCVec_SignatureZ o_constr;
12921         o_constr.datalen = o->arr_len;
12922         if (o_constr.datalen > 0)
12923                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12924         else
12925                 o_constr.data = NULL;
12926         int8_tArray* o_vals = (void*) o->elems;
12927         for (size_t m = 0; m < o_constr.datalen; m++) {
12928                 int8_tArray o_conv_12 = o_vals[m];
12929                 LDKSignature o_conv_12_ref;
12930                 CHECK(o_conv_12->arr_len == 64);
12931                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12932                 o_constr.data[m] = o_conv_12_ref;
12933         }
12934         FREE(o);
12935         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12936         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12937         return tag_ptr(ret_conv, true);
12938 }
12939
12940 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12941         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12942         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12943         return tag_ptr(ret_conv, true);
12944 }
12945
12946 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12947         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12948         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12949         return ret_conv;
12950 }
12951
12952 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12953         if (!ptr_is_owned(_res)) return;
12954         void* _res_ptr = untag_ptr(_res);
12955         CHECK_ACCESS(_res_ptr);
12956         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12957         FREE(untag_ptr(_res));
12958         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12959 }
12960
12961 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12962         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12963         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12964         return tag_ptr(ret_conv, true);
12965 }
12966 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12967         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12968         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12969         return ret_conv;
12970 }
12971
12972 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12973         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12974         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12975         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12976         return tag_ptr(ret_conv, true);
12977 }
12978
12979 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12980         LDKShutdownScript o_conv;
12981         o_conv.inner = untag_ptr(o);
12982         o_conv.is_owned = ptr_is_owned(o);
12983         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12984         o_conv = ShutdownScript_clone(&o_conv);
12985         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12986         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12987         return tag_ptr(ret_conv, true);
12988 }
12989
12990 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12991         void* e_ptr = untag_ptr(e);
12992         CHECK_ACCESS(e_ptr);
12993         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12994         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12995         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12996         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12997         return tag_ptr(ret_conv, true);
12998 }
12999
13000 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
13001         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
13002         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
13003         return ret_conv;
13004 }
13005
13006 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
13007         if (!ptr_is_owned(_res)) return;
13008         void* _res_ptr = untag_ptr(_res);
13009         CHECK_ACCESS(_res_ptr);
13010         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
13011         FREE(untag_ptr(_res));
13012         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
13013 }
13014
13015 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
13016         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
13017         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
13018         return tag_ptr(ret_conv, true);
13019 }
13020 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
13021         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
13022         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
13023         return ret_conv;
13024 }
13025
13026 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
13027         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
13028         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
13029         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
13030         return tag_ptr(ret_conv, true);
13031 }
13032
13033 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
13034         LDKShutdownScript o_conv;
13035         o_conv.inner = untag_ptr(o);
13036         o_conv.is_owned = ptr_is_owned(o);
13037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13038         o_conv = ShutdownScript_clone(&o_conv);
13039         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13040         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
13041         return tag_ptr(ret_conv, true);
13042 }
13043
13044 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
13045         LDKInvalidShutdownScript e_conv;
13046         e_conv.inner = untag_ptr(e);
13047         e_conv.is_owned = ptr_is_owned(e);
13048         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13049         e_conv = InvalidShutdownScript_clone(&e_conv);
13050         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13051         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
13052         return tag_ptr(ret_conv, true);
13053 }
13054
13055 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
13056         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
13057         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
13058         return ret_conv;
13059 }
13060
13061 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
13062         if (!ptr_is_owned(_res)) return;
13063         void* _res_ptr = untag_ptr(_res);
13064         CHECK_ACCESS(_res_ptr);
13065         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
13066         FREE(untag_ptr(_res));
13067         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
13068 }
13069
13070 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
13071         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13072         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
13073         return tag_ptr(ret_conv, true);
13074 }
13075 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
13076         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
13077         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
13078         return ret_conv;
13079 }
13080
13081 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
13082         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
13083         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13084         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
13085         return tag_ptr(ret_conv, true);
13086 }
13087
13088 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
13089         LDKBlindedPayInfo o_conv;
13090         o_conv.inner = untag_ptr(o);
13091         o_conv.is_owned = ptr_is_owned(o);
13092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13093         o_conv = BlindedPayInfo_clone(&o_conv);
13094         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
13095         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
13096         return tag_ptr(ret_conv, true);
13097 }
13098
13099 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
13100         void* e_ptr = untag_ptr(e);
13101         CHECK_ACCESS(e_ptr);
13102         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13103         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13104         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
13105         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
13106         return tag_ptr(ret_conv, true);
13107 }
13108
13109 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
13110         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
13111         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
13112         return ret_conv;
13113 }
13114
13115 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
13116         if (!ptr_is_owned(_res)) return;
13117         void* _res_ptr = untag_ptr(_res);
13118         CHECK_ACCESS(_res_ptr);
13119         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
13120         FREE(untag_ptr(_res));
13121         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
13122 }
13123
13124 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
13125         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
13126         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
13127         return tag_ptr(ret_conv, true);
13128 }
13129 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13130         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
13131         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
13132         return ret_conv;
13133 }
13134
13135 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
13136         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
13137         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
13138         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
13139         return tag_ptr(ret_conv, true);
13140 }
13141
13142 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
13143         LDKCVec_ChannelDetailsZ _res_constr;
13144         _res_constr.datalen = _res->arr_len;
13145         if (_res_constr.datalen > 0)
13146                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13147         else
13148                 _res_constr.data = NULL;
13149         uint64_t* _res_vals = _res->elems;
13150         for (size_t q = 0; q < _res_constr.datalen; q++) {
13151                 uint64_t _res_conv_16 = _res_vals[q];
13152                 LDKChannelDetails _res_conv_16_conv;
13153                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
13154                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
13155                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
13156                 _res_constr.data[q] = _res_conv_16_conv;
13157         }
13158         FREE(_res);
13159         CVec_ChannelDetailsZ_free(_res_constr);
13160 }
13161
13162 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
13163         LDKRoute o_conv;
13164         o_conv.inner = untag_ptr(o);
13165         o_conv.is_owned = ptr_is_owned(o);
13166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13167         o_conv = Route_clone(&o_conv);
13168         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13169         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
13170         return tag_ptr(ret_conv, true);
13171 }
13172
13173 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
13174         LDKLightningError e_conv;
13175         e_conv.inner = untag_ptr(e);
13176         e_conv.is_owned = ptr_is_owned(e);
13177         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13178         e_conv = LightningError_clone(&e_conv);
13179         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13180         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
13181         return tag_ptr(ret_conv, true);
13182 }
13183
13184 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
13185         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
13186         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
13187         return ret_conv;
13188 }
13189
13190 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
13191         if (!ptr_is_owned(_res)) return;
13192         void* _res_ptr = untag_ptr(_res);
13193         CHECK_ACCESS(_res_ptr);
13194         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
13195         FREE(untag_ptr(_res));
13196         CResult_RouteLightningErrorZ_free(_res_conv);
13197 }
13198
13199 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
13200         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13201         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
13202         return tag_ptr(ret_conv, true);
13203 }
13204 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
13205         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
13206         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
13207         return ret_conv;
13208 }
13209
13210 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
13211         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
13212         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13213         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
13214         return tag_ptr(ret_conv, true);
13215 }
13216
13217 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
13218         LDKInFlightHtlcs o_conv;
13219         o_conv.inner = untag_ptr(o);
13220         o_conv.is_owned = ptr_is_owned(o);
13221         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13222         o_conv = InFlightHtlcs_clone(&o_conv);
13223         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13224         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
13225         return tag_ptr(ret_conv, true);
13226 }
13227
13228 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
13229         void* e_ptr = untag_ptr(e);
13230         CHECK_ACCESS(e_ptr);
13231         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13232         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13233         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13234         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
13235         return tag_ptr(ret_conv, true);
13236 }
13237
13238 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
13239         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
13240         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
13241         return ret_conv;
13242 }
13243
13244 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
13245         if (!ptr_is_owned(_res)) return;
13246         void* _res_ptr = untag_ptr(_res);
13247         CHECK_ACCESS(_res_ptr);
13248         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
13249         FREE(untag_ptr(_res));
13250         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
13251 }
13252
13253 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
13254         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13255         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
13256         return tag_ptr(ret_conv, true);
13257 }
13258 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
13259         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
13260         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
13261         return ret_conv;
13262 }
13263
13264 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
13265         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
13266         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13267         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
13268         return tag_ptr(ret_conv, true);
13269 }
13270
13271 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
13272         LDKRouteHop o_conv;
13273         o_conv.inner = untag_ptr(o);
13274         o_conv.is_owned = ptr_is_owned(o);
13275         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13276         o_conv = RouteHop_clone(&o_conv);
13277         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13278         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
13279         return tag_ptr(ret_conv, true);
13280 }
13281
13282 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
13283         void* e_ptr = untag_ptr(e);
13284         CHECK_ACCESS(e_ptr);
13285         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13286         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13287         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13288         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
13289         return tag_ptr(ret_conv, true);
13290 }
13291
13292 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
13293         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
13294         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
13295         return ret_conv;
13296 }
13297
13298 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
13299         if (!ptr_is_owned(_res)) return;
13300         void* _res_ptr = untag_ptr(_res);
13301         CHECK_ACCESS(_res_ptr);
13302         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
13303         FREE(untag_ptr(_res));
13304         CResult_RouteHopDecodeErrorZ_free(_res_conv);
13305 }
13306
13307 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
13308         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13309         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
13310         return tag_ptr(ret_conv, true);
13311 }
13312 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13313         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
13314         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
13315         return ret_conv;
13316 }
13317
13318 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
13319         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
13320         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13321         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
13322         return tag_ptr(ret_conv, true);
13323 }
13324
13325 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
13326         LDKCVec_BlindedHopZ _res_constr;
13327         _res_constr.datalen = _res->arr_len;
13328         if (_res_constr.datalen > 0)
13329                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
13330         else
13331                 _res_constr.data = NULL;
13332         uint64_t* _res_vals = _res->elems;
13333         for (size_t m = 0; m < _res_constr.datalen; m++) {
13334                 uint64_t _res_conv_12 = _res_vals[m];
13335                 LDKBlindedHop _res_conv_12_conv;
13336                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
13337                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
13338                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
13339                 _res_constr.data[m] = _res_conv_12_conv;
13340         }
13341         FREE(_res);
13342         CVec_BlindedHopZ_free(_res_constr);
13343 }
13344
13345 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
13346         LDKBlindedTail o_conv;
13347         o_conv.inner = untag_ptr(o);
13348         o_conv.is_owned = ptr_is_owned(o);
13349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13350         o_conv = BlindedTail_clone(&o_conv);
13351         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
13352         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
13353         return tag_ptr(ret_conv, true);
13354 }
13355
13356 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
13357         void* e_ptr = untag_ptr(e);
13358         CHECK_ACCESS(e_ptr);
13359         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13360         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13361         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
13362         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
13363         return tag_ptr(ret_conv, true);
13364 }
13365
13366 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
13367         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
13368         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
13369         return ret_conv;
13370 }
13371
13372 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
13373         if (!ptr_is_owned(_res)) return;
13374         void* _res_ptr = untag_ptr(_res);
13375         CHECK_ACCESS(_res_ptr);
13376         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
13377         FREE(untag_ptr(_res));
13378         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
13379 }
13380
13381 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
13382         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
13383         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
13384         return tag_ptr(ret_conv, true);
13385 }
13386 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
13387         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
13388         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
13389         return ret_conv;
13390 }
13391
13392 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
13393         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
13394         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
13395         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
13396         return tag_ptr(ret_conv, true);
13397 }
13398
13399 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
13400         LDKCVec_RouteHopZ _res_constr;
13401         _res_constr.datalen = _res->arr_len;
13402         if (_res_constr.datalen > 0)
13403                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13404         else
13405                 _res_constr.data = NULL;
13406         uint64_t* _res_vals = _res->elems;
13407         for (size_t k = 0; k < _res_constr.datalen; k++) {
13408                 uint64_t _res_conv_10 = _res_vals[k];
13409                 LDKRouteHop _res_conv_10_conv;
13410                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
13411                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
13412                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
13413                 _res_constr.data[k] = _res_conv_10_conv;
13414         }
13415         FREE(_res);
13416         CVec_RouteHopZ_free(_res_constr);
13417 }
13418
13419 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
13420         LDKCVec_PathZ _res_constr;
13421         _res_constr.datalen = _res->arr_len;
13422         if (_res_constr.datalen > 0)
13423                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
13424         else
13425                 _res_constr.data = NULL;
13426         uint64_t* _res_vals = _res->elems;
13427         for (size_t g = 0; g < _res_constr.datalen; g++) {
13428                 uint64_t _res_conv_6 = _res_vals[g];
13429                 LDKPath _res_conv_6_conv;
13430                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
13431                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
13432                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
13433                 _res_constr.data[g] = _res_conv_6_conv;
13434         }
13435         FREE(_res);
13436         CVec_PathZ_free(_res_constr);
13437 }
13438
13439 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
13440         LDKRoute o_conv;
13441         o_conv.inner = untag_ptr(o);
13442         o_conv.is_owned = ptr_is_owned(o);
13443         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13444         o_conv = Route_clone(&o_conv);
13445         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13446         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
13447         return tag_ptr(ret_conv, true);
13448 }
13449
13450 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
13451         void* e_ptr = untag_ptr(e);
13452         CHECK_ACCESS(e_ptr);
13453         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13454         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13455         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13456         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
13457         return tag_ptr(ret_conv, true);
13458 }
13459
13460 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
13461         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
13462         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
13463         return ret_conv;
13464 }
13465
13466 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
13467         if (!ptr_is_owned(_res)) return;
13468         void* _res_ptr = untag_ptr(_res);
13469         CHECK_ACCESS(_res_ptr);
13470         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
13471         FREE(untag_ptr(_res));
13472         CResult_RouteDecodeErrorZ_free(_res_conv);
13473 }
13474
13475 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
13476         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13477         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
13478         return tag_ptr(ret_conv, true);
13479 }
13480 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
13481         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
13482         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
13483         return ret_conv;
13484 }
13485
13486 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
13487         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
13488         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13489         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
13490         return tag_ptr(ret_conv, true);
13491 }
13492
13493 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
13494         LDKRouteParameters o_conv;
13495         o_conv.inner = untag_ptr(o);
13496         o_conv.is_owned = ptr_is_owned(o);
13497         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13498         o_conv = RouteParameters_clone(&o_conv);
13499         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13500         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
13501         return tag_ptr(ret_conv, true);
13502 }
13503
13504 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
13505         void* e_ptr = untag_ptr(e);
13506         CHECK_ACCESS(e_ptr);
13507         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13508         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13509         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13510         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
13511         return tag_ptr(ret_conv, true);
13512 }
13513
13514 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
13515         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
13516         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
13517         return ret_conv;
13518 }
13519
13520 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
13521         if (!ptr_is_owned(_res)) return;
13522         void* _res_ptr = untag_ptr(_res);
13523         CHECK_ACCESS(_res_ptr);
13524         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
13525         FREE(untag_ptr(_res));
13526         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
13527 }
13528
13529 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
13530         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13531         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
13532         return tag_ptr(ret_conv, true);
13533 }
13534 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13535         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
13536         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
13537         return ret_conv;
13538 }
13539
13540 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
13541         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
13542         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13543         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
13544         return tag_ptr(ret_conv, true);
13545 }
13546
13547 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
13548         LDKCVec_u64Z _res_constr;
13549         _res_constr.datalen = _res->arr_len;
13550         if (_res_constr.datalen > 0)
13551                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13552         else
13553                 _res_constr.data = NULL;
13554         int64_t* _res_vals = _res->elems;
13555         for (size_t i = 0; i < _res_constr.datalen; i++) {
13556                 int64_t _res_conv_8 = _res_vals[i];
13557                 _res_constr.data[i] = _res_conv_8;
13558         }
13559         FREE(_res);
13560         CVec_u64Z_free(_res_constr);
13561 }
13562
13563 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
13564         LDKPaymentParameters o_conv;
13565         o_conv.inner = untag_ptr(o);
13566         o_conv.is_owned = ptr_is_owned(o);
13567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13568         o_conv = PaymentParameters_clone(&o_conv);
13569         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13570         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
13571         return tag_ptr(ret_conv, true);
13572 }
13573
13574 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
13575         void* e_ptr = untag_ptr(e);
13576         CHECK_ACCESS(e_ptr);
13577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13579         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13580         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
13581         return tag_ptr(ret_conv, true);
13582 }
13583
13584 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
13585         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
13586         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
13587         return ret_conv;
13588 }
13589
13590 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
13591         if (!ptr_is_owned(_res)) return;
13592         void* _res_ptr = untag_ptr(_res);
13593         CHECK_ACCESS(_res_ptr);
13594         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
13595         FREE(untag_ptr(_res));
13596         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
13597 }
13598
13599 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
13600         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13601         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
13602         return tag_ptr(ret_conv, true);
13603 }
13604 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13605         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
13606         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
13607         return ret_conv;
13608 }
13609
13610 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
13611         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
13612         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13613         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
13614         return tag_ptr(ret_conv, true);
13615 }
13616
13617 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
13618         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13619         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
13620         return tag_ptr(ret_conv, true);
13621 }
13622 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
13623         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
13624         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
13625         return ret_conv;
13626 }
13627
13628 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
13629         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
13630         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13631         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
13632         return tag_ptr(ret_conv, true);
13633 }
13634
13635 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
13636         LDKBlindedPayInfo a_conv;
13637         a_conv.inner = untag_ptr(a);
13638         a_conv.is_owned = ptr_is_owned(a);
13639         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13640         a_conv = BlindedPayInfo_clone(&a_conv);
13641         LDKBlindedPath b_conv;
13642         b_conv.inner = untag_ptr(b);
13643         b_conv.is_owned = ptr_is_owned(b);
13644         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13645         b_conv = BlindedPath_clone(&b_conv);
13646         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13647         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
13648         return tag_ptr(ret_conv, true);
13649 }
13650
13651 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
13652         if (!ptr_is_owned(_res)) return;
13653         void* _res_ptr = untag_ptr(_res);
13654         CHECK_ACCESS(_res_ptr);
13655         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
13656         FREE(untag_ptr(_res));
13657         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
13658 }
13659
13660 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
13661         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
13662         _res_constr.datalen = _res->arr_len;
13663         if (_res_constr.datalen > 0)
13664                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
13665         else
13666                 _res_constr.data = NULL;
13667         uint64_t* _res_vals = _res->elems;
13668         for (size_t l = 0; l < _res_constr.datalen; l++) {
13669                 uint64_t _res_conv_37 = _res_vals[l];
13670                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
13671                 CHECK_ACCESS(_res_conv_37_ptr);
13672                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
13673                 FREE(untag_ptr(_res_conv_37));
13674                 _res_constr.data[l] = _res_conv_37_conv;
13675         }
13676         FREE(_res);
13677         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
13678 }
13679
13680 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
13681         LDKCVec_RouteHintZ _res_constr;
13682         _res_constr.datalen = _res->arr_len;
13683         if (_res_constr.datalen > 0)
13684                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13685         else
13686                 _res_constr.data = NULL;
13687         uint64_t* _res_vals = _res->elems;
13688         for (size_t l = 0; l < _res_constr.datalen; l++) {
13689                 uint64_t _res_conv_11 = _res_vals[l];
13690                 LDKRouteHint _res_conv_11_conv;
13691                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
13692                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
13693                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
13694                 _res_constr.data[l] = _res_conv_11_conv;
13695         }
13696         FREE(_res);
13697         CVec_RouteHintZ_free(_res_constr);
13698 }
13699
13700 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
13701         LDKCVec_RouteHintHopZ _res_constr;
13702         _res_constr.datalen = _res->arr_len;
13703         if (_res_constr.datalen > 0)
13704                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
13705         else
13706                 _res_constr.data = NULL;
13707         uint64_t* _res_vals = _res->elems;
13708         for (size_t o = 0; o < _res_constr.datalen; o++) {
13709                 uint64_t _res_conv_14 = _res_vals[o];
13710                 LDKRouteHintHop _res_conv_14_conv;
13711                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
13712                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
13713                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
13714                 _res_constr.data[o] = _res_conv_14_conv;
13715         }
13716         FREE(_res);
13717         CVec_RouteHintHopZ_free(_res_constr);
13718 }
13719
13720 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
13721         LDKRouteHint o_conv;
13722         o_conv.inner = untag_ptr(o);
13723         o_conv.is_owned = ptr_is_owned(o);
13724         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13725         o_conv = RouteHint_clone(&o_conv);
13726         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13727         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
13728         return tag_ptr(ret_conv, true);
13729 }
13730
13731 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
13732         void* e_ptr = untag_ptr(e);
13733         CHECK_ACCESS(e_ptr);
13734         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13735         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13736         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13737         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
13738         return tag_ptr(ret_conv, true);
13739 }
13740
13741 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
13742         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
13743         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
13744         return ret_conv;
13745 }
13746
13747 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
13748         if (!ptr_is_owned(_res)) return;
13749         void* _res_ptr = untag_ptr(_res);
13750         CHECK_ACCESS(_res_ptr);
13751         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
13752         FREE(untag_ptr(_res));
13753         CResult_RouteHintDecodeErrorZ_free(_res_conv);
13754 }
13755
13756 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
13757         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13758         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
13759         return tag_ptr(ret_conv, true);
13760 }
13761 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
13762         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
13763         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
13764         return ret_conv;
13765 }
13766
13767 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
13768         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
13769         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13770         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
13771         return tag_ptr(ret_conv, true);
13772 }
13773
13774 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
13775         LDKRouteHintHop o_conv;
13776         o_conv.inner = untag_ptr(o);
13777         o_conv.is_owned = ptr_is_owned(o);
13778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13779         o_conv = RouteHintHop_clone(&o_conv);
13780         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13781         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
13782         return tag_ptr(ret_conv, true);
13783 }
13784
13785 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
13786         void* e_ptr = untag_ptr(e);
13787         CHECK_ACCESS(e_ptr);
13788         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13789         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13790         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13791         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
13792         return tag_ptr(ret_conv, true);
13793 }
13794
13795 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
13796         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
13797         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
13798         return ret_conv;
13799 }
13800
13801 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
13802         if (!ptr_is_owned(_res)) return;
13803         void* _res_ptr = untag_ptr(_res);
13804         CHECK_ACCESS(_res_ptr);
13805         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
13806         FREE(untag_ptr(_res));
13807         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
13808 }
13809
13810 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
13811         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13812         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
13813         return tag_ptr(ret_conv, true);
13814 }
13815 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13816         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
13817         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
13818         return ret_conv;
13819 }
13820
13821 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
13822         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
13823         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13824         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
13825         return tag_ptr(ret_conv, true);
13826 }
13827
13828 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
13829         LDKCVec_PublicKeyZ _res_constr;
13830         _res_constr.datalen = _res->arr_len;
13831         if (_res_constr.datalen > 0)
13832                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13833         else
13834                 _res_constr.data = NULL;
13835         int8_tArray* _res_vals = (void*) _res->elems;
13836         for (size_t m = 0; m < _res_constr.datalen; m++) {
13837                 int8_tArray _res_conv_12 = _res_vals[m];
13838                 LDKPublicKey _res_conv_12_ref;
13839                 CHECK(_res_conv_12->arr_len == 33);
13840                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
13841                 _res_constr.data[m] = _res_conv_12_ref;
13842         }
13843         FREE(_res);
13844         CVec_PublicKeyZ_free(_res_constr);
13845 }
13846
13847 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13848         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13849         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13850         return tag_ptr(ret_conv, true);
13851 }
13852 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
13853         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
13854         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13855         return ret_conv;
13856 }
13857
13858 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
13859         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
13860         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13861         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13862         return tag_ptr(ret_conv, true);
13863 }
13864
13865 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
13866         LDKTransaction b_ref;
13867         b_ref.datalen = b->arr_len;
13868         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13869         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
13870         b_ref.data_is_owned = true;
13871         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13872         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13873         return tag_ptr(ret_conv, true);
13874 }
13875
13876 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
13877         if (!ptr_is_owned(_res)) return;
13878         void* _res_ptr = untag_ptr(_res);
13879         CHECK_ACCESS(_res_ptr);
13880         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13881         FREE(untag_ptr(_res));
13882         C2Tuple_usizeTransactionZ_free(_res_conv);
13883 }
13884
13885 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
13886         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13887         _res_constr.datalen = _res->arr_len;
13888         if (_res_constr.datalen > 0)
13889                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13890         else
13891                 _res_constr.data = NULL;
13892         uint64_t* _res_vals = _res->elems;
13893         for (size_t c = 0; c < _res_constr.datalen; c++) {
13894                 uint64_t _res_conv_28 = _res_vals[c];
13895                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
13896                 CHECK_ACCESS(_res_conv_28_ptr);
13897                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13898                 FREE(untag_ptr(_res_conv_28));
13899                 _res_constr.data[c] = _res_conv_28_conv;
13900         }
13901         FREE(_res);
13902         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13903 }
13904
13905 static inline uint64_t C2Tuple_TxidBlockHashZ_clone_ptr(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR arg) {
13906         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13907         *ret_conv = C2Tuple_TxidBlockHashZ_clone(arg);
13908         return tag_ptr(ret_conv, true);
13909 }
13910 int64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone_ptr"))) TS_C2Tuple_TxidBlockHashZ_clone_ptr(uint64_t arg) {
13911         LDKC2Tuple_TxidBlockHashZ* arg_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(arg);
13912         int64_t ret_conv = C2Tuple_TxidBlockHashZ_clone_ptr(arg_conv);
13913         return ret_conv;
13914 }
13915
13916 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone"))) TS_C2Tuple_TxidBlockHashZ_clone(uint64_t orig) {
13917         LDKC2Tuple_TxidBlockHashZ* orig_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(orig);
13918         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13919         *ret_conv = C2Tuple_TxidBlockHashZ_clone(orig_conv);
13920         return tag_ptr(ret_conv, true);
13921 }
13922
13923 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_new"))) TS_C2Tuple_TxidBlockHashZ_new(int8_tArray a, int8_tArray b) {
13924         LDKThirtyTwoBytes a_ref;
13925         CHECK(a->arr_len == 32);
13926         memcpy(a_ref.data, a->elems, 32); FREE(a);
13927         LDKThirtyTwoBytes b_ref;
13928         CHECK(b->arr_len == 32);
13929         memcpy(b_ref.data, b->elems, 32); FREE(b);
13930         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13931         *ret_conv = C2Tuple_TxidBlockHashZ_new(a_ref, b_ref);
13932         return tag_ptr(ret_conv, true);
13933 }
13934
13935 void  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_free"))) TS_C2Tuple_TxidBlockHashZ_free(uint64_t _res) {
13936         if (!ptr_is_owned(_res)) return;
13937         void* _res_ptr = untag_ptr(_res);
13938         CHECK_ACCESS(_res_ptr);
13939         LDKC2Tuple_TxidBlockHashZ _res_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_ptr);
13940         FREE(untag_ptr(_res));
13941         C2Tuple_TxidBlockHashZ_free(_res_conv);
13942 }
13943
13944 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidBlockHashZZ_free"))) TS_CVec_C2Tuple_TxidBlockHashZZ_free(uint64_tArray _res) {
13945         LDKCVec_C2Tuple_TxidBlockHashZZ _res_constr;
13946         _res_constr.datalen = _res->arr_len;
13947         if (_res_constr.datalen > 0)
13948                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
13949         else
13950                 _res_constr.data = NULL;
13951         uint64_t* _res_vals = _res->elems;
13952         for (size_t z = 0; z < _res_constr.datalen; z++) {
13953                 uint64_t _res_conv_25 = _res_vals[z];
13954                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
13955                 CHECK_ACCESS(_res_conv_25_ptr);
13956                 LDKC2Tuple_TxidBlockHashZ _res_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_conv_25_ptr);
13957                 FREE(untag_ptr(_res_conv_25));
13958                 _res_constr.data[z] = _res_conv_25_conv;
13959         }
13960         FREE(_res);
13961         CVec_C2Tuple_TxidBlockHashZZ_free(_res_constr);
13962 }
13963
13964 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
13965         LDKCVec_MonitorEventZ _res_constr;
13966         _res_constr.datalen = _res->arr_len;
13967         if (_res_constr.datalen > 0)
13968                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13969         else
13970                 _res_constr.data = NULL;
13971         uint64_t* _res_vals = _res->elems;
13972         for (size_t o = 0; o < _res_constr.datalen; o++) {
13973                 uint64_t _res_conv_14 = _res_vals[o];
13974                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
13975                 CHECK_ACCESS(_res_conv_14_ptr);
13976                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13977                 FREE(untag_ptr(_res_conv_14));
13978                 _res_constr.data[o] = _res_conv_14_conv;
13979         }
13980         FREE(_res);
13981         CVec_MonitorEventZ_free(_res_constr);
13982 }
13983
13984 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
13985         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13986         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
13987         return tag_ptr(ret_conv, true);
13988 }
13989 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
13990         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
13991         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
13992         return ret_conv;
13993 }
13994
13995 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
13996         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
13997         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13998         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
13999         return tag_ptr(ret_conv, true);
14000 }
14001
14002 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
14003         LDKOutPoint a_conv;
14004         a_conv.inner = untag_ptr(a);
14005         a_conv.is_owned = ptr_is_owned(a);
14006         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14007         a_conv = OutPoint_clone(&a_conv);
14008         LDKCVec_MonitorEventZ b_constr;
14009         b_constr.datalen = b->arr_len;
14010         if (b_constr.datalen > 0)
14011                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14012         else
14013                 b_constr.data = NULL;
14014         uint64_t* b_vals = b->elems;
14015         for (size_t o = 0; o < b_constr.datalen; o++) {
14016                 uint64_t b_conv_14 = b_vals[o];
14017                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
14018                 CHECK_ACCESS(b_conv_14_ptr);
14019                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
14020                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
14021                 b_constr.data[o] = b_conv_14_conv;
14022         }
14023         FREE(b);
14024         LDKPublicKey c_ref;
14025         CHECK(c->arr_len == 33);
14026         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
14027         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14028         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
14029         return tag_ptr(ret_conv, true);
14030 }
14031
14032 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
14033         if (!ptr_is_owned(_res)) return;
14034         void* _res_ptr = untag_ptr(_res);
14035         CHECK_ACCESS(_res_ptr);
14036         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
14037         FREE(untag_ptr(_res));
14038         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
14039 }
14040
14041 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
14042         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
14043         _res_constr.datalen = _res->arr_len;
14044         if (_res_constr.datalen > 0)
14045                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
14046         else
14047                 _res_constr.data = NULL;
14048         uint64_t* _res_vals = _res->elems;
14049         for (size_t x = 0; x < _res_constr.datalen; x++) {
14050                 uint64_t _res_conv_49 = _res_vals[x];
14051                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
14052                 CHECK_ACCESS(_res_conv_49_ptr);
14053                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
14054                 FREE(untag_ptr(_res_conv_49));
14055                 _res_constr.data[x] = _res_conv_49_conv;
14056         }
14057         FREE(_res);
14058         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
14059 }
14060
14061 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
14062         LDKFixedPenaltyScorer o_conv;
14063         o_conv.inner = untag_ptr(o);
14064         o_conv.is_owned = ptr_is_owned(o);
14065         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14066         o_conv = FixedPenaltyScorer_clone(&o_conv);
14067         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14068         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
14069         return tag_ptr(ret_conv, true);
14070 }
14071
14072 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
14073         void* e_ptr = untag_ptr(e);
14074         CHECK_ACCESS(e_ptr);
14075         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14076         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14077         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14078         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
14079         return tag_ptr(ret_conv, true);
14080 }
14081
14082 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
14083         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
14084         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
14085         return ret_conv;
14086 }
14087
14088 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
14089         if (!ptr_is_owned(_res)) return;
14090         void* _res_ptr = untag_ptr(_res);
14091         CHECK_ACCESS(_res_ptr);
14092         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
14093         FREE(untag_ptr(_res));
14094         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
14095 }
14096
14097 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
14098         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14099         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
14100         return tag_ptr(ret_conv, true);
14101 }
14102 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
14103         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
14104         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
14105         return ret_conv;
14106 }
14107
14108 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
14109         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
14110         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14111         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
14112         return tag_ptr(ret_conv, true);
14113 }
14114
14115 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
14116         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14117         *ret_conv = C2Tuple_u64u64Z_clone(arg);
14118         return tag_ptr(ret_conv, true);
14119 }
14120 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
14121         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
14122         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
14123         return ret_conv;
14124 }
14125
14126 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
14127         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
14128         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14129         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
14130         return tag_ptr(ret_conv, true);
14131 }
14132
14133 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
14134         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14135         *ret_conv = C2Tuple_u64u64Z_new(a, b);
14136         return tag_ptr(ret_conv, true);
14137 }
14138
14139 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
14140         if (!ptr_is_owned(_res)) return;
14141         void* _res_ptr = untag_ptr(_res);
14142         CHECK_ACCESS(_res_ptr);
14143         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
14144         FREE(untag_ptr(_res));
14145         C2Tuple_u64u64Z_free(_res_conv);
14146 }
14147
14148 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
14149         void* o_ptr = untag_ptr(o);
14150         CHECK_ACCESS(o_ptr);
14151         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
14152         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
14153         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14154         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
14155         uint64_t ret_ref = tag_ptr(ret_copy, true);
14156         return ret_ref;
14157 }
14158
14159 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
14160         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14161         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
14162         uint64_t ret_ref = tag_ptr(ret_copy, true);
14163         return ret_ref;
14164 }
14165
14166 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
14167         if (!ptr_is_owned(_res)) return;
14168         void* _res_ptr = untag_ptr(_res);
14169         CHECK_ACCESS(_res_ptr);
14170         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
14171         FREE(untag_ptr(_res));
14172         COption_C2Tuple_u64u64ZZ_free(_res_conv);
14173 }
14174
14175 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
14176         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14177         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
14178         uint64_t ret_ref = tag_ptr(ret_copy, true);
14179         return ret_ref;
14180 }
14181 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
14182         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
14183         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
14184         return ret_conv;
14185 }
14186
14187 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
14188         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
14189         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14190         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
14191         uint64_t ret_ref = tag_ptr(ret_copy, true);
14192         return ret_ref;
14193 }
14194
14195 static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) {
14196         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14197         *ret_conv = C2Tuple_Z_clone(arg);
14198         return tag_ptr(ret_conv, true);
14199 }
14200 int64_t  __attribute__((export_name("TS_C2Tuple_Z_clone_ptr"))) TS_C2Tuple_Z_clone_ptr(uint64_t arg) {
14201         LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg);
14202         int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv);
14203         return ret_conv;
14204 }
14205
14206 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_clone"))) TS_C2Tuple_Z_clone(uint64_t orig) {
14207         LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig);
14208         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14209         *ret_conv = C2Tuple_Z_clone(orig_conv);
14210         return tag_ptr(ret_conv, true);
14211 }
14212
14213 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
14214         LDKEightU16s a_ref;
14215         CHECK(a->arr_len == 8);
14216         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
14217         LDKEightU16s b_ref;
14218         CHECK(b->arr_len == 8);
14219         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
14220         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14221         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
14222         return tag_ptr(ret_conv, true);
14223 }
14224
14225 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
14226         if (!ptr_is_owned(_res)) return;
14227         void* _res_ptr = untag_ptr(_res);
14228         CHECK_ACCESS(_res_ptr);
14229         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
14230         FREE(untag_ptr(_res));
14231         C2Tuple_Z_free(_res_conv);
14232 }
14233
14234 static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) {
14235         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14236         *ret_conv = C2Tuple__u168_u168Z_clone(arg);
14237         return tag_ptr(ret_conv, true);
14238 }
14239 int64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone_ptr"))) TS_C2Tuple__u168_u168Z_clone_ptr(uint64_t arg) {
14240         LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg);
14241         int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv);
14242         return ret_conv;
14243 }
14244
14245 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone"))) TS_C2Tuple__u168_u168Z_clone(uint64_t orig) {
14246         LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig);
14247         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14248         *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv);
14249         return tag_ptr(ret_conv, true);
14250 }
14251
14252 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_new"))) TS_C2Tuple__u168_u168Z_new(int16_tArray a, int16_tArray b) {
14253         LDKEightU16s a_ref;
14254         CHECK(a->arr_len == 8);
14255         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
14256         LDKEightU16s b_ref;
14257         CHECK(b->arr_len == 8);
14258         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
14259         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14260         *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref);
14261         return tag_ptr(ret_conv, true);
14262 }
14263
14264 void  __attribute__((export_name("TS_C2Tuple__u168_u168Z_free"))) TS_C2Tuple__u168_u168Z_free(uint64_t _res) {
14265         if (!ptr_is_owned(_res)) return;
14266         void* _res_ptr = untag_ptr(_res);
14267         CHECK_ACCESS(_res_ptr);
14268         LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr);
14269         FREE(untag_ptr(_res));
14270         C2Tuple__u168_u168Z_free(_res_conv);
14271 }
14272
14273 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_some"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_some(uint64_t o) {
14274         void* o_ptr = untag_ptr(o);
14275         CHECK_ACCESS(o_ptr);
14276         LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr);
14277         o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o));
14278         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14279         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv);
14280         uint64_t ret_ref = tag_ptr(ret_copy, true);
14281         return ret_ref;
14282 }
14283
14284 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_none"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_none() {
14285         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14286         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none();
14287         uint64_t ret_ref = tag_ptr(ret_copy, true);
14288         return ret_ref;
14289 }
14290
14291 void  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_free"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_free(uint64_t _res) {
14292         if (!ptr_is_owned(_res)) return;
14293         void* _res_ptr = untag_ptr(_res);
14294         CHECK_ACCESS(_res_ptr);
14295         LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr);
14296         FREE(untag_ptr(_res));
14297         COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv);
14298 }
14299
14300 static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) {
14301         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14302         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg);
14303         uint64_t ret_ref = tag_ptr(ret_copy, true);
14304         return ret_ref;
14305 }
14306 int64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(uint64_t arg) {
14307         LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg);
14308         int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv);
14309         return ret_conv;
14310 }
14311
14312 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone(uint64_t orig) {
14313         LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig);
14314         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14315         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv);
14316         uint64_t ret_ref = tag_ptr(ret_copy, true);
14317         return ret_ref;
14318 }
14319
14320 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
14321         LDKCVec_NodeIdZ _res_constr;
14322         _res_constr.datalen = _res->arr_len;
14323         if (_res_constr.datalen > 0)
14324                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
14325         else
14326                 _res_constr.data = NULL;
14327         uint64_t* _res_vals = _res->elems;
14328         for (size_t i = 0; i < _res_constr.datalen; i++) {
14329                 uint64_t _res_conv_8 = _res_vals[i];
14330                 LDKNodeId _res_conv_8_conv;
14331                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
14332                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
14333                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
14334                 _res_constr.data[i] = _res_conv_8_conv;
14335         }
14336         FREE(_res);
14337         CVec_NodeIdZ_free(_res_constr);
14338 }
14339
14340 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
14341         LDKProbabilisticScorer o_conv;
14342         o_conv.inner = untag_ptr(o);
14343         o_conv.is_owned = ptr_is_owned(o);
14344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14345         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
14346         
14347         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14348         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
14349         return tag_ptr(ret_conv, true);
14350 }
14351
14352 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
14353         void* e_ptr = untag_ptr(e);
14354         CHECK_ACCESS(e_ptr);
14355         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14356         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14357         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14358         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
14359         return tag_ptr(ret_conv, true);
14360 }
14361
14362 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
14363         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
14364         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
14365         return ret_conv;
14366 }
14367
14368 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
14369         if (!ptr_is_owned(_res)) return;
14370         void* _res_ptr = untag_ptr(_res);
14371         CHECK_ACCESS(_res_ptr);
14372         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
14373         FREE(untag_ptr(_res));
14374         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
14375 }
14376
14377 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
14378         LDKInitFeatures o_conv;
14379         o_conv.inner = untag_ptr(o);
14380         o_conv.is_owned = ptr_is_owned(o);
14381         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14382         o_conv = InitFeatures_clone(&o_conv);
14383         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14384         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
14385         return tag_ptr(ret_conv, true);
14386 }
14387
14388 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
14389         void* e_ptr = untag_ptr(e);
14390         CHECK_ACCESS(e_ptr);
14391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14393         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14394         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
14395         return tag_ptr(ret_conv, true);
14396 }
14397
14398 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14399         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
14400         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
14401         return ret_conv;
14402 }
14403
14404 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
14405         if (!ptr_is_owned(_res)) return;
14406         void* _res_ptr = untag_ptr(_res);
14407         CHECK_ACCESS(_res_ptr);
14408         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
14409         FREE(untag_ptr(_res));
14410         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
14411 }
14412
14413 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14414         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14415         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
14416         return tag_ptr(ret_conv, true);
14417 }
14418 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14419         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
14420         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14421         return ret_conv;
14422 }
14423
14424 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
14425         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
14426         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14427         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
14428         return tag_ptr(ret_conv, true);
14429 }
14430
14431 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
14432         LDKChannelFeatures o_conv;
14433         o_conv.inner = untag_ptr(o);
14434         o_conv.is_owned = ptr_is_owned(o);
14435         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14436         o_conv = ChannelFeatures_clone(&o_conv);
14437         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14438         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
14439         return tag_ptr(ret_conv, true);
14440 }
14441
14442 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
14443         void* e_ptr = untag_ptr(e);
14444         CHECK_ACCESS(e_ptr);
14445         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14446         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14447         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14448         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
14449         return tag_ptr(ret_conv, true);
14450 }
14451
14452 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14453         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
14454         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
14455         return ret_conv;
14456 }
14457
14458 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
14459         if (!ptr_is_owned(_res)) return;
14460         void* _res_ptr = untag_ptr(_res);
14461         CHECK_ACCESS(_res_ptr);
14462         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
14463         FREE(untag_ptr(_res));
14464         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
14465 }
14466
14467 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14468         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14469         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
14470         return tag_ptr(ret_conv, true);
14471 }
14472 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14473         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
14474         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14475         return ret_conv;
14476 }
14477
14478 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
14479         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
14480         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14481         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
14482         return tag_ptr(ret_conv, true);
14483 }
14484
14485 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
14486         LDKNodeFeatures o_conv;
14487         o_conv.inner = untag_ptr(o);
14488         o_conv.is_owned = ptr_is_owned(o);
14489         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14490         o_conv = NodeFeatures_clone(&o_conv);
14491         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14492         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
14493         return tag_ptr(ret_conv, true);
14494 }
14495
14496 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
14497         void* e_ptr = untag_ptr(e);
14498         CHECK_ACCESS(e_ptr);
14499         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14500         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14501         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14502         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
14503         return tag_ptr(ret_conv, true);
14504 }
14505
14506 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14507         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
14508         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
14509         return ret_conv;
14510 }
14511
14512 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
14513         if (!ptr_is_owned(_res)) return;
14514         void* _res_ptr = untag_ptr(_res);
14515         CHECK_ACCESS(_res_ptr);
14516         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
14517         FREE(untag_ptr(_res));
14518         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
14519 }
14520
14521 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14522         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14523         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
14524         return tag_ptr(ret_conv, true);
14525 }
14526 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14527         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
14528         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14529         return ret_conv;
14530 }
14531
14532 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14533         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
14534         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14535         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
14536         return tag_ptr(ret_conv, true);
14537 }
14538
14539 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
14540         LDKInvoiceFeatures o_conv;
14541         o_conv.inner = untag_ptr(o);
14542         o_conv.is_owned = ptr_is_owned(o);
14543         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14544         o_conv = InvoiceFeatures_clone(&o_conv);
14545         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14546         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
14547         return tag_ptr(ret_conv, true);
14548 }
14549
14550 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
14551         void* e_ptr = untag_ptr(e);
14552         CHECK_ACCESS(e_ptr);
14553         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14554         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14555         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14556         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
14557         return tag_ptr(ret_conv, true);
14558 }
14559
14560 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14561         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
14562         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
14563         return ret_conv;
14564 }
14565
14566 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
14567         if (!ptr_is_owned(_res)) return;
14568         void* _res_ptr = untag_ptr(_res);
14569         CHECK_ACCESS(_res_ptr);
14570         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
14571         FREE(untag_ptr(_res));
14572         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
14573 }
14574
14575 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14576         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14577         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
14578         return tag_ptr(ret_conv, true);
14579 }
14580 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14581         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
14582         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14583         return ret_conv;
14584 }
14585
14586 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
14587         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
14588         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14589         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
14590         return tag_ptr(ret_conv, true);
14591 }
14592
14593 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
14594         LDKBlindedHopFeatures o_conv;
14595         o_conv.inner = untag_ptr(o);
14596         o_conv.is_owned = ptr_is_owned(o);
14597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14598         o_conv = BlindedHopFeatures_clone(&o_conv);
14599         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14600         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
14601         return tag_ptr(ret_conv, true);
14602 }
14603
14604 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
14605         void* e_ptr = untag_ptr(e);
14606         CHECK_ACCESS(e_ptr);
14607         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14608         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14609         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14610         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
14611         return tag_ptr(ret_conv, true);
14612 }
14613
14614 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14615         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
14616         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
14617         return ret_conv;
14618 }
14619
14620 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
14621         if (!ptr_is_owned(_res)) return;
14622         void* _res_ptr = untag_ptr(_res);
14623         CHECK_ACCESS(_res_ptr);
14624         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
14625         FREE(untag_ptr(_res));
14626         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
14627 }
14628
14629 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14630         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14631         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
14632         return tag_ptr(ret_conv, true);
14633 }
14634 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14635         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
14636         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14637         return ret_conv;
14638 }
14639
14640 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
14641         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
14642         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14643         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
14644         return tag_ptr(ret_conv, true);
14645 }
14646
14647 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
14648         LDKChannelTypeFeatures o_conv;
14649         o_conv.inner = untag_ptr(o);
14650         o_conv.is_owned = ptr_is_owned(o);
14651         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14652         o_conv = ChannelTypeFeatures_clone(&o_conv);
14653         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14654         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14655         return tag_ptr(ret_conv, true);
14656 }
14657
14658 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14659         void* e_ptr = untag_ptr(e);
14660         CHECK_ACCESS(e_ptr);
14661         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14662         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14663         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14664         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14665         return tag_ptr(ret_conv, true);
14666 }
14667
14668 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14669         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14670         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14671         return ret_conv;
14672 }
14673
14674 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14675         if (!ptr_is_owned(_res)) return;
14676         void* _res_ptr = untag_ptr(_res);
14677         CHECK_ACCESS(_res_ptr);
14678         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14679         FREE(untag_ptr(_res));
14680         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14681 }
14682
14683 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14684         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14685         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14686         return tag_ptr(ret_conv, true);
14687 }
14688 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14689         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14690         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14691         return ret_conv;
14692 }
14693
14694 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14695         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14696         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14697         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14698         return tag_ptr(ret_conv, true);
14699 }
14700
14701 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
14702         void* o_ptr = untag_ptr(o);
14703         CHECK_ACCESS(o_ptr);
14704         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
14705         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
14706         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
14707         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
14708         return tag_ptr(ret_conv, true);
14709 }
14710
14711 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
14712         void* e_ptr = untag_ptr(e);
14713         CHECK_ACCESS(e_ptr);
14714         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14715         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14716         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
14717         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
14718         return tag_ptr(ret_conv, true);
14719 }
14720
14721 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
14722         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
14723         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
14724         return ret_conv;
14725 }
14726
14727 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
14728         if (!ptr_is_owned(_res)) return;
14729         void* _res_ptr = untag_ptr(_res);
14730         CHECK_ACCESS(_res_ptr);
14731         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
14732         FREE(untag_ptr(_res));
14733         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
14734 }
14735
14736 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
14737         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
14738         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
14739         return tag_ptr(ret_conv, true);
14740 }
14741 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
14742         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
14743         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
14744         return ret_conv;
14745 }
14746
14747 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
14748         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
14749         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
14750         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
14751         return tag_ptr(ret_conv, true);
14752 }
14753
14754 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
14755         void* o_ptr = untag_ptr(o);
14756         CHECK_ACCESS(o_ptr);
14757         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
14758         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
14759         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14760         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
14761         uint64_t ret_ref = tag_ptr(ret_copy, true);
14762         return ret_ref;
14763 }
14764
14765 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
14766         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14767         *ret_copy = COption_NetworkUpdateZ_none();
14768         uint64_t ret_ref = tag_ptr(ret_copy, true);
14769         return ret_ref;
14770 }
14771
14772 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
14773         if (!ptr_is_owned(_res)) return;
14774         void* _res_ptr = untag_ptr(_res);
14775         CHECK_ACCESS(_res_ptr);
14776         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
14777         FREE(untag_ptr(_res));
14778         COption_NetworkUpdateZ_free(_res_conv);
14779 }
14780
14781 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
14782         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14783         *ret_copy = COption_NetworkUpdateZ_clone(arg);
14784         uint64_t ret_ref = tag_ptr(ret_copy, true);
14785         return ret_ref;
14786 }
14787 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
14788         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
14789         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
14790         return ret_conv;
14791 }
14792
14793 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
14794         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
14795         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14796         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
14797         uint64_t ret_ref = tag_ptr(ret_copy, true);
14798         return ret_ref;
14799 }
14800
14801 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
14802         void* o_ptr = untag_ptr(o);
14803         CHECK_ACCESS(o_ptr);
14804         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
14805         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
14806         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14807         *ret_copy = COption_PathFailureZ_some(o_conv);
14808         uint64_t ret_ref = tag_ptr(ret_copy, true);
14809         return ret_ref;
14810 }
14811
14812 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
14813         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14814         *ret_copy = COption_PathFailureZ_none();
14815         uint64_t ret_ref = tag_ptr(ret_copy, true);
14816         return ret_ref;
14817 }
14818
14819 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
14820         if (!ptr_is_owned(_res)) return;
14821         void* _res_ptr = untag_ptr(_res);
14822         CHECK_ACCESS(_res_ptr);
14823         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
14824         FREE(untag_ptr(_res));
14825         COption_PathFailureZ_free(_res_conv);
14826 }
14827
14828 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
14829         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14830         *ret_copy = COption_PathFailureZ_clone(arg);
14831         uint64_t ret_ref = tag_ptr(ret_copy, true);
14832         return ret_ref;
14833 }
14834 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
14835         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
14836         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
14837         return ret_conv;
14838 }
14839
14840 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
14841         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
14842         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14843         *ret_copy = COption_PathFailureZ_clone(orig_conv);
14844         uint64_t ret_ref = tag_ptr(ret_copy, true);
14845         return ret_ref;
14846 }
14847
14848 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
14849         void* o_ptr = untag_ptr(o);
14850         CHECK_ACCESS(o_ptr);
14851         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
14852         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
14853         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
14854         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
14855         return tag_ptr(ret_conv, true);
14856 }
14857
14858 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
14859         void* e_ptr = untag_ptr(e);
14860         CHECK_ACCESS(e_ptr);
14861         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14862         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14863         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
14864         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
14865         return tag_ptr(ret_conv, true);
14866 }
14867
14868 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
14869         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
14870         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
14871         return ret_conv;
14872 }
14873
14874 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
14875         if (!ptr_is_owned(_res)) return;
14876         void* _res_ptr = untag_ptr(_res);
14877         CHECK_ACCESS(_res_ptr);
14878         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
14879         FREE(untag_ptr(_res));
14880         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
14881 }
14882
14883 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
14884         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
14885         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
14886         return tag_ptr(ret_conv, true);
14887 }
14888 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
14889         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
14890         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
14891         return ret_conv;
14892 }
14893
14894 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
14895         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
14896         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
14897         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
14898         return tag_ptr(ret_conv, true);
14899 }
14900
14901 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
14902         void* o_ptr = untag_ptr(o);
14903         CHECK_ACCESS(o_ptr);
14904         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
14905         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
14906         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14907         *ret_copy = COption_ClosureReasonZ_some(o_conv);
14908         uint64_t ret_ref = tag_ptr(ret_copy, true);
14909         return ret_ref;
14910 }
14911
14912 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
14913         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14914         *ret_copy = COption_ClosureReasonZ_none();
14915         uint64_t ret_ref = tag_ptr(ret_copy, true);
14916         return ret_ref;
14917 }
14918
14919 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
14920         if (!ptr_is_owned(_res)) return;
14921         void* _res_ptr = untag_ptr(_res);
14922         CHECK_ACCESS(_res_ptr);
14923         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
14924         FREE(untag_ptr(_res));
14925         COption_ClosureReasonZ_free(_res_conv);
14926 }
14927
14928 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
14929         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14930         *ret_copy = COption_ClosureReasonZ_clone(arg);
14931         uint64_t ret_ref = tag_ptr(ret_copy, true);
14932         return ret_ref;
14933 }
14934 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
14935         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
14936         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
14937         return ret_conv;
14938 }
14939
14940 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
14941         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
14942         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14943         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
14944         uint64_t ret_ref = tag_ptr(ret_copy, true);
14945         return ret_ref;
14946 }
14947
14948 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
14949         void* o_ptr = untag_ptr(o);
14950         CHECK_ACCESS(o_ptr);
14951         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
14952         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
14953         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14954         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
14955         return tag_ptr(ret_conv, true);
14956 }
14957
14958 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
14959         void* e_ptr = untag_ptr(e);
14960         CHECK_ACCESS(e_ptr);
14961         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14962         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14963         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14964         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
14965         return tag_ptr(ret_conv, true);
14966 }
14967
14968 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
14969         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
14970         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
14971         return ret_conv;
14972 }
14973
14974 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
14975         if (!ptr_is_owned(_res)) return;
14976         void* _res_ptr = untag_ptr(_res);
14977         CHECK_ACCESS(_res_ptr);
14978         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
14979         FREE(untag_ptr(_res));
14980         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
14981 }
14982
14983 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
14984         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14985         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
14986         return tag_ptr(ret_conv, true);
14987 }
14988 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
14989         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
14990         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
14991         return ret_conv;
14992 }
14993
14994 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
14995         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
14996         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14997         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
14998         return tag_ptr(ret_conv, true);
14999 }
15000
15001 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
15002         void* o_ptr = untag_ptr(o);
15003         CHECK_ACCESS(o_ptr);
15004         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
15005         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
15006         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15007         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
15008         uint64_t ret_ref = tag_ptr(ret_copy, true);
15009         return ret_ref;
15010 }
15011
15012 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
15013         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15014         *ret_copy = COption_HTLCDestinationZ_none();
15015         uint64_t ret_ref = tag_ptr(ret_copy, true);
15016         return ret_ref;
15017 }
15018
15019 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
15020         if (!ptr_is_owned(_res)) return;
15021         void* _res_ptr = untag_ptr(_res);
15022         CHECK_ACCESS(_res_ptr);
15023         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
15024         FREE(untag_ptr(_res));
15025         COption_HTLCDestinationZ_free(_res_conv);
15026 }
15027
15028 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
15029         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15030         *ret_copy = COption_HTLCDestinationZ_clone(arg);
15031         uint64_t ret_ref = tag_ptr(ret_copy, true);
15032         return ret_ref;
15033 }
15034 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
15035         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
15036         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
15037         return ret_conv;
15038 }
15039
15040 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
15041         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
15042         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15043         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
15044         uint64_t ret_ref = tag_ptr(ret_copy, true);
15045         return ret_ref;
15046 }
15047
15048 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
15049         void* o_ptr = untag_ptr(o);
15050         CHECK_ACCESS(o_ptr);
15051         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
15052         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
15053         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15054         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
15055         return tag_ptr(ret_conv, true);
15056 }
15057
15058 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
15059         void* e_ptr = untag_ptr(e);
15060         CHECK_ACCESS(e_ptr);
15061         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15062         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15063         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15064         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
15065         return tag_ptr(ret_conv, true);
15066 }
15067
15068 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
15069         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
15070         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
15071         return ret_conv;
15072 }
15073
15074 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
15075         if (!ptr_is_owned(_res)) return;
15076         void* _res_ptr = untag_ptr(_res);
15077         CHECK_ACCESS(_res_ptr);
15078         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
15079         FREE(untag_ptr(_res));
15080         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
15081 }
15082
15083 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
15084         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15085         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
15086         return tag_ptr(ret_conv, true);
15087 }
15088 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
15089         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
15090         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
15091         return ret_conv;
15092 }
15093
15094 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
15095         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
15096         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15097         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
15098         return tag_ptr(ret_conv, true);
15099 }
15100
15101 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
15102         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
15103         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
15104         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
15105         return tag_ptr(ret_conv, true);
15106 }
15107
15108 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
15109         void* e_ptr = untag_ptr(e);
15110         CHECK_ACCESS(e_ptr);
15111         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15112         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15113         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
15114         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
15115         return tag_ptr(ret_conv, true);
15116 }
15117
15118 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
15119         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
15120         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
15121         return ret_conv;
15122 }
15123
15124 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
15125         if (!ptr_is_owned(_res)) return;
15126         void* _res_ptr = untag_ptr(_res);
15127         CHECK_ACCESS(_res_ptr);
15128         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
15129         FREE(untag_ptr(_res));
15130         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
15131 }
15132
15133 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
15134         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
15135         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
15136         return tag_ptr(ret_conv, true);
15137 }
15138 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
15139         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
15140         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
15141         return ret_conv;
15142 }
15143
15144 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
15145         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
15146         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
15147         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
15148         return tag_ptr(ret_conv, true);
15149 }
15150
15151 uint64_t  __attribute__((export_name("TS_COption_u128Z_some"))) TS_COption_u128Z_some(int8_tArray o) {
15152         LDKU128 o_ref;
15153         CHECK(o->arr_len == 16);
15154         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
15155         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
15156         *ret_copy = COption_u128Z_some(o_ref);
15157         uint64_t ret_ref = tag_ptr(ret_copy, true);
15158         return ret_ref;
15159 }
15160
15161 uint64_t  __attribute__((export_name("TS_COption_u128Z_none"))) TS_COption_u128Z_none() {
15162         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
15163         *ret_copy = COption_u128Z_none();
15164         uint64_t ret_ref = tag_ptr(ret_copy, true);
15165         return ret_ref;
15166 }
15167
15168 void  __attribute__((export_name("TS_COption_u128Z_free"))) TS_COption_u128Z_free(uint64_t _res) {
15169         if (!ptr_is_owned(_res)) return;
15170         void* _res_ptr = untag_ptr(_res);
15171         CHECK_ACCESS(_res_ptr);
15172         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
15173         FREE(untag_ptr(_res));
15174         COption_u128Z_free(_res_conv);
15175 }
15176
15177 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
15178         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
15179         *ret_copy = COption_u128Z_clone(arg);
15180         uint64_t ret_ref = tag_ptr(ret_copy, true);
15181         return ret_ref;
15182 }
15183 int64_t  __attribute__((export_name("TS_COption_u128Z_clone_ptr"))) TS_COption_u128Z_clone_ptr(uint64_t arg) {
15184         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
15185         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
15186         return ret_conv;
15187 }
15188
15189 uint64_t  __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128Z_clone(uint64_t orig) {
15190         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
15191         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
15192         *ret_copy = COption_u128Z_clone(orig_conv);
15193         uint64_t ret_ref = tag_ptr(ret_copy, true);
15194         return ret_ref;
15195 }
15196
15197 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
15198         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
15199         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
15200         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
15201         uint64_t ret_ref = tag_ptr(ret_copy, true);
15202         return ret_ref;
15203 }
15204
15205 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
15206         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
15207         *ret_copy = COption_PaymentFailureReasonZ_none();
15208         uint64_t ret_ref = tag_ptr(ret_copy, true);
15209         return ret_ref;
15210 }
15211
15212 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
15213         if (!ptr_is_owned(_res)) return;
15214         void* _res_ptr = untag_ptr(_res);
15215         CHECK_ACCESS(_res_ptr);
15216         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
15217         FREE(untag_ptr(_res));
15218         COption_PaymentFailureReasonZ_free(_res_conv);
15219 }
15220
15221 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
15222         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
15223         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
15224         uint64_t ret_ref = tag_ptr(ret_copy, true);
15225         return ret_ref;
15226 }
15227 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
15228         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
15229         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
15230         return ret_conv;
15231 }
15232
15233 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
15234         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
15235         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
15236         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
15237         uint64_t ret_ref = tag_ptr(ret_copy, true);
15238         return ret_ref;
15239 }
15240
15241 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
15242         LDKCVec_SpendableOutputDescriptorZ _res_constr;
15243         _res_constr.datalen = _res->arr_len;
15244         if (_res_constr.datalen > 0)
15245                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15246         else
15247                 _res_constr.data = NULL;
15248         uint64_t* _res_vals = _res->elems;
15249         for (size_t b = 0; b < _res_constr.datalen; b++) {
15250                 uint64_t _res_conv_27 = _res_vals[b];
15251                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
15252                 CHECK_ACCESS(_res_conv_27_ptr);
15253                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
15254                 FREE(untag_ptr(_res_conv_27));
15255                 _res_constr.data[b] = _res_conv_27_conv;
15256         }
15257         FREE(_res);
15258         CVec_SpendableOutputDescriptorZ_free(_res_constr);
15259 }
15260
15261 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
15262         void* o_ptr = untag_ptr(o);
15263         CHECK_ACCESS(o_ptr);
15264         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
15265         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
15266         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15267         *ret_copy = COption_EventZ_some(o_conv);
15268         uint64_t ret_ref = tag_ptr(ret_copy, true);
15269         return ret_ref;
15270 }
15271
15272 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
15273         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15274         *ret_copy = COption_EventZ_none();
15275         uint64_t ret_ref = tag_ptr(ret_copy, true);
15276         return ret_ref;
15277 }
15278
15279 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
15280         if (!ptr_is_owned(_res)) return;
15281         void* _res_ptr = untag_ptr(_res);
15282         CHECK_ACCESS(_res_ptr);
15283         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
15284         FREE(untag_ptr(_res));
15285         COption_EventZ_free(_res_conv);
15286 }
15287
15288 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
15289         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15290         *ret_copy = COption_EventZ_clone(arg);
15291         uint64_t ret_ref = tag_ptr(ret_copy, true);
15292         return ret_ref;
15293 }
15294 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
15295         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
15296         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
15297         return ret_conv;
15298 }
15299
15300 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
15301         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
15302         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15303         *ret_copy = COption_EventZ_clone(orig_conv);
15304         uint64_t ret_ref = tag_ptr(ret_copy, true);
15305         return ret_ref;
15306 }
15307
15308 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
15309         void* o_ptr = untag_ptr(o);
15310         CHECK_ACCESS(o_ptr);
15311         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
15312         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
15313         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15314         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
15315         return tag_ptr(ret_conv, true);
15316 }
15317
15318 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
15319         void* e_ptr = untag_ptr(e);
15320         CHECK_ACCESS(e_ptr);
15321         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15322         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15323         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15324         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
15325         return tag_ptr(ret_conv, true);
15326 }
15327
15328 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
15329         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
15330         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
15331         return ret_conv;
15332 }
15333
15334 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
15335         if (!ptr_is_owned(_res)) return;
15336         void* _res_ptr = untag_ptr(_res);
15337         CHECK_ACCESS(_res_ptr);
15338         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
15339         FREE(untag_ptr(_res));
15340         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
15341 }
15342
15343 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
15344         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15345         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
15346         return tag_ptr(ret_conv, true);
15347 }
15348 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
15349         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
15350         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
15351         return ret_conv;
15352 }
15353
15354 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
15355         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
15356         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15357         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
15358         return tag_ptr(ret_conv, true);
15359 }
15360
15361 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
15362         LDKCVec_MessageSendEventZ _res_constr;
15363         _res_constr.datalen = _res->arr_len;
15364         if (_res_constr.datalen > 0)
15365                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15366         else
15367                 _res_constr.data = NULL;
15368         uint64_t* _res_vals = _res->elems;
15369         for (size_t s = 0; s < _res_constr.datalen; s++) {
15370                 uint64_t _res_conv_18 = _res_vals[s];
15371                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
15372                 CHECK_ACCESS(_res_conv_18_ptr);
15373                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
15374                 FREE(untag_ptr(_res_conv_18));
15375                 _res_constr.data[s] = _res_conv_18_conv;
15376         }
15377         FREE(_res);
15378         CVec_MessageSendEventZ_free(_res_constr);
15379 }
15380
15381 void  __attribute__((export_name("TS_CVec_ChainHashZ_free"))) TS_CVec_ChainHashZ_free(ptrArray _res) {
15382         LDKCVec_ChainHashZ _res_constr;
15383         _res_constr.datalen = _res->arr_len;
15384         if (_res_constr.datalen > 0)
15385                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
15386         else
15387                 _res_constr.data = NULL;
15388         int8_tArray* _res_vals = (void*) _res->elems;
15389         for (size_t m = 0; m < _res_constr.datalen; m++) {
15390                 int8_tArray _res_conv_12 = _res_vals[m];
15391                 LDKThirtyTwoBytes _res_conv_12_ref;
15392                 CHECK(_res_conv_12->arr_len == 32);
15393                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15394                 _res_constr.data[m] = _res_conv_12_ref;
15395         }
15396         FREE(_res);
15397         CVec_ChainHashZ_free(_res_constr);
15398 }
15399
15400 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
15401         LDKPublicKey o_ref;
15402         CHECK(o->arr_len == 33);
15403         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
15404         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15405         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
15406         return tag_ptr(ret_conv, true);
15407 }
15408
15409 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
15410         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
15411         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15412         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
15413         return tag_ptr(ret_conv, true);
15414 }
15415
15416 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
15417         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
15418         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
15419         return ret_conv;
15420 }
15421
15422 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
15423         if (!ptr_is_owned(_res)) return;
15424         void* _res_ptr = untag_ptr(_res);
15425         CHECK_ACCESS(_res_ptr);
15426         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
15427         FREE(untag_ptr(_res));
15428         CResult_PublicKeyErrorZ_free(_res_conv);
15429 }
15430
15431 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
15432         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15433         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
15434         return tag_ptr(ret_conv, true);
15435 }
15436 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
15437         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
15438         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
15439         return ret_conv;
15440 }
15441
15442 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
15443         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
15444         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15445         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
15446         return tag_ptr(ret_conv, true);
15447 }
15448
15449 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
15450         LDKNodeId o_conv;
15451         o_conv.inner = untag_ptr(o);
15452         o_conv.is_owned = ptr_is_owned(o);
15453         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15454         o_conv = NodeId_clone(&o_conv);
15455         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15456         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
15457         return tag_ptr(ret_conv, true);
15458 }
15459
15460 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
15461         void* e_ptr = untag_ptr(e);
15462         CHECK_ACCESS(e_ptr);
15463         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15464         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15465         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15466         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
15467         return tag_ptr(ret_conv, true);
15468 }
15469
15470 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
15471         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
15472         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
15473         return ret_conv;
15474 }
15475
15476 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
15477         if (!ptr_is_owned(_res)) return;
15478         void* _res_ptr = untag_ptr(_res);
15479         CHECK_ACCESS(_res_ptr);
15480         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
15481         FREE(untag_ptr(_res));
15482         CResult_NodeIdDecodeErrorZ_free(_res_conv);
15483 }
15484
15485 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
15486         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15487         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
15488         return tag_ptr(ret_conv, true);
15489 }
15490 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
15491         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
15492         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
15493         return ret_conv;
15494 }
15495
15496 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
15497         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
15498         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15499         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
15500         return tag_ptr(ret_conv, true);
15501 }
15502
15503 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
15504         void* o_ptr = untag_ptr(o);
15505         CHECK_ACCESS(o_ptr);
15506         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
15507         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
15508         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
15509         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
15510         return tag_ptr(ret_conv, true);
15511 }
15512
15513 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
15514         void* e_ptr = untag_ptr(e);
15515         CHECK_ACCESS(e_ptr);
15516         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15517         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15518         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
15519         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
15520         return tag_ptr(ret_conv, true);
15521 }
15522
15523 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
15524         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
15525         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
15526         return ret_conv;
15527 }
15528
15529 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
15530         if (!ptr_is_owned(_res)) return;
15531         void* _res_ptr = untag_ptr(_res);
15532         CHECK_ACCESS(_res_ptr);
15533         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
15534         FREE(untag_ptr(_res));
15535         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
15536 }
15537
15538 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
15539         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
15540         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
15541         return tag_ptr(ret_conv, true);
15542 }
15543 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
15544         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
15545         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
15546         return ret_conv;
15547 }
15548
15549 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
15550         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
15551         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
15552         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
15553         return tag_ptr(ret_conv, true);
15554 }
15555
15556 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
15557         void* o_ptr = untag_ptr(o);
15558         CHECK_ACCESS(o_ptr);
15559         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
15560         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
15561                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15562                 LDKUtxoLookup_JCalls_cloned(&o_conv);
15563         }
15564         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
15565         *ret_copy = COption_UtxoLookupZ_some(o_conv);
15566         uint64_t ret_ref = tag_ptr(ret_copy, true);
15567         return ret_ref;
15568 }
15569
15570 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
15571         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
15572         *ret_copy = COption_UtxoLookupZ_none();
15573         uint64_t ret_ref = tag_ptr(ret_copy, true);
15574         return ret_ref;
15575 }
15576
15577 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
15578         if (!ptr_is_owned(_res)) return;
15579         void* _res_ptr = untag_ptr(_res);
15580         CHECK_ACCESS(_res_ptr);
15581         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
15582         FREE(untag_ptr(_res));
15583         COption_UtxoLookupZ_free(_res_conv);
15584 }
15585
15586 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
15587         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15588         *ret_conv = CResult_boolLightningErrorZ_ok(o);
15589         return tag_ptr(ret_conv, true);
15590 }
15591
15592 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
15593         LDKLightningError e_conv;
15594         e_conv.inner = untag_ptr(e);
15595         e_conv.is_owned = ptr_is_owned(e);
15596         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15597         e_conv = LightningError_clone(&e_conv);
15598         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15599         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
15600         return tag_ptr(ret_conv, true);
15601 }
15602
15603 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
15604         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
15605         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
15606         return ret_conv;
15607 }
15608
15609 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
15610         if (!ptr_is_owned(_res)) return;
15611         void* _res_ptr = untag_ptr(_res);
15612         CHECK_ACCESS(_res_ptr);
15613         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
15614         FREE(untag_ptr(_res));
15615         CResult_boolLightningErrorZ_free(_res_conv);
15616 }
15617
15618 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
15619         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15620         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
15621         return tag_ptr(ret_conv, true);
15622 }
15623 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
15624         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
15625         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
15626         return ret_conv;
15627 }
15628
15629 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
15630         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
15631         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15632         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
15633         return tag_ptr(ret_conv, true);
15634 }
15635
15636 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
15637         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15638         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
15639         return tag_ptr(ret_conv, true);
15640 }
15641 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
15642         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
15643         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
15644         return ret_conv;
15645 }
15646
15647 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
15648         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
15649         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15650         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
15651         return tag_ptr(ret_conv, true);
15652 }
15653
15654 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
15655         LDKChannelAnnouncement a_conv;
15656         a_conv.inner = untag_ptr(a);
15657         a_conv.is_owned = ptr_is_owned(a);
15658         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15659         a_conv = ChannelAnnouncement_clone(&a_conv);
15660         LDKChannelUpdate b_conv;
15661         b_conv.inner = untag_ptr(b);
15662         b_conv.is_owned = ptr_is_owned(b);
15663         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15664         b_conv = ChannelUpdate_clone(&b_conv);
15665         LDKChannelUpdate c_conv;
15666         c_conv.inner = untag_ptr(c);
15667         c_conv.is_owned = ptr_is_owned(c);
15668         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
15669         c_conv = ChannelUpdate_clone(&c_conv);
15670         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15671         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
15672         return tag_ptr(ret_conv, true);
15673 }
15674
15675 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
15676         if (!ptr_is_owned(_res)) return;
15677         void* _res_ptr = untag_ptr(_res);
15678         CHECK_ACCESS(_res_ptr);
15679         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
15680         FREE(untag_ptr(_res));
15681         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
15682 }
15683
15684 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
15685         void* o_ptr = untag_ptr(o);
15686         CHECK_ACCESS(o_ptr);
15687         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
15688         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
15689         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15690         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
15691         uint64_t ret_ref = tag_ptr(ret_copy, true);
15692         return ret_ref;
15693 }
15694
15695 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
15696         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15697         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
15698         uint64_t ret_ref = tag_ptr(ret_copy, true);
15699         return ret_ref;
15700 }
15701
15702 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
15703         if (!ptr_is_owned(_res)) return;
15704         void* _res_ptr = untag_ptr(_res);
15705         CHECK_ACCESS(_res_ptr);
15706         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
15707         FREE(untag_ptr(_res));
15708         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
15709 }
15710
15711 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
15712         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15713         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
15714         uint64_t ret_ref = tag_ptr(ret_copy, true);
15715         return ret_ref;
15716 }
15717 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
15718         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
15719         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
15720         return ret_conv;
15721 }
15722
15723 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
15724         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
15725         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15726         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
15727         uint64_t ret_ref = tag_ptr(ret_copy, true);
15728         return ret_ref;
15729 }
15730
15731 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
15732         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15733         *ret_conv = CResult_NoneLightningErrorZ_ok();
15734         return tag_ptr(ret_conv, true);
15735 }
15736
15737 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
15738         LDKLightningError e_conv;
15739         e_conv.inner = untag_ptr(e);
15740         e_conv.is_owned = ptr_is_owned(e);
15741         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15742         e_conv = LightningError_clone(&e_conv);
15743         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15744         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
15745         return tag_ptr(ret_conv, true);
15746 }
15747
15748 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
15749         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
15750         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
15751         return ret_conv;
15752 }
15753
15754 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
15755         if (!ptr_is_owned(_res)) return;
15756         void* _res_ptr = untag_ptr(_res);
15757         CHECK_ACCESS(_res_ptr);
15758         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
15759         FREE(untag_ptr(_res));
15760         CResult_NoneLightningErrorZ_free(_res_conv);
15761 }
15762
15763 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
15764         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15765         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
15766         return tag_ptr(ret_conv, true);
15767 }
15768 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
15769         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
15770         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
15771         return ret_conv;
15772 }
15773
15774 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
15775         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
15776         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15777         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
15778         return tag_ptr(ret_conv, true);
15779 }
15780
15781 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
15782         LDKChannelUpdateInfo o_conv;
15783         o_conv.inner = untag_ptr(o);
15784         o_conv.is_owned = ptr_is_owned(o);
15785         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15786         o_conv = ChannelUpdateInfo_clone(&o_conv);
15787         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15788         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
15789         return tag_ptr(ret_conv, true);
15790 }
15791
15792 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
15793         void* e_ptr = untag_ptr(e);
15794         CHECK_ACCESS(e_ptr);
15795         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15796         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15797         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15798         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
15799         return tag_ptr(ret_conv, true);
15800 }
15801
15802 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
15803         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
15804         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
15805         return ret_conv;
15806 }
15807
15808 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
15809         if (!ptr_is_owned(_res)) return;
15810         void* _res_ptr = untag_ptr(_res);
15811         CHECK_ACCESS(_res_ptr);
15812         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
15813         FREE(untag_ptr(_res));
15814         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
15815 }
15816
15817 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
15818         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15819         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
15820         return tag_ptr(ret_conv, true);
15821 }
15822 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15823         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
15824         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
15825         return ret_conv;
15826 }
15827
15828 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
15829         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
15830         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15831         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
15832         return tag_ptr(ret_conv, true);
15833 }
15834
15835 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
15836         LDKChannelInfo o_conv;
15837         o_conv.inner = untag_ptr(o);
15838         o_conv.is_owned = ptr_is_owned(o);
15839         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15840         o_conv = ChannelInfo_clone(&o_conv);
15841         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15842         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
15843         return tag_ptr(ret_conv, true);
15844 }
15845
15846 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
15847         void* e_ptr = untag_ptr(e);
15848         CHECK_ACCESS(e_ptr);
15849         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15850         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15851         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15852         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
15853         return tag_ptr(ret_conv, true);
15854 }
15855
15856 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
15857         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
15858         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
15859         return ret_conv;
15860 }
15861
15862 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
15863         if (!ptr_is_owned(_res)) return;
15864         void* _res_ptr = untag_ptr(_res);
15865         CHECK_ACCESS(_res_ptr);
15866         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
15867         FREE(untag_ptr(_res));
15868         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
15869 }
15870
15871 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
15872         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15873         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
15874         return tag_ptr(ret_conv, true);
15875 }
15876 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15877         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
15878         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
15879         return ret_conv;
15880 }
15881
15882 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
15883         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
15884         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15885         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
15886         return tag_ptr(ret_conv, true);
15887 }
15888
15889 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
15890         LDKRoutingFees o_conv;
15891         o_conv.inner = untag_ptr(o);
15892         o_conv.is_owned = ptr_is_owned(o);
15893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15894         o_conv = RoutingFees_clone(&o_conv);
15895         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15896         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
15897         return tag_ptr(ret_conv, true);
15898 }
15899
15900 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
15901         void* e_ptr = untag_ptr(e);
15902         CHECK_ACCESS(e_ptr);
15903         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15904         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15905         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15906         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
15907         return tag_ptr(ret_conv, true);
15908 }
15909
15910 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
15911         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
15912         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
15913         return ret_conv;
15914 }
15915
15916 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
15917         if (!ptr_is_owned(_res)) return;
15918         void* _res_ptr = untag_ptr(_res);
15919         CHECK_ACCESS(_res_ptr);
15920         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
15921         FREE(untag_ptr(_res));
15922         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
15923 }
15924
15925 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
15926         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15927         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
15928         return tag_ptr(ret_conv, true);
15929 }
15930 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
15931         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
15932         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
15933         return ret_conv;
15934 }
15935
15936 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
15937         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
15938         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15939         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
15940         return tag_ptr(ret_conv, true);
15941 }
15942
15943 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
15944         LDKCVec_NetAddressZ _res_constr;
15945         _res_constr.datalen = _res->arr_len;
15946         if (_res_constr.datalen > 0)
15947                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15948         else
15949                 _res_constr.data = NULL;
15950         uint64_t* _res_vals = _res->elems;
15951         for (size_t m = 0; m < _res_constr.datalen; m++) {
15952                 uint64_t _res_conv_12 = _res_vals[m];
15953                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
15954                 CHECK_ACCESS(_res_conv_12_ptr);
15955                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
15956                 FREE(untag_ptr(_res_conv_12));
15957                 _res_constr.data[m] = _res_conv_12_conv;
15958         }
15959         FREE(_res);
15960         CVec_NetAddressZ_free(_res_constr);
15961 }
15962
15963 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
15964         LDKNodeAnnouncementInfo o_conv;
15965         o_conv.inner = untag_ptr(o);
15966         o_conv.is_owned = ptr_is_owned(o);
15967         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15968         o_conv = NodeAnnouncementInfo_clone(&o_conv);
15969         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15970         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
15971         return tag_ptr(ret_conv, true);
15972 }
15973
15974 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
15975         void* e_ptr = untag_ptr(e);
15976         CHECK_ACCESS(e_ptr);
15977         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15978         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15979         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15980         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
15981         return tag_ptr(ret_conv, true);
15982 }
15983
15984 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
15985         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
15986         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
15987         return ret_conv;
15988 }
15989
15990 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
15991         if (!ptr_is_owned(_res)) return;
15992         void* _res_ptr = untag_ptr(_res);
15993         CHECK_ACCESS(_res_ptr);
15994         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
15995         FREE(untag_ptr(_res));
15996         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
15997 }
15998
15999 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
16000         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16001         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
16002         return tag_ptr(ret_conv, true);
16003 }
16004 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16005         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
16006         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
16007         return ret_conv;
16008 }
16009
16010 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
16011         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
16012         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16013         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
16014         return tag_ptr(ret_conv, true);
16015 }
16016
16017 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
16018         LDKNodeAlias o_conv;
16019         o_conv.inner = untag_ptr(o);
16020         o_conv.is_owned = ptr_is_owned(o);
16021         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16022         o_conv = NodeAlias_clone(&o_conv);
16023         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
16024         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
16025         return tag_ptr(ret_conv, true);
16026 }
16027
16028 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
16029         void* e_ptr = untag_ptr(e);
16030         CHECK_ACCESS(e_ptr);
16031         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16032         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16033         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
16034         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
16035         return tag_ptr(ret_conv, true);
16036 }
16037
16038 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
16039         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
16040         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
16041         return ret_conv;
16042 }
16043
16044 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
16045         if (!ptr_is_owned(_res)) return;
16046         void* _res_ptr = untag_ptr(_res);
16047         CHECK_ACCESS(_res_ptr);
16048         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
16049         FREE(untag_ptr(_res));
16050         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
16051 }
16052
16053 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
16054         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
16055         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
16056         return tag_ptr(ret_conv, true);
16057 }
16058 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
16059         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
16060         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
16061         return ret_conv;
16062 }
16063
16064 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
16065         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
16066         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
16067         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
16068         return tag_ptr(ret_conv, true);
16069 }
16070
16071 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
16072         LDKNodeInfo o_conv;
16073         o_conv.inner = untag_ptr(o);
16074         o_conv.is_owned = ptr_is_owned(o);
16075         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16076         o_conv = NodeInfo_clone(&o_conv);
16077         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16078         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
16079         return tag_ptr(ret_conv, true);
16080 }
16081
16082 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
16083         void* e_ptr = untag_ptr(e);
16084         CHECK_ACCESS(e_ptr);
16085         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16086         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16087         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16088         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
16089         return tag_ptr(ret_conv, true);
16090 }
16091
16092 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
16093         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
16094         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
16095         return ret_conv;
16096 }
16097
16098 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
16099         if (!ptr_is_owned(_res)) return;
16100         void* _res_ptr = untag_ptr(_res);
16101         CHECK_ACCESS(_res_ptr);
16102         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
16103         FREE(untag_ptr(_res));
16104         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
16105 }
16106
16107 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
16108         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16109         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
16110         return tag_ptr(ret_conv, true);
16111 }
16112 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16113         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
16114         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
16115         return ret_conv;
16116 }
16117
16118 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
16119         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
16120         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16121         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
16122         return tag_ptr(ret_conv, true);
16123 }
16124
16125 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
16126         LDKNetworkGraph o_conv;
16127         o_conv.inner = untag_ptr(o);
16128         o_conv.is_owned = ptr_is_owned(o);
16129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16130         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
16131         
16132         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16133         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
16134         return tag_ptr(ret_conv, true);
16135 }
16136
16137 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
16138         void* e_ptr = untag_ptr(e);
16139         CHECK_ACCESS(e_ptr);
16140         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16141         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16142         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16143         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
16144         return tag_ptr(ret_conv, true);
16145 }
16146
16147 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
16148         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
16149         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
16150         return ret_conv;
16151 }
16152
16153 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
16154         if (!ptr_is_owned(_res)) return;
16155         void* _res_ptr = untag_ptr(_res);
16156         CHECK_ACCESS(_res_ptr);
16157         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
16158         FREE(untag_ptr(_res));
16159         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
16160 }
16161
16162 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
16163         LDKCVec_NetAddressZ o_constr;
16164         o_constr.datalen = o->arr_len;
16165         if (o_constr.datalen > 0)
16166                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16167         else
16168                 o_constr.data = NULL;
16169         uint64_t* o_vals = o->elems;
16170         for (size_t m = 0; m < o_constr.datalen; m++) {
16171                 uint64_t o_conv_12 = o_vals[m];
16172                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
16173                 CHECK_ACCESS(o_conv_12_ptr);
16174                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
16175                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
16176                 o_constr.data[m] = o_conv_12_conv;
16177         }
16178         FREE(o);
16179         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
16180         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
16181         uint64_t ret_ref = tag_ptr(ret_copy, true);
16182         return ret_ref;
16183 }
16184
16185 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
16186         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
16187         *ret_copy = COption_CVec_NetAddressZZ_none();
16188         uint64_t ret_ref = tag_ptr(ret_copy, true);
16189         return ret_ref;
16190 }
16191
16192 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
16193         if (!ptr_is_owned(_res)) return;
16194         void* _res_ptr = untag_ptr(_res);
16195         CHECK_ACCESS(_res_ptr);
16196         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
16197         FREE(untag_ptr(_res));
16198         COption_CVec_NetAddressZZ_free(_res_conv);
16199 }
16200
16201 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
16202         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
16203         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
16204         uint64_t ret_ref = tag_ptr(ret_copy, true);
16205         return ret_ref;
16206 }
16207 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
16208         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
16209         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
16210         return ret_conv;
16211 }
16212
16213 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
16214         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
16215         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
16216         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
16217         uint64_t ret_ref = tag_ptr(ret_copy, true);
16218         return ret_ref;
16219 }
16220
16221 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16222         LDKDelayedPaymentOutputDescriptor o_conv;
16223         o_conv.inner = untag_ptr(o);
16224         o_conv.is_owned = ptr_is_owned(o);
16225         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16226         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
16227         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16228         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16229         return tag_ptr(ret_conv, true);
16230 }
16231
16232 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16233         void* e_ptr = untag_ptr(e);
16234         CHECK_ACCESS(e_ptr);
16235         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16236         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16237         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16238         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16239         return tag_ptr(ret_conv, true);
16240 }
16241
16242 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16243         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16244         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16245         return ret_conv;
16246 }
16247
16248 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16249         if (!ptr_is_owned(_res)) return;
16250         void* _res_ptr = untag_ptr(_res);
16251         CHECK_ACCESS(_res_ptr);
16252         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16253         FREE(untag_ptr(_res));
16254         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16255 }
16256
16257 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16258         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16259         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16260         return tag_ptr(ret_conv, true);
16261 }
16262 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16263         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16264         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16265         return ret_conv;
16266 }
16267
16268 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16269         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16270         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16271         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16272         return tag_ptr(ret_conv, true);
16273 }
16274
16275 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16276         LDKStaticPaymentOutputDescriptor o_conv;
16277         o_conv.inner = untag_ptr(o);
16278         o_conv.is_owned = ptr_is_owned(o);
16279         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16280         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
16281         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16282         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16283         return tag_ptr(ret_conv, true);
16284 }
16285
16286 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16287         void* e_ptr = untag_ptr(e);
16288         CHECK_ACCESS(e_ptr);
16289         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16290         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16291         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16292         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16293         return tag_ptr(ret_conv, true);
16294 }
16295
16296 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16297         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16298         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16299         return ret_conv;
16300 }
16301
16302 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16303         if (!ptr_is_owned(_res)) return;
16304         void* _res_ptr = untag_ptr(_res);
16305         CHECK_ACCESS(_res_ptr);
16306         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16307         FREE(untag_ptr(_res));
16308         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16309 }
16310
16311 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16312         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16313         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16314         return tag_ptr(ret_conv, true);
16315 }
16316 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16317         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16318         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16319         return ret_conv;
16320 }
16321
16322 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16323         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16324         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16325         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16326         return tag_ptr(ret_conv, true);
16327 }
16328
16329 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16330         void* o_ptr = untag_ptr(o);
16331         CHECK_ACCESS(o_ptr);
16332         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
16333         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
16334         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16335         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
16336         return tag_ptr(ret_conv, true);
16337 }
16338
16339 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16340         void* e_ptr = untag_ptr(e);
16341         CHECK_ACCESS(e_ptr);
16342         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16343         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16344         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16345         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
16346         return tag_ptr(ret_conv, true);
16347 }
16348
16349 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16350         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16351         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16352         return ret_conv;
16353 }
16354
16355 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16356         if (!ptr_is_owned(_res)) return;
16357         void* _res_ptr = untag_ptr(_res);
16358         CHECK_ACCESS(_res_ptr);
16359         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
16360         FREE(untag_ptr(_res));
16361         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
16362 }
16363
16364 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16365         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16366         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16367         return tag_ptr(ret_conv, true);
16368 }
16369 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16370         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16371         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16372         return ret_conv;
16373 }
16374
16375 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16376         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16377         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16378         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16379         return tag_ptr(ret_conv, true);
16380 }
16381
16382 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
16383         LDKCVec_PaymentPreimageZ _res_constr;
16384         _res_constr.datalen = _res->arr_len;
16385         if (_res_constr.datalen > 0)
16386                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
16387         else
16388                 _res_constr.data = NULL;
16389         int8_tArray* _res_vals = (void*) _res->elems;
16390         for (size_t m = 0; m < _res_constr.datalen; m++) {
16391                 int8_tArray _res_conv_12 = _res_vals[m];
16392                 LDKThirtyTwoBytes _res_conv_12_ref;
16393                 CHECK(_res_conv_12->arr_len == 32);
16394                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16395                 _res_constr.data[m] = _res_conv_12_ref;
16396         }
16397         FREE(_res);
16398         CVec_PaymentPreimageZ_free(_res_constr);
16399 }
16400
16401 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
16402         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16403         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
16404         return tag_ptr(ret_conv, true);
16405 }
16406 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
16407         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
16408         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
16409         return ret_conv;
16410 }
16411
16412 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
16413         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
16414         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16415         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
16416         return tag_ptr(ret_conv, true);
16417 }
16418
16419 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
16420         LDKSignature a_ref;
16421         CHECK(a->arr_len == 64);
16422         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
16423         LDKCVec_SignatureZ b_constr;
16424         b_constr.datalen = b->arr_len;
16425         if (b_constr.datalen > 0)
16426                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16427         else
16428                 b_constr.data = NULL;
16429         int8_tArray* b_vals = (void*) b->elems;
16430         for (size_t m = 0; m < b_constr.datalen; m++) {
16431                 int8_tArray b_conv_12 = b_vals[m];
16432                 LDKSignature b_conv_12_ref;
16433                 CHECK(b_conv_12->arr_len == 64);
16434                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
16435                 b_constr.data[m] = b_conv_12_ref;
16436         }
16437         FREE(b);
16438         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16439         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
16440         return tag_ptr(ret_conv, true);
16441 }
16442
16443 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
16444         if (!ptr_is_owned(_res)) return;
16445         void* _res_ptr = untag_ptr(_res);
16446         CHECK_ACCESS(_res_ptr);
16447         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
16448         FREE(untag_ptr(_res));
16449         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
16450 }
16451
16452 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
16453         void* o_ptr = untag_ptr(o);
16454         CHECK_ACCESS(o_ptr);
16455         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
16456         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
16457         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16458         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
16459         return tag_ptr(ret_conv, true);
16460 }
16461
16462 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
16463         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16464         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
16465         return tag_ptr(ret_conv, true);
16466 }
16467
16468 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
16469         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
16470         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
16471         return ret_conv;
16472 }
16473
16474 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
16475         if (!ptr_is_owned(_res)) return;
16476         void* _res_ptr = untag_ptr(_res);
16477         CHECK_ACCESS(_res_ptr);
16478         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
16479         FREE(untag_ptr(_res));
16480         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
16481 }
16482
16483 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
16484         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16485         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
16486         return tag_ptr(ret_conv, true);
16487 }
16488 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
16489         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
16490         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
16491         return ret_conv;
16492 }
16493
16494 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
16495         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
16496         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16497         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
16498         return tag_ptr(ret_conv, true);
16499 }
16500
16501 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
16502         LDKSignature o_ref;
16503         CHECK(o->arr_len == 64);
16504         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16505         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16506         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
16507         return tag_ptr(ret_conv, true);
16508 }
16509
16510 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
16511         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16512         *ret_conv = CResult_SignatureNoneZ_err();
16513         return tag_ptr(ret_conv, true);
16514 }
16515
16516 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
16517         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
16518         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
16519         return ret_conv;
16520 }
16521
16522 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
16523         if (!ptr_is_owned(_res)) return;
16524         void* _res_ptr = untag_ptr(_res);
16525         CHECK_ACCESS(_res_ptr);
16526         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
16527         FREE(untag_ptr(_res));
16528         CResult_SignatureNoneZ_free(_res_conv);
16529 }
16530
16531 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
16532         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16533         *ret_conv = CResult_SignatureNoneZ_clone(arg);
16534         return tag_ptr(ret_conv, true);
16535 }
16536 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
16537         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
16538         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
16539         return ret_conv;
16540 }
16541
16542 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
16543         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
16544         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16545         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
16546         return tag_ptr(ret_conv, true);
16547 }
16548
16549 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
16550         LDKPublicKey o_ref;
16551         CHECK(o->arr_len == 33);
16552         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
16553         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16554         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
16555         return tag_ptr(ret_conv, true);
16556 }
16557
16558 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
16559         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16560         *ret_conv = CResult_PublicKeyNoneZ_err();
16561         return tag_ptr(ret_conv, true);
16562 }
16563
16564 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
16565         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
16566         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
16567         return ret_conv;
16568 }
16569
16570 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
16571         if (!ptr_is_owned(_res)) return;
16572         void* _res_ptr = untag_ptr(_res);
16573         CHECK_ACCESS(_res_ptr);
16574         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
16575         FREE(untag_ptr(_res));
16576         CResult_PublicKeyNoneZ_free(_res_conv);
16577 }
16578
16579 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
16580         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16581         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
16582         return tag_ptr(ret_conv, true);
16583 }
16584 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
16585         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
16586         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
16587         return ret_conv;
16588 }
16589
16590 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
16591         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16592         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16593         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16594         return tag_ptr(ret_conv, true);
16595 }
16596
16597 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
16598         void* o_ptr = untag_ptr(o);
16599         CHECK_ACCESS(o_ptr);
16600         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16601         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16602         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16603         *ret_copy = COption_ScalarZ_some(o_conv);
16604         uint64_t ret_ref = tag_ptr(ret_copy, true);
16605         return ret_ref;
16606 }
16607
16608 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
16609         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16610         *ret_copy = COption_ScalarZ_none();
16611         uint64_t ret_ref = tag_ptr(ret_copy, true);
16612         return ret_ref;
16613 }
16614
16615 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
16616         if (!ptr_is_owned(_res)) return;
16617         void* _res_ptr = untag_ptr(_res);
16618         CHECK_ACCESS(_res_ptr);
16619         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
16620         FREE(untag_ptr(_res));
16621         COption_ScalarZ_free(_res_conv);
16622 }
16623
16624 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
16625         LDKThirtyTwoBytes o_ref;
16626         CHECK(o->arr_len == 32);
16627         memcpy(o_ref.data, o->elems, 32); FREE(o);
16628         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16629         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
16630         return tag_ptr(ret_conv, true);
16631 }
16632
16633 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
16634         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16635         *ret_conv = CResult_SharedSecretNoneZ_err();
16636         return tag_ptr(ret_conv, true);
16637 }
16638
16639 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
16640         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
16641         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
16642         return ret_conv;
16643 }
16644
16645 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
16646         if (!ptr_is_owned(_res)) return;
16647         void* _res_ptr = untag_ptr(_res);
16648         CHECK_ACCESS(_res_ptr);
16649         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
16650         FREE(untag_ptr(_res));
16651         CResult_SharedSecretNoneZ_free(_res_conv);
16652 }
16653
16654 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16655         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16656         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16657         return tag_ptr(ret_conv, true);
16658 }
16659 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16660         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16661         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16662         return ret_conv;
16663 }
16664
16665 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16666         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16667         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16668         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16669         return tag_ptr(ret_conv, true);
16670 }
16671
16672 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16673         LDKCVec_U5Z _res_constr;
16674         _res_constr.datalen = _res->arr_len;
16675         if (_res_constr.datalen > 0)
16676                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16677         else
16678                 _res_constr.data = NULL;
16679         int8_t* _res_vals = (void*) _res->elems;
16680         for (size_t h = 0; h < _res_constr.datalen; h++) {
16681                 int8_t _res_conv_7 = _res_vals[h];
16682                 
16683                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16684         }
16685         FREE(_res);
16686         CVec_U5Z_free(_res_constr);
16687 }
16688
16689 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16690         LDKRecoverableSignature o_ref;
16691         CHECK(o->arr_len == 68);
16692         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16693         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16694         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16695         return tag_ptr(ret_conv, true);
16696 }
16697
16698 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16699         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16700         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16701         return tag_ptr(ret_conv, true);
16702 }
16703
16704 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16705         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16706         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16707         return ret_conv;
16708 }
16709
16710 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16711         if (!ptr_is_owned(_res)) return;
16712         void* _res_ptr = untag_ptr(_res);
16713         CHECK_ACCESS(_res_ptr);
16714         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16715         FREE(untag_ptr(_res));
16716         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16717 }
16718
16719 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16720         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16721         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16722         return tag_ptr(ret_conv, true);
16723 }
16724 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16725         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16726         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16727         return ret_conv;
16728 }
16729
16730 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16731         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16732         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16733         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16734         return tag_ptr(ret_conv, true);
16735 }
16736
16737 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16738         void* o_ptr = untag_ptr(o);
16739         CHECK_ACCESS(o_ptr);
16740         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16741         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16742                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16743                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16744         }
16745         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16746         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16747         return tag_ptr(ret_conv, true);
16748 }
16749
16750 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16751         void* e_ptr = untag_ptr(e);
16752         CHECK_ACCESS(e_ptr);
16753         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16754         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16755         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16756         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16757         return tag_ptr(ret_conv, true);
16758 }
16759
16760 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16761         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16762         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16763         return ret_conv;
16764 }
16765
16766 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16767         if (!ptr_is_owned(_res)) return;
16768         void* _res_ptr = untag_ptr(_res);
16769         CHECK_ACCESS(_res_ptr);
16770         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16771         FREE(untag_ptr(_res));
16772         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16773 }
16774
16775 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16776         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16777         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16778         return tag_ptr(ret_conv, true);
16779 }
16780 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16781         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16782         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16783         return ret_conv;
16784 }
16785
16786 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16787         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16788         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16789         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16790         return tag_ptr(ret_conv, true);
16791 }
16792
16793 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16794         LDKCVec_CVec_u8ZZ _res_constr;
16795         _res_constr.datalen = _res->arr_len;
16796         if (_res_constr.datalen > 0)
16797                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16798         else
16799                 _res_constr.data = NULL;
16800         int8_tArray* _res_vals = (void*) _res->elems;
16801         for (size_t m = 0; m < _res_constr.datalen; m++) {
16802                 int8_tArray _res_conv_12 = _res_vals[m];
16803                 LDKCVec_u8Z _res_conv_12_ref;
16804                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16805                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16806                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16807                 _res_constr.data[m] = _res_conv_12_ref;
16808         }
16809         FREE(_res);
16810         CVec_CVec_u8ZZ_free(_res_constr);
16811 }
16812
16813 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16814         LDKCVec_CVec_u8ZZ o_constr;
16815         o_constr.datalen = o->arr_len;
16816         if (o_constr.datalen > 0)
16817                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16818         else
16819                 o_constr.data = NULL;
16820         int8_tArray* o_vals = (void*) o->elems;
16821         for (size_t m = 0; m < o_constr.datalen; m++) {
16822                 int8_tArray o_conv_12 = o_vals[m];
16823                 LDKCVec_u8Z o_conv_12_ref;
16824                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16825                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16826                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16827                 o_constr.data[m] = o_conv_12_ref;
16828         }
16829         FREE(o);
16830         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16831         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16832         return tag_ptr(ret_conv, true);
16833 }
16834
16835 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16836         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16837         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16838         return tag_ptr(ret_conv, true);
16839 }
16840
16841 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16842         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16843         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16844         return ret_conv;
16845 }
16846
16847 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16848         if (!ptr_is_owned(_res)) return;
16849         void* _res_ptr = untag_ptr(_res);
16850         CHECK_ACCESS(_res_ptr);
16851         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16852         FREE(untag_ptr(_res));
16853         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16854 }
16855
16856 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16857         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16858         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16859         return tag_ptr(ret_conv, true);
16860 }
16861 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16862         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16863         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16864         return ret_conv;
16865 }
16866
16867 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16868         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16869         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16870         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16871         return tag_ptr(ret_conv, true);
16872 }
16873
16874 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16875         LDKInMemorySigner o_conv;
16876         o_conv.inner = untag_ptr(o);
16877         o_conv.is_owned = ptr_is_owned(o);
16878         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16879         o_conv = InMemorySigner_clone(&o_conv);
16880         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16881         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16882         return tag_ptr(ret_conv, true);
16883 }
16884
16885 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16886         void* e_ptr = untag_ptr(e);
16887         CHECK_ACCESS(e_ptr);
16888         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16889         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16890         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16891         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16892         return tag_ptr(ret_conv, true);
16893 }
16894
16895 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16896         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16897         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16898         return ret_conv;
16899 }
16900
16901 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16902         if (!ptr_is_owned(_res)) return;
16903         void* _res_ptr = untag_ptr(_res);
16904         CHECK_ACCESS(_res_ptr);
16905         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16906         FREE(untag_ptr(_res));
16907         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16908 }
16909
16910 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16911         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16912         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16913         return tag_ptr(ret_conv, true);
16914 }
16915 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16916         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16917         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16918         return ret_conv;
16919 }
16920
16921 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16922         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16923         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16924         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16925         return tag_ptr(ret_conv, true);
16926 }
16927
16928 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16929         LDKCVec_TxOutZ _res_constr;
16930         _res_constr.datalen = _res->arr_len;
16931         if (_res_constr.datalen > 0)
16932                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16933         else
16934                 _res_constr.data = NULL;
16935         uint64_t* _res_vals = _res->elems;
16936         for (size_t h = 0; h < _res_constr.datalen; h++) {
16937                 uint64_t _res_conv_7 = _res_vals[h];
16938                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16939                 CHECK_ACCESS(_res_conv_7_ptr);
16940                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16941                 FREE(untag_ptr(_res_conv_7));
16942                 _res_constr.data[h] = _res_conv_7_conv;
16943         }
16944         FREE(_res);
16945         CVec_TxOutZ_free(_res_constr);
16946 }
16947
16948 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16949         LDKTransaction o_ref;
16950         o_ref.datalen = o->arr_len;
16951         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16952         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16953         o_ref.data_is_owned = true;
16954         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16955         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16956         return tag_ptr(ret_conv, true);
16957 }
16958
16959 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16960         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16961         *ret_conv = CResult_TransactionNoneZ_err();
16962         return tag_ptr(ret_conv, true);
16963 }
16964
16965 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16966         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16967         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16968         return ret_conv;
16969 }
16970
16971 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16972         if (!ptr_is_owned(_res)) return;
16973         void* _res_ptr = untag_ptr(_res);
16974         CHECK_ACCESS(_res_ptr);
16975         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16976         FREE(untag_ptr(_res));
16977         CResult_TransactionNoneZ_free(_res_conv);
16978 }
16979
16980 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16981         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16982         *ret_conv = CResult_TransactionNoneZ_clone(arg);
16983         return tag_ptr(ret_conv, true);
16984 }
16985 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
16986         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
16987         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16988         return ret_conv;
16989 }
16990
16991 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
16992         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
16993         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16994         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16995         return tag_ptr(ret_conv, true);
16996 }
16997
16998 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
16999         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17000         *ret_copy = COption_u16Z_some(o);
17001         uint64_t ret_ref = tag_ptr(ret_copy, true);
17002         return ret_ref;
17003 }
17004
17005 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
17006         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17007         *ret_copy = COption_u16Z_none();
17008         uint64_t ret_ref = tag_ptr(ret_copy, true);
17009         return ret_ref;
17010 }
17011
17012 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
17013         if (!ptr_is_owned(_res)) return;
17014         void* _res_ptr = untag_ptr(_res);
17015         CHECK_ACCESS(_res_ptr);
17016         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17017         FREE(untag_ptr(_res));
17018         COption_u16Z_free(_res_conv);
17019 }
17020
17021 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17022         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17023         *ret_copy = COption_u16Z_clone(arg);
17024         uint64_t ret_ref = tag_ptr(ret_copy, true);
17025         return ret_ref;
17026 }
17027 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
17028         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
17029         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
17030         return ret_conv;
17031 }
17032
17033 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
17034         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
17035         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17036         *ret_copy = COption_u16Z_clone(orig_conv);
17037         uint64_t ret_ref = tag_ptr(ret_copy, true);
17038         return ret_ref;
17039 }
17040
17041 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
17042         LDKThirtyTwoBytes o_ref;
17043         CHECK(o->arr_len == 32);
17044         memcpy(o_ref.data, o->elems, 32); FREE(o);
17045         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17046         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
17047         return tag_ptr(ret_conv, true);
17048 }
17049
17050 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
17051         void* e_ptr = untag_ptr(e);
17052         CHECK_ACCESS(e_ptr);
17053         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17054         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17055         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17056         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
17057         return tag_ptr(ret_conv, true);
17058 }
17059
17060 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
17061         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
17062         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
17063         return ret_conv;
17064 }
17065
17066 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
17067         if (!ptr_is_owned(_res)) return;
17068         void* _res_ptr = untag_ptr(_res);
17069         CHECK_ACCESS(_res_ptr);
17070         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
17071         FREE(untag_ptr(_res));
17072         CResult__u832APIErrorZ_free(_res_conv);
17073 }
17074
17075 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
17076         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17077         *ret_conv = CResult__u832APIErrorZ_clone(arg);
17078         return tag_ptr(ret_conv, true);
17079 }
17080 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
17081         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
17082         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
17083         return ret_conv;
17084 }
17085
17086 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
17087         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
17088         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17089         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
17090         return tag_ptr(ret_conv, true);
17091 }
17092
17093 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
17094         LDKCVec_RecentPaymentDetailsZ _res_constr;
17095         _res_constr.datalen = _res->arr_len;
17096         if (_res_constr.datalen > 0)
17097                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
17098         else
17099                 _res_constr.data = NULL;
17100         uint64_t* _res_vals = _res->elems;
17101         for (size_t w = 0; w < _res_constr.datalen; w++) {
17102                 uint64_t _res_conv_22 = _res_vals[w];
17103                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
17104                 CHECK_ACCESS(_res_conv_22_ptr);
17105                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
17106                 FREE(untag_ptr(_res_conv_22));
17107                 _res_constr.data[w] = _res_conv_22_conv;
17108         }
17109         FREE(_res);
17110         CVec_RecentPaymentDetailsZ_free(_res_constr);
17111 }
17112
17113 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
17114         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17115         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
17116         return tag_ptr(ret_conv, true);
17117 }
17118
17119 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
17120         void* e_ptr = untag_ptr(e);
17121         CHECK_ACCESS(e_ptr);
17122         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17123         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17124         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17125         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
17126         return tag_ptr(ret_conv, true);
17127 }
17128
17129 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
17130         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
17131         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
17132         return ret_conv;
17133 }
17134
17135 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
17136         if (!ptr_is_owned(_res)) return;
17137         void* _res_ptr = untag_ptr(_res);
17138         CHECK_ACCESS(_res_ptr);
17139         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
17140         FREE(untag_ptr(_res));
17141         CResult_NonePaymentSendFailureZ_free(_res_conv);
17142 }
17143
17144 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
17145         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17146         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
17147         return tag_ptr(ret_conv, true);
17148 }
17149 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
17150         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
17151         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
17152         return ret_conv;
17153 }
17154
17155 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
17156         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
17157         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17158         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
17159         return tag_ptr(ret_conv, true);
17160 }
17161
17162 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
17163         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17164         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
17165         return tag_ptr(ret_conv, true);
17166 }
17167
17168 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
17169         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
17170         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17171         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
17172         return tag_ptr(ret_conv, true);
17173 }
17174
17175 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
17176         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
17177         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
17178         return ret_conv;
17179 }
17180
17181 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
17182         if (!ptr_is_owned(_res)) return;
17183         void* _res_ptr = untag_ptr(_res);
17184         CHECK_ACCESS(_res_ptr);
17185         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
17186         FREE(untag_ptr(_res));
17187         CResult_NoneRetryableSendFailureZ_free(_res_conv);
17188 }
17189
17190 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
17191         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17192         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
17193         return tag_ptr(ret_conv, true);
17194 }
17195 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
17196         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
17197         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
17198         return ret_conv;
17199 }
17200
17201 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
17202         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
17203         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17204         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
17205         return tag_ptr(ret_conv, true);
17206 }
17207
17208 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
17209         LDKThirtyTwoBytes o_ref;
17210         CHECK(o->arr_len == 32);
17211         memcpy(o_ref.data, o->elems, 32); FREE(o);
17212         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17213         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
17214         return tag_ptr(ret_conv, true);
17215 }
17216
17217 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
17218         void* e_ptr = untag_ptr(e);
17219         CHECK_ACCESS(e_ptr);
17220         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17221         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17222         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17223         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
17224         return tag_ptr(ret_conv, true);
17225 }
17226
17227 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
17228         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
17229         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
17230         return ret_conv;
17231 }
17232
17233 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
17234         if (!ptr_is_owned(_res)) return;
17235         void* _res_ptr = untag_ptr(_res);
17236         CHECK_ACCESS(_res_ptr);
17237         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
17238         FREE(untag_ptr(_res));
17239         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
17240 }
17241
17242 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
17243         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17244         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
17245         return tag_ptr(ret_conv, true);
17246 }
17247 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
17248         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
17249         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
17250         return ret_conv;
17251 }
17252
17253 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
17254         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
17255         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17256         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
17257         return tag_ptr(ret_conv, true);
17258 }
17259
17260 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_ok(int8_tArray o) {
17261         LDKThirtyTwoBytes o_ref;
17262         CHECK(o->arr_len == 32);
17263         memcpy(o_ref.data, o->elems, 32); FREE(o);
17264         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17265         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
17266         return tag_ptr(ret_conv, true);
17267 }
17268
17269 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_err(uint32_t e) {
17270         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
17271         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17272         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
17273         return tag_ptr(ret_conv, true);
17274 }
17275
17276 jboolean  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_is_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_is_ok(uint64_t o) {
17277         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
17278         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
17279         return ret_conv;
17280 }
17281
17282 void  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_free"))) TS_CResult_PaymentHashRetryableSendFailureZ_free(uint64_t _res) {
17283         if (!ptr_is_owned(_res)) return;
17284         void* _res_ptr = untag_ptr(_res);
17285         CHECK_ACCESS(_res_ptr);
17286         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
17287         FREE(untag_ptr(_res));
17288         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
17289 }
17290
17291 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
17292         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17293         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
17294         return tag_ptr(ret_conv, true);
17295 }
17296 int64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr(uint64_t arg) {
17297         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
17298         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
17299         return ret_conv;
17300 }
17301
17302 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone(uint64_t orig) {
17303         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
17304         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17305         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
17306         return tag_ptr(ret_conv, true);
17307 }
17308
17309 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
17310         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17311         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
17312         return tag_ptr(ret_conv, true);
17313 }
17314 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
17315         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
17316         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
17317         return ret_conv;
17318 }
17319
17320 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
17321         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
17322         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17323         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
17324         return tag_ptr(ret_conv, true);
17325 }
17326
17327 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
17328         LDKThirtyTwoBytes a_ref;
17329         CHECK(a->arr_len == 32);
17330         memcpy(a_ref.data, a->elems, 32); FREE(a);
17331         LDKThirtyTwoBytes b_ref;
17332         CHECK(b->arr_len == 32);
17333         memcpy(b_ref.data, b->elems, 32); FREE(b);
17334         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17335         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
17336         return tag_ptr(ret_conv, true);
17337 }
17338
17339 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
17340         if (!ptr_is_owned(_res)) return;
17341         void* _res_ptr = untag_ptr(_res);
17342         CHECK_ACCESS(_res_ptr);
17343         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
17344         FREE(untag_ptr(_res));
17345         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
17346 }
17347
17348 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
17349         void* o_ptr = untag_ptr(o);
17350         CHECK_ACCESS(o_ptr);
17351         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
17352         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
17353         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17354         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
17355         return tag_ptr(ret_conv, true);
17356 }
17357
17358 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
17359         void* e_ptr = untag_ptr(e);
17360         CHECK_ACCESS(e_ptr);
17361         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17362         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17363         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17364         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
17365         return tag_ptr(ret_conv, true);
17366 }
17367
17368 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
17369         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
17370         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
17371         return ret_conv;
17372 }
17373
17374 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
17375         if (!ptr_is_owned(_res)) return;
17376         void* _res_ptr = untag_ptr(_res);
17377         CHECK_ACCESS(_res_ptr);
17378         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
17379         FREE(untag_ptr(_res));
17380         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
17381 }
17382
17383 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
17384         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17385         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
17386         return tag_ptr(ret_conv, true);
17387 }
17388 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
17389         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
17390         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
17391         return ret_conv;
17392 }
17393
17394 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
17395         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
17396         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17397         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
17398         return tag_ptr(ret_conv, true);
17399 }
17400
17401 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
17402         LDKCVec_ThirtyTwoBytesZ _res_constr;
17403         _res_constr.datalen = _res->arr_len;
17404         if (_res_constr.datalen > 0)
17405                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17406         else
17407                 _res_constr.data = NULL;
17408         int8_tArray* _res_vals = (void*) _res->elems;
17409         for (size_t m = 0; m < _res_constr.datalen; m++) {
17410                 int8_tArray _res_conv_12 = _res_vals[m];
17411                 LDKThirtyTwoBytes _res_conv_12_ref;
17412                 CHECK(_res_conv_12->arr_len == 32);
17413                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
17414                 _res_constr.data[m] = _res_conv_12_ref;
17415         }
17416         FREE(_res);
17417         CVec_ThirtyTwoBytesZ_free(_res_constr);
17418 }
17419
17420 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
17421         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17422         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
17423         return tag_ptr(ret_conv, true);
17424 }
17425 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
17426         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
17427         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
17428         return ret_conv;
17429 }
17430
17431 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
17432         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
17433         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17434         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
17435         return tag_ptr(ret_conv, true);
17436 }
17437
17438 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
17439         LDKThirtyTwoBytes a_ref;
17440         CHECK(a->arr_len == 32);
17441         memcpy(a_ref.data, a->elems, 32); FREE(a);
17442         LDKThirtyTwoBytes b_ref;
17443         CHECK(b->arr_len == 32);
17444         memcpy(b_ref.data, b->elems, 32); FREE(b);
17445         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17446         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
17447         return tag_ptr(ret_conv, true);
17448 }
17449
17450 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
17451         if (!ptr_is_owned(_res)) return;
17452         void* _res_ptr = untag_ptr(_res);
17453         CHECK_ACCESS(_res_ptr);
17454         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
17455         FREE(untag_ptr(_res));
17456         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
17457 }
17458
17459 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
17460         void* o_ptr = untag_ptr(o);
17461         CHECK_ACCESS(o_ptr);
17462         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17463         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
17464         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17465         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
17466         return tag_ptr(ret_conv, true);
17467 }
17468
17469 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
17470         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17471         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
17472         return tag_ptr(ret_conv, true);
17473 }
17474
17475 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
17476         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
17477         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
17478         return ret_conv;
17479 }
17480
17481 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
17482         if (!ptr_is_owned(_res)) return;
17483         void* _res_ptr = untag_ptr(_res);
17484         CHECK_ACCESS(_res_ptr);
17485         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
17486         FREE(untag_ptr(_res));
17487         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
17488 }
17489
17490 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
17491         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17492         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
17493         return tag_ptr(ret_conv, true);
17494 }
17495 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
17496         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
17497         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
17498         return ret_conv;
17499 }
17500
17501 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
17502         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
17503         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17504         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
17505         return tag_ptr(ret_conv, true);
17506 }
17507
17508 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
17509         void* o_ptr = untag_ptr(o);
17510         CHECK_ACCESS(o_ptr);
17511         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17512         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
17513         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17514         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
17515         return tag_ptr(ret_conv, true);
17516 }
17517
17518 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
17519         void* e_ptr = untag_ptr(e);
17520         CHECK_ACCESS(e_ptr);
17521         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17522         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17523         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17524         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
17525         return tag_ptr(ret_conv, true);
17526 }
17527
17528 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
17529         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
17530         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
17531         return ret_conv;
17532 }
17533
17534 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
17535         if (!ptr_is_owned(_res)) return;
17536         void* _res_ptr = untag_ptr(_res);
17537         CHECK_ACCESS(_res_ptr);
17538         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
17539         FREE(untag_ptr(_res));
17540         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
17541 }
17542
17543 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
17544         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17545         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
17546         return tag_ptr(ret_conv, true);
17547 }
17548 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
17549         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
17550         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
17551         return ret_conv;
17552 }
17553
17554 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
17555         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
17556         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17557         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
17558         return tag_ptr(ret_conv, true);
17559 }
17560
17561 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
17562         LDKThirtyTwoBytes o_ref;
17563         CHECK(o->arr_len == 32);
17564         memcpy(o_ref.data, o->elems, 32); FREE(o);
17565         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17566         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
17567         return tag_ptr(ret_conv, true);
17568 }
17569
17570 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
17571         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17572         *ret_conv = CResult_PaymentSecretNoneZ_err();
17573         return tag_ptr(ret_conv, true);
17574 }
17575
17576 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
17577         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
17578         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
17579         return ret_conv;
17580 }
17581
17582 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
17583         if (!ptr_is_owned(_res)) return;
17584         void* _res_ptr = untag_ptr(_res);
17585         CHECK_ACCESS(_res_ptr);
17586         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
17587         FREE(untag_ptr(_res));
17588         CResult_PaymentSecretNoneZ_free(_res_conv);
17589 }
17590
17591 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
17592         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17593         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
17594         return tag_ptr(ret_conv, true);
17595 }
17596 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
17597         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
17598         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
17599         return ret_conv;
17600 }
17601
17602 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
17603         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
17604         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17605         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
17606         return tag_ptr(ret_conv, true);
17607 }
17608
17609 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
17610         LDKThirtyTwoBytes o_ref;
17611         CHECK(o->arr_len == 32);
17612         memcpy(o_ref.data, o->elems, 32); FREE(o);
17613         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17614         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
17615         return tag_ptr(ret_conv, true);
17616 }
17617
17618 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
17619         void* e_ptr = untag_ptr(e);
17620         CHECK_ACCESS(e_ptr);
17621         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17622         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17623         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17624         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
17625         return tag_ptr(ret_conv, true);
17626 }
17627
17628 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
17629         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
17630         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
17631         return ret_conv;
17632 }
17633
17634 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
17635         if (!ptr_is_owned(_res)) return;
17636         void* _res_ptr = untag_ptr(_res);
17637         CHECK_ACCESS(_res_ptr);
17638         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
17639         FREE(untag_ptr(_res));
17640         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
17641 }
17642
17643 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
17644         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17645         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
17646         return tag_ptr(ret_conv, true);
17647 }
17648 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
17649         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
17650         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
17651         return ret_conv;
17652 }
17653
17654 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
17655         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
17656         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17657         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
17658         return tag_ptr(ret_conv, true);
17659 }
17660
17661 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
17662         LDKThirtyTwoBytes o_ref;
17663         CHECK(o->arr_len == 32);
17664         memcpy(o_ref.data, o->elems, 32); FREE(o);
17665         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17666         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
17667         return tag_ptr(ret_conv, true);
17668 }
17669
17670 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
17671         void* e_ptr = untag_ptr(e);
17672         CHECK_ACCESS(e_ptr);
17673         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17674         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17675         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17676         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17677         return tag_ptr(ret_conv, true);
17678 }
17679
17680 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
17681         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
17682         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17683         return ret_conv;
17684 }
17685
17686 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
17687         if (!ptr_is_owned(_res)) return;
17688         void* _res_ptr = untag_ptr(_res);
17689         CHECK_ACCESS(_res_ptr);
17690         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17691         FREE(untag_ptr(_res));
17692         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17693 }
17694
17695 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17696         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17697         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17698         return tag_ptr(ret_conv, true);
17699 }
17700 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
17701         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
17702         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17703         return ret_conv;
17704 }
17705
17706 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
17707         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
17708         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17709         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17710         return tag_ptr(ret_conv, true);
17711 }
17712
17713 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
17714         LDKCounterpartyForwardingInfo o_conv;
17715         o_conv.inner = untag_ptr(o);
17716         o_conv.is_owned = ptr_is_owned(o);
17717         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17718         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17719         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17720         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17721         return tag_ptr(ret_conv, true);
17722 }
17723
17724 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
17725         void* e_ptr = untag_ptr(e);
17726         CHECK_ACCESS(e_ptr);
17727         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17728         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17729         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17730         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17731         return tag_ptr(ret_conv, true);
17732 }
17733
17734 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
17735         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
17736         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17737         return ret_conv;
17738 }
17739
17740 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
17741         if (!ptr_is_owned(_res)) return;
17742         void* _res_ptr = untag_ptr(_res);
17743         CHECK_ACCESS(_res_ptr);
17744         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17745         FREE(untag_ptr(_res));
17746         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17747 }
17748
17749 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17750         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17751         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17752         return tag_ptr(ret_conv, true);
17753 }
17754 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17755         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
17756         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17757         return ret_conv;
17758 }
17759
17760 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
17761         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
17762         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17763         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17764         return tag_ptr(ret_conv, true);
17765 }
17766
17767 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
17768         LDKChannelCounterparty o_conv;
17769         o_conv.inner = untag_ptr(o);
17770         o_conv.is_owned = ptr_is_owned(o);
17771         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17772         o_conv = ChannelCounterparty_clone(&o_conv);
17773         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17774         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17775         return tag_ptr(ret_conv, true);
17776 }
17777
17778 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
17779         void* e_ptr = untag_ptr(e);
17780         CHECK_ACCESS(e_ptr);
17781         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17782         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17783         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17784         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17785         return tag_ptr(ret_conv, true);
17786 }
17787
17788 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
17789         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
17790         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17791         return ret_conv;
17792 }
17793
17794 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
17795         if (!ptr_is_owned(_res)) return;
17796         void* _res_ptr = untag_ptr(_res);
17797         CHECK_ACCESS(_res_ptr);
17798         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
17799         FREE(untag_ptr(_res));
17800         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
17801 }
17802
17803 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
17804         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17805         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
17806         return tag_ptr(ret_conv, true);
17807 }
17808 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
17809         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
17810         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
17811         return ret_conv;
17812 }
17813
17814 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
17815         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
17816         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17817         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
17818         return tag_ptr(ret_conv, true);
17819 }
17820
17821 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
17822         LDKChannelDetails o_conv;
17823         o_conv.inner = untag_ptr(o);
17824         o_conv.is_owned = ptr_is_owned(o);
17825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17826         o_conv = ChannelDetails_clone(&o_conv);
17827         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17828         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
17829         return tag_ptr(ret_conv, true);
17830 }
17831
17832 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
17833         void* e_ptr = untag_ptr(e);
17834         CHECK_ACCESS(e_ptr);
17835         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17836         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17837         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17838         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
17839         return tag_ptr(ret_conv, true);
17840 }
17841
17842 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
17843         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
17844         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
17845         return ret_conv;
17846 }
17847
17848 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
17849         if (!ptr_is_owned(_res)) return;
17850         void* _res_ptr = untag_ptr(_res);
17851         CHECK_ACCESS(_res_ptr);
17852         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
17853         FREE(untag_ptr(_res));
17854         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
17855 }
17856
17857 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
17858         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17859         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
17860         return tag_ptr(ret_conv, true);
17861 }
17862 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
17863         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
17864         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
17865         return ret_conv;
17866 }
17867
17868 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
17869         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
17870         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17871         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
17872         return tag_ptr(ret_conv, true);
17873 }
17874
17875 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
17876         LDKPhantomRouteHints o_conv;
17877         o_conv.inner = untag_ptr(o);
17878         o_conv.is_owned = ptr_is_owned(o);
17879         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17880         o_conv = PhantomRouteHints_clone(&o_conv);
17881         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17882         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
17883         return tag_ptr(ret_conv, true);
17884 }
17885
17886 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
17887         void* e_ptr = untag_ptr(e);
17888         CHECK_ACCESS(e_ptr);
17889         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17890         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17891         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17892         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
17893         return tag_ptr(ret_conv, true);
17894 }
17895
17896 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
17897         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
17898         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
17899         return ret_conv;
17900 }
17901
17902 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
17903         if (!ptr_is_owned(_res)) return;
17904         void* _res_ptr = untag_ptr(_res);
17905         CHECK_ACCESS(_res_ptr);
17906         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
17907         FREE(untag_ptr(_res));
17908         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
17909 }
17910
17911 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
17912         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17913         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
17914         return tag_ptr(ret_conv, true);
17915 }
17916 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
17917         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
17918         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
17919         return ret_conv;
17920 }
17921
17922 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
17923         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
17924         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17925         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
17926         return tag_ptr(ret_conv, true);
17927 }
17928
17929 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
17930         LDKCVec_ChannelMonitorZ _res_constr;
17931         _res_constr.datalen = _res->arr_len;
17932         if (_res_constr.datalen > 0)
17933                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17934         else
17935                 _res_constr.data = NULL;
17936         uint64_t* _res_vals = _res->elems;
17937         for (size_t q = 0; q < _res_constr.datalen; q++) {
17938                 uint64_t _res_conv_16 = _res_vals[q];
17939                 LDKChannelMonitor _res_conv_16_conv;
17940                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17941                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17942                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17943                 _res_constr.data[q] = _res_conv_16_conv;
17944         }
17945         FREE(_res);
17946         CVec_ChannelMonitorZ_free(_res_constr);
17947 }
17948
17949 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
17950         LDKThirtyTwoBytes a_ref;
17951         CHECK(a->arr_len == 32);
17952         memcpy(a_ref.data, a->elems, 32); FREE(a);
17953         LDKChannelManager b_conv;
17954         b_conv.inner = untag_ptr(b);
17955         b_conv.is_owned = ptr_is_owned(b);
17956         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17957         // WARNING: we need a move here but no clone is available for LDKChannelManager
17958         
17959         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
17960         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
17961         return tag_ptr(ret_conv, true);
17962 }
17963
17964 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
17965         if (!ptr_is_owned(_res)) return;
17966         void* _res_ptr = untag_ptr(_res);
17967         CHECK_ACCESS(_res_ptr);
17968         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
17969         FREE(untag_ptr(_res));
17970         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
17971 }
17972
17973 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
17974         void* o_ptr = untag_ptr(o);
17975         CHECK_ACCESS(o_ptr);
17976         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
17977         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
17978         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17979         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
17980         return tag_ptr(ret_conv, true);
17981 }
17982
17983 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
17984         void* e_ptr = untag_ptr(e);
17985         CHECK_ACCESS(e_ptr);
17986         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17987         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17988         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17989         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
17990         return tag_ptr(ret_conv, true);
17991 }
17992
17993 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
17994         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
17995         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
17996         return ret_conv;
17997 }
17998
17999 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
18000         if (!ptr_is_owned(_res)) return;
18001         void* _res_ptr = untag_ptr(_res);
18002         CHECK_ACCESS(_res_ptr);
18003         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
18004         FREE(untag_ptr(_res));
18005         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
18006 }
18007
18008 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
18009         LDKChannelConfig o_conv;
18010         o_conv.inner = untag_ptr(o);
18011         o_conv.is_owned = ptr_is_owned(o);
18012         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18013         o_conv = ChannelConfig_clone(&o_conv);
18014         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18015         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
18016         return tag_ptr(ret_conv, true);
18017 }
18018
18019 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
18020         void* e_ptr = untag_ptr(e);
18021         CHECK_ACCESS(e_ptr);
18022         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18023         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18024         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18025         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
18026         return tag_ptr(ret_conv, true);
18027 }
18028
18029 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
18030         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
18031         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
18032         return ret_conv;
18033 }
18034
18035 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
18036         if (!ptr_is_owned(_res)) return;
18037         void* _res_ptr = untag_ptr(_res);
18038         CHECK_ACCESS(_res_ptr);
18039         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
18040         FREE(untag_ptr(_res));
18041         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
18042 }
18043
18044 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
18045         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18046         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
18047         return tag_ptr(ret_conv, true);
18048 }
18049 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
18050         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
18051         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
18052         return ret_conv;
18053 }
18054
18055 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
18056         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
18057         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18058         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
18059         return tag_ptr(ret_conv, true);
18060 }
18061
18062 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
18063         void* o_ptr = untag_ptr(o);
18064         CHECK_ACCESS(o_ptr);
18065         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
18066         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
18067         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18068         *ret_copy = COption_APIErrorZ_some(o_conv);
18069         uint64_t ret_ref = tag_ptr(ret_copy, true);
18070         return ret_ref;
18071 }
18072
18073 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
18074         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18075         *ret_copy = COption_APIErrorZ_none();
18076         uint64_t ret_ref = tag_ptr(ret_copy, true);
18077         return ret_ref;
18078 }
18079
18080 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
18081         if (!ptr_is_owned(_res)) return;
18082         void* _res_ptr = untag_ptr(_res);
18083         CHECK_ACCESS(_res_ptr);
18084         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
18085         FREE(untag_ptr(_res));
18086         COption_APIErrorZ_free(_res_conv);
18087 }
18088
18089 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
18090         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18091         *ret_copy = COption_APIErrorZ_clone(arg);
18092         uint64_t ret_ref = tag_ptr(ret_copy, true);
18093         return ret_ref;
18094 }
18095 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
18096         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
18097         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
18098         return ret_conv;
18099 }
18100
18101 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
18102         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
18103         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18104         *ret_copy = COption_APIErrorZ_clone(orig_conv);
18105         uint64_t ret_ref = tag_ptr(ret_copy, true);
18106         return ret_ref;
18107 }
18108
18109 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
18110         void* o_ptr = untag_ptr(o);
18111         CHECK_ACCESS(o_ptr);
18112         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
18113         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
18114         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18115         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
18116         return tag_ptr(ret_conv, true);
18117 }
18118
18119 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
18120         void* e_ptr = untag_ptr(e);
18121         CHECK_ACCESS(e_ptr);
18122         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18123         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18124         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18125         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
18126         return tag_ptr(ret_conv, true);
18127 }
18128
18129 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
18130         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
18131         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
18132         return ret_conv;
18133 }
18134
18135 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
18136         if (!ptr_is_owned(_res)) return;
18137         void* _res_ptr = untag_ptr(_res);
18138         CHECK_ACCESS(_res_ptr);
18139         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
18140         FREE(untag_ptr(_res));
18141         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
18142 }
18143
18144 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
18145         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18146         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
18147         return tag_ptr(ret_conv, true);
18148 }
18149 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18150         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
18151         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
18152         return ret_conv;
18153 }
18154
18155 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
18156         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
18157         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18158         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
18159         return tag_ptr(ret_conv, true);
18160 }
18161
18162 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
18163         LDKUntrustedString o_conv;
18164         o_conv.inner = untag_ptr(o);
18165         o_conv.is_owned = ptr_is_owned(o);
18166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18167         o_conv = UntrustedString_clone(&o_conv);
18168         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18169         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
18170         return tag_ptr(ret_conv, true);
18171 }
18172
18173 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
18174         void* e_ptr = untag_ptr(e);
18175         CHECK_ACCESS(e_ptr);
18176         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18177         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18178         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18179         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
18180         return tag_ptr(ret_conv, true);
18181 }
18182
18183 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
18184         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
18185         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
18186         return ret_conv;
18187 }
18188
18189 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
18190         if (!ptr_is_owned(_res)) return;
18191         void* _res_ptr = untag_ptr(_res);
18192         CHECK_ACCESS(_res_ptr);
18193         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
18194         FREE(untag_ptr(_res));
18195         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
18196 }
18197
18198 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
18199         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18200         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
18201         return tag_ptr(ret_conv, true);
18202 }
18203 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
18204         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
18205         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
18206         return ret_conv;
18207 }
18208
18209 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
18210         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
18211         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18212         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
18213         return tag_ptr(ret_conv, true);
18214 }
18215
18216 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
18217         LDKOutPoint o_conv;
18218         o_conv.inner = untag_ptr(o);
18219         o_conv.is_owned = ptr_is_owned(o);
18220         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18221         o_conv = OutPoint_clone(&o_conv);
18222         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18223         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
18224         return tag_ptr(ret_conv, true);
18225 }
18226
18227 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
18228         void* e_ptr = untag_ptr(e);
18229         CHECK_ACCESS(e_ptr);
18230         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18231         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18232         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18233         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
18234         return tag_ptr(ret_conv, true);
18235 }
18236
18237 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
18238         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
18239         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
18240         return ret_conv;
18241 }
18242
18243 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
18244         if (!ptr_is_owned(_res)) return;
18245         void* _res_ptr = untag_ptr(_res);
18246         CHECK_ACCESS(_res_ptr);
18247         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
18248         FREE(untag_ptr(_res));
18249         CResult_OutPointDecodeErrorZ_free(_res_conv);
18250 }
18251
18252 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
18253         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18254         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
18255         return tag_ptr(ret_conv, true);
18256 }
18257 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
18258         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
18259         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
18260         return ret_conv;
18261 }
18262
18263 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
18264         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
18265         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18266         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
18267         return tag_ptr(ret_conv, true);
18268 }
18269
18270 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
18271         void* o_ptr = untag_ptr(o);
18272         CHECK_ACCESS(o_ptr);
18273         LDKType o_conv = *(LDKType*)(o_ptr);
18274         if (o_conv.free == LDKType_JCalls_free) {
18275                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18276                 LDKType_JCalls_cloned(&o_conv);
18277         }
18278         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18279         *ret_copy = COption_TypeZ_some(o_conv);
18280         uint64_t ret_ref = tag_ptr(ret_copy, true);
18281         return ret_ref;
18282 }
18283
18284 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
18285         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18286         *ret_copy = COption_TypeZ_none();
18287         uint64_t ret_ref = tag_ptr(ret_copy, true);
18288         return ret_ref;
18289 }
18290
18291 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
18292         if (!ptr_is_owned(_res)) return;
18293         void* _res_ptr = untag_ptr(_res);
18294         CHECK_ACCESS(_res_ptr);
18295         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
18296         FREE(untag_ptr(_res));
18297         COption_TypeZ_free(_res_conv);
18298 }
18299
18300 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
18301         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18302         *ret_copy = COption_TypeZ_clone(arg);
18303         uint64_t ret_ref = tag_ptr(ret_copy, true);
18304         return ret_ref;
18305 }
18306 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
18307         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
18308         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
18309         return ret_conv;
18310 }
18311
18312 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
18313         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
18314         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18315         *ret_copy = COption_TypeZ_clone(orig_conv);
18316         uint64_t ret_ref = tag_ptr(ret_copy, true);
18317         return ret_ref;
18318 }
18319
18320 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
18321         void* o_ptr = untag_ptr(o);
18322         CHECK_ACCESS(o_ptr);
18323         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
18324         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
18325         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18326         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
18327         return tag_ptr(ret_conv, true);
18328 }
18329
18330 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
18331         void* e_ptr = untag_ptr(e);
18332         CHECK_ACCESS(e_ptr);
18333         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18334         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18335         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18336         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
18337         return tag_ptr(ret_conv, true);
18338 }
18339
18340 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
18341         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
18342         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
18343         return ret_conv;
18344 }
18345
18346 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
18347         if (!ptr_is_owned(_res)) return;
18348         void* _res_ptr = untag_ptr(_res);
18349         CHECK_ACCESS(_res_ptr);
18350         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
18351         FREE(untag_ptr(_res));
18352         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
18353 }
18354
18355 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
18356         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18357         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
18358         return tag_ptr(ret_conv, true);
18359 }
18360 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
18361         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
18362         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
18363         return ret_conv;
18364 }
18365
18366 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
18367         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
18368         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18369         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
18370         return tag_ptr(ret_conv, true);
18371 }
18372
18373 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
18374         LDKThirtyTwoBytes o_ref;
18375         CHECK(o->arr_len == 32);
18376         memcpy(o_ref.data, o->elems, 32); FREE(o);
18377         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18378         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
18379         return tag_ptr(ret_conv, true);
18380 }
18381
18382 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
18383         void* e_ptr = untag_ptr(e);
18384         CHECK_ACCESS(e_ptr);
18385         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18386         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
18387         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18388         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
18389         return tag_ptr(ret_conv, true);
18390 }
18391
18392 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
18393         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
18394         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
18395         return ret_conv;
18396 }
18397
18398 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
18399         if (!ptr_is_owned(_res)) return;
18400         void* _res_ptr = untag_ptr(_res);
18401         CHECK_ACCESS(_res_ptr);
18402         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
18403         FREE(untag_ptr(_res));
18404         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
18405 }
18406
18407 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
18408         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18409         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
18410         return tag_ptr(ret_conv, true);
18411 }
18412 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
18413         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
18414         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
18415         return ret_conv;
18416 }
18417
18418 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
18419         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
18420         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18421         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
18422         return tag_ptr(ret_conv, true);
18423 }
18424
18425 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
18426         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18427         *ret_conv = CResult_NonePaymentErrorZ_ok();
18428         return tag_ptr(ret_conv, true);
18429 }
18430
18431 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
18432         void* e_ptr = untag_ptr(e);
18433         CHECK_ACCESS(e_ptr);
18434         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18435         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
18436         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18437         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
18438         return tag_ptr(ret_conv, true);
18439 }
18440
18441 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
18442         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
18443         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
18444         return ret_conv;
18445 }
18446
18447 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
18448         if (!ptr_is_owned(_res)) return;
18449         void* _res_ptr = untag_ptr(_res);
18450         CHECK_ACCESS(_res_ptr);
18451         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
18452         FREE(untag_ptr(_res));
18453         CResult_NonePaymentErrorZ_free(_res_conv);
18454 }
18455
18456 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
18457         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18458         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
18459         return tag_ptr(ret_conv, true);
18460 }
18461 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
18462         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
18463         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
18464         return ret_conv;
18465 }
18466
18467 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
18468         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
18469         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18470         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
18471         return tag_ptr(ret_conv, true);
18472 }
18473
18474 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
18475         LDKStr o_conv = str_ref_to_owned_c(o);
18476         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18477         *ret_conv = CResult_StringErrorZ_ok(o_conv);
18478         return tag_ptr(ret_conv, true);
18479 }
18480
18481 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
18482         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
18483         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18484         *ret_conv = CResult_StringErrorZ_err(e_conv);
18485         return tag_ptr(ret_conv, true);
18486 }
18487
18488 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
18489         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
18490         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
18491         return ret_conv;
18492 }
18493
18494 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
18495         if (!ptr_is_owned(_res)) return;
18496         void* _res_ptr = untag_ptr(_res);
18497         CHECK_ACCESS(_res_ptr);
18498         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
18499         FREE(untag_ptr(_res));
18500         CResult_StringErrorZ_free(_res_conv);
18501 }
18502
18503 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
18504         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18505         *ret_conv = CResult_StringErrorZ_clone(arg);
18506         return tag_ptr(ret_conv, true);
18507 }
18508 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
18509         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
18510         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
18511         return ret_conv;
18512 }
18513
18514 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
18515         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
18516         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18517         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
18518         return tag_ptr(ret_conv, true);
18519 }
18520
18521 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
18522         LDKChannelMonitorUpdate o_conv;
18523         o_conv.inner = untag_ptr(o);
18524         o_conv.is_owned = ptr_is_owned(o);
18525         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18526         o_conv = ChannelMonitorUpdate_clone(&o_conv);
18527         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18528         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
18529         return tag_ptr(ret_conv, true);
18530 }
18531
18532 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
18533         void* e_ptr = untag_ptr(e);
18534         CHECK_ACCESS(e_ptr);
18535         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18536         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18537         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18538         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
18539         return tag_ptr(ret_conv, true);
18540 }
18541
18542 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
18543         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
18544         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
18545         return ret_conv;
18546 }
18547
18548 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
18549         if (!ptr_is_owned(_res)) return;
18550         void* _res_ptr = untag_ptr(_res);
18551         CHECK_ACCESS(_res_ptr);
18552         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
18553         FREE(untag_ptr(_res));
18554         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
18555 }
18556
18557 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
18558         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18559         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
18560         return tag_ptr(ret_conv, true);
18561 }
18562 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18563         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
18564         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
18565         return ret_conv;
18566 }
18567
18568 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
18569         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
18570         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18571         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
18572         return tag_ptr(ret_conv, true);
18573 }
18574
18575 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
18576         void* o_ptr = untag_ptr(o);
18577         CHECK_ACCESS(o_ptr);
18578         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
18579         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
18580         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18581         *ret_copy = COption_MonitorEventZ_some(o_conv);
18582         uint64_t ret_ref = tag_ptr(ret_copy, true);
18583         return ret_ref;
18584 }
18585
18586 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
18587         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18588         *ret_copy = COption_MonitorEventZ_none();
18589         uint64_t ret_ref = tag_ptr(ret_copy, true);
18590         return ret_ref;
18591 }
18592
18593 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
18594         if (!ptr_is_owned(_res)) return;
18595         void* _res_ptr = untag_ptr(_res);
18596         CHECK_ACCESS(_res_ptr);
18597         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
18598         FREE(untag_ptr(_res));
18599         COption_MonitorEventZ_free(_res_conv);
18600 }
18601
18602 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
18603         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18604         *ret_copy = COption_MonitorEventZ_clone(arg);
18605         uint64_t ret_ref = tag_ptr(ret_copy, true);
18606         return ret_ref;
18607 }
18608 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
18609         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
18610         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
18611         return ret_conv;
18612 }
18613
18614 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
18615         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
18616         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18617         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
18618         uint64_t ret_ref = tag_ptr(ret_copy, true);
18619         return ret_ref;
18620 }
18621
18622 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
18623         void* o_ptr = untag_ptr(o);
18624         CHECK_ACCESS(o_ptr);
18625         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
18626         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
18627         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18628         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
18629         return tag_ptr(ret_conv, true);
18630 }
18631
18632 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
18633         void* e_ptr = untag_ptr(e);
18634         CHECK_ACCESS(e_ptr);
18635         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18636         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18637         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18638         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
18639         return tag_ptr(ret_conv, true);
18640 }
18641
18642 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
18643         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
18644         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
18645         return ret_conv;
18646 }
18647
18648 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
18649         if (!ptr_is_owned(_res)) return;
18650         void* _res_ptr = untag_ptr(_res);
18651         CHECK_ACCESS(_res_ptr);
18652         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
18653         FREE(untag_ptr(_res));
18654         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
18655 }
18656
18657 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
18658         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18659         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
18660         return tag_ptr(ret_conv, true);
18661 }
18662 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
18663         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
18664         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
18665         return ret_conv;
18666 }
18667
18668 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
18669         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
18670         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18671         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
18672         return tag_ptr(ret_conv, true);
18673 }
18674
18675 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
18676         LDKHTLCUpdate o_conv;
18677         o_conv.inner = untag_ptr(o);
18678         o_conv.is_owned = ptr_is_owned(o);
18679         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18680         o_conv = HTLCUpdate_clone(&o_conv);
18681         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18682         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
18683         return tag_ptr(ret_conv, true);
18684 }
18685
18686 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
18687         void* e_ptr = untag_ptr(e);
18688         CHECK_ACCESS(e_ptr);
18689         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18690         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18691         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18692         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
18693         return tag_ptr(ret_conv, true);
18694 }
18695
18696 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
18697         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
18698         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
18699         return ret_conv;
18700 }
18701
18702 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
18703         if (!ptr_is_owned(_res)) return;
18704         void* _res_ptr = untag_ptr(_res);
18705         CHECK_ACCESS(_res_ptr);
18706         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
18707         FREE(untag_ptr(_res));
18708         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
18709 }
18710
18711 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
18712         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18713         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
18714         return tag_ptr(ret_conv, true);
18715 }
18716 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18717         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
18718         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
18719         return ret_conv;
18720 }
18721
18722 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
18723         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
18724         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18725         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
18726         return tag_ptr(ret_conv, true);
18727 }
18728
18729 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
18730         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18731         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
18732         return tag_ptr(ret_conv, true);
18733 }
18734 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
18735         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
18736         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
18737         return ret_conv;
18738 }
18739
18740 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
18741         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
18742         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18743         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
18744         return tag_ptr(ret_conv, true);
18745 }
18746
18747 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
18748         LDKOutPoint a_conv;
18749         a_conv.inner = untag_ptr(a);
18750         a_conv.is_owned = ptr_is_owned(a);
18751         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18752         a_conv = OutPoint_clone(&a_conv);
18753         LDKCVec_u8Z b_ref;
18754         b_ref.datalen = b->arr_len;
18755         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18756         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18757         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18758         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
18759         return tag_ptr(ret_conv, true);
18760 }
18761
18762 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
18763         if (!ptr_is_owned(_res)) return;
18764         void* _res_ptr = untag_ptr(_res);
18765         CHECK_ACCESS(_res_ptr);
18766         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
18767         FREE(untag_ptr(_res));
18768         C2Tuple_OutPointScriptZ_free(_res_conv);
18769 }
18770
18771 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
18772         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18773         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
18774         return tag_ptr(ret_conv, true);
18775 }
18776 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
18777         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
18778         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
18779         return ret_conv;
18780 }
18781
18782 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
18783         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
18784         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18785         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
18786         return tag_ptr(ret_conv, true);
18787 }
18788
18789 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
18790         LDKCVec_u8Z b_ref;
18791         b_ref.datalen = b->arr_len;
18792         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18793         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18794         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18795         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
18796         return tag_ptr(ret_conv, true);
18797 }
18798
18799 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
18800         if (!ptr_is_owned(_res)) return;
18801         void* _res_ptr = untag_ptr(_res);
18802         CHECK_ACCESS(_res_ptr);
18803         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
18804         FREE(untag_ptr(_res));
18805         C2Tuple_u32ScriptZ_free(_res_conv);
18806 }
18807
18808 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
18809         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
18810         _res_constr.datalen = _res->arr_len;
18811         if (_res_constr.datalen > 0)
18812                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18813         else
18814                 _res_constr.data = NULL;
18815         uint64_t* _res_vals = _res->elems;
18816         for (size_t v = 0; v < _res_constr.datalen; v++) {
18817                 uint64_t _res_conv_21 = _res_vals[v];
18818                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
18819                 CHECK_ACCESS(_res_conv_21_ptr);
18820                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
18821                 FREE(untag_ptr(_res_conv_21));
18822                 _res_constr.data[v] = _res_conv_21_conv;
18823         }
18824         FREE(_res);
18825         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
18826 }
18827
18828 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
18829         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18830         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
18831         return tag_ptr(ret_conv, true);
18832 }
18833 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
18834         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
18835         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
18836         return ret_conv;
18837 }
18838
18839 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
18840         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
18841         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18842         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
18843         return tag_ptr(ret_conv, true);
18844 }
18845
18846 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
18847         LDKThirtyTwoBytes a_ref;
18848         CHECK(a->arr_len == 32);
18849         memcpy(a_ref.data, a->elems, 32); FREE(a);
18850         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
18851         b_constr.datalen = b->arr_len;
18852         if (b_constr.datalen > 0)
18853                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18854         else
18855                 b_constr.data = NULL;
18856         uint64_t* b_vals = b->elems;
18857         for (size_t v = 0; v < b_constr.datalen; v++) {
18858                 uint64_t b_conv_21 = b_vals[v];
18859                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
18860                 CHECK_ACCESS(b_conv_21_ptr);
18861                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
18862                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
18863                 b_constr.data[v] = b_conv_21_conv;
18864         }
18865         FREE(b);
18866         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18867         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
18868         return tag_ptr(ret_conv, true);
18869 }
18870
18871 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
18872         if (!ptr_is_owned(_res)) return;
18873         void* _res_ptr = untag_ptr(_res);
18874         CHECK_ACCESS(_res_ptr);
18875         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
18876         FREE(untag_ptr(_res));
18877         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
18878 }
18879
18880 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
18881         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
18882         _res_constr.datalen = _res->arr_len;
18883         if (_res_constr.datalen > 0)
18884                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
18885         else
18886                 _res_constr.data = NULL;
18887         uint64_t* _res_vals = _res->elems;
18888         for (size_t o = 0; o < _res_constr.datalen; o++) {
18889                 uint64_t _res_conv_40 = _res_vals[o];
18890                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18891                 CHECK_ACCESS(_res_conv_40_ptr);
18892                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
18893                 FREE(untag_ptr(_res_conv_40));
18894                 _res_constr.data[o] = _res_conv_40_conv;
18895         }
18896         FREE(_res);
18897         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
18898 }
18899
18900 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
18901         LDKCVec_EventZ _res_constr;
18902         _res_constr.datalen = _res->arr_len;
18903         if (_res_constr.datalen > 0)
18904                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
18905         else
18906                 _res_constr.data = NULL;
18907         uint64_t* _res_vals = _res->elems;
18908         for (size_t h = 0; h < _res_constr.datalen; h++) {
18909                 uint64_t _res_conv_7 = _res_vals[h];
18910                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18911                 CHECK_ACCESS(_res_conv_7_ptr);
18912                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
18913                 FREE(untag_ptr(_res_conv_7));
18914                 _res_constr.data[h] = _res_conv_7_conv;
18915         }
18916         FREE(_res);
18917         CVec_EventZ_free(_res_constr);
18918 }
18919
18920 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
18921         LDKCVec_TransactionZ _res_constr;
18922         _res_constr.datalen = _res->arr_len;
18923         if (_res_constr.datalen > 0)
18924                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18925         else
18926                 _res_constr.data = NULL;
18927         int8_tArray* _res_vals = (void*) _res->elems;
18928         for (size_t m = 0; m < _res_constr.datalen; m++) {
18929                 int8_tArray _res_conv_12 = _res_vals[m];
18930                 LDKTransaction _res_conv_12_ref;
18931                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18932                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18933                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18934                 _res_conv_12_ref.data_is_owned = true;
18935                 _res_constr.data[m] = _res_conv_12_ref;
18936         }
18937         FREE(_res);
18938         CVec_TransactionZ_free(_res_constr);
18939 }
18940
18941 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18942         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18943         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18944         return tag_ptr(ret_conv, true);
18945 }
18946 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18947         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18948         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18949         return ret_conv;
18950 }
18951
18952 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18953         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18954         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18955         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18956         return tag_ptr(ret_conv, true);
18957 }
18958
18959 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18960         void* b_ptr = untag_ptr(b);
18961         CHECK_ACCESS(b_ptr);
18962         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18963         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18964         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18965         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18966         return tag_ptr(ret_conv, true);
18967 }
18968
18969 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18970         if (!ptr_is_owned(_res)) return;
18971         void* _res_ptr = untag_ptr(_res);
18972         CHECK_ACCESS(_res_ptr);
18973         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18974         FREE(untag_ptr(_res));
18975         C2Tuple_u32TxOutZ_free(_res_conv);
18976 }
18977
18978 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18979         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18980         _res_constr.datalen = _res->arr_len;
18981         if (_res_constr.datalen > 0)
18982                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18983         else
18984                 _res_constr.data = NULL;
18985         uint64_t* _res_vals = _res->elems;
18986         for (size_t u = 0; u < _res_constr.datalen; u++) {
18987                 uint64_t _res_conv_20 = _res_vals[u];
18988                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18989                 CHECK_ACCESS(_res_conv_20_ptr);
18990                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18991                 FREE(untag_ptr(_res_conv_20));
18992                 _res_constr.data[u] = _res_conv_20_conv;
18993         }
18994         FREE(_res);
18995         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18996 }
18997
18998 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18999         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19000         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
19001         return tag_ptr(ret_conv, true);
19002 }
19003 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
19004         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
19005         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
19006         return ret_conv;
19007 }
19008
19009 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
19010         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
19011         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19012         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
19013         return tag_ptr(ret_conv, true);
19014 }
19015
19016 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
19017         LDKThirtyTwoBytes a_ref;
19018         CHECK(a->arr_len == 32);
19019         memcpy(a_ref.data, a->elems, 32); FREE(a);
19020         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
19021         b_constr.datalen = b->arr_len;
19022         if (b_constr.datalen > 0)
19023                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19024         else
19025                 b_constr.data = NULL;
19026         uint64_t* b_vals = b->elems;
19027         for (size_t u = 0; u < b_constr.datalen; u++) {
19028                 uint64_t b_conv_20 = b_vals[u];
19029                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
19030                 CHECK_ACCESS(b_conv_20_ptr);
19031                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
19032                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
19033                 b_constr.data[u] = b_conv_20_conv;
19034         }
19035         FREE(b);
19036         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19037         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
19038         return tag_ptr(ret_conv, true);
19039 }
19040
19041 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
19042         if (!ptr_is_owned(_res)) return;
19043         void* _res_ptr = untag_ptr(_res);
19044         CHECK_ACCESS(_res_ptr);
19045         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
19046         FREE(untag_ptr(_res));
19047         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
19048 }
19049
19050 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
19051         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
19052         _res_constr.datalen = _res->arr_len;
19053         if (_res_constr.datalen > 0)
19054                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
19055         else
19056                 _res_constr.data = NULL;
19057         uint64_t* _res_vals = _res->elems;
19058         for (size_t n = 0; n < _res_constr.datalen; n++) {
19059                 uint64_t _res_conv_39 = _res_vals[n];
19060                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
19061                 CHECK_ACCESS(_res_conv_39_ptr);
19062                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
19063                 FREE(untag_ptr(_res_conv_39));
19064                 _res_constr.data[n] = _res_conv_39_conv;
19065         }
19066         FREE(_res);
19067         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
19068 }
19069
19070 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
19071         LDKCVec_BalanceZ _res_constr;
19072         _res_constr.datalen = _res->arr_len;
19073         if (_res_constr.datalen > 0)
19074                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
19075         else
19076                 _res_constr.data = NULL;
19077         uint64_t* _res_vals = _res->elems;
19078         for (size_t j = 0; j < _res_constr.datalen; j++) {
19079                 uint64_t _res_conv_9 = _res_vals[j];
19080                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
19081                 CHECK_ACCESS(_res_conv_9_ptr);
19082                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
19083                 FREE(untag_ptr(_res_conv_9));
19084                 _res_constr.data[j] = _res_conv_9_conv;
19085         }
19086         FREE(_res);
19087         CVec_BalanceZ_free(_res_constr);
19088 }
19089
19090 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
19091         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19092         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
19093         return tag_ptr(ret_conv, true);
19094 }
19095 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
19096         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
19097         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
19098         return ret_conv;
19099 }
19100
19101 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
19102         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
19103         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19104         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
19105         return tag_ptr(ret_conv, true);
19106 }
19107
19108 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
19109         LDKThirtyTwoBytes a_ref;
19110         CHECK(a->arr_len == 32);
19111         memcpy(a_ref.data, a->elems, 32); FREE(a);
19112         LDKChannelMonitor b_conv;
19113         b_conv.inner = untag_ptr(b);
19114         b_conv.is_owned = ptr_is_owned(b);
19115         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19116         b_conv = ChannelMonitor_clone(&b_conv);
19117         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19118         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
19119         return tag_ptr(ret_conv, true);
19120 }
19121
19122 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
19123         if (!ptr_is_owned(_res)) return;
19124         void* _res_ptr = untag_ptr(_res);
19125         CHECK_ACCESS(_res_ptr);
19126         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
19127         FREE(untag_ptr(_res));
19128         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
19129 }
19130
19131 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
19132         void* o_ptr = untag_ptr(o);
19133         CHECK_ACCESS(o_ptr);
19134         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
19135         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
19136         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19137         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
19138         return tag_ptr(ret_conv, true);
19139 }
19140
19141 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
19142         void* e_ptr = untag_ptr(e);
19143         CHECK_ACCESS(e_ptr);
19144         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19145         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19146         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19147         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
19148         return tag_ptr(ret_conv, true);
19149 }
19150
19151 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
19152         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
19153         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
19154         return ret_conv;
19155 }
19156
19157 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
19158         if (!ptr_is_owned(_res)) return;
19159         void* _res_ptr = untag_ptr(_res);
19160         CHECK_ACCESS(_res_ptr);
19161         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
19162         FREE(untag_ptr(_res));
19163         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
19164 }
19165
19166 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
19167         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19168         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
19169         return tag_ptr(ret_conv, true);
19170 }
19171 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
19172         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
19173         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
19174         return ret_conv;
19175 }
19176
19177 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
19178         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
19179         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19180         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
19181         return tag_ptr(ret_conv, true);
19182 }
19183
19184 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
19185         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19186         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
19187         return tag_ptr(ret_conv, true);
19188 }
19189 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
19190         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
19191         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
19192         return ret_conv;
19193 }
19194
19195 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
19196         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
19197         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19198         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
19199         return tag_ptr(ret_conv, true);
19200 }
19201
19202 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
19203         LDKPublicKey a_ref;
19204         CHECK(a->arr_len == 33);
19205         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
19206         void* b_ptr = untag_ptr(b);
19207         CHECK_ACCESS(b_ptr);
19208         LDKType b_conv = *(LDKType*)(b_ptr);
19209         if (b_conv.free == LDKType_JCalls_free) {
19210                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19211                 LDKType_JCalls_cloned(&b_conv);
19212         }
19213         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19214         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
19215         return tag_ptr(ret_conv, true);
19216 }
19217
19218 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
19219         if (!ptr_is_owned(_res)) return;
19220         void* _res_ptr = untag_ptr(_res);
19221         CHECK_ACCESS(_res_ptr);
19222         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
19223         FREE(untag_ptr(_res));
19224         C2Tuple_PublicKeyTypeZ_free(_res_conv);
19225 }
19226
19227 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
19228         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
19229         _res_constr.datalen = _res->arr_len;
19230         if (_res_constr.datalen > 0)
19231                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
19232         else
19233                 _res_constr.data = NULL;
19234         uint64_t* _res_vals = _res->elems;
19235         for (size_t z = 0; z < _res_constr.datalen; z++) {
19236                 uint64_t _res_conv_25 = _res_vals[z];
19237                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
19238                 CHECK_ACCESS(_res_conv_25_ptr);
19239                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
19240                 FREE(untag_ptr(_res_conv_25));
19241                 _res_constr.data[z] = _res_conv_25_conv;
19242         }
19243         FREE(_res);
19244         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
19245 }
19246
19247 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
19248         void* o_ptr = untag_ptr(o);
19249         CHECK_ACCESS(o_ptr);
19250         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
19251         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
19252                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19253                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
19254         }
19255         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19256         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
19257         uint64_t ret_ref = tag_ptr(ret_copy, true);
19258         return ret_ref;
19259 }
19260
19261 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
19262         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19263         *ret_copy = COption_CustomOnionMessageContentsZ_none();
19264         uint64_t ret_ref = tag_ptr(ret_copy, true);
19265         return ret_ref;
19266 }
19267
19268 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
19269         if (!ptr_is_owned(_res)) return;
19270         void* _res_ptr = untag_ptr(_res);
19271         CHECK_ACCESS(_res_ptr);
19272         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
19273         FREE(untag_ptr(_res));
19274         COption_CustomOnionMessageContentsZ_free(_res_conv);
19275 }
19276
19277 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
19278         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19279         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
19280         uint64_t ret_ref = tag_ptr(ret_copy, true);
19281         return ret_ref;
19282 }
19283 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
19284         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
19285         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
19286         return ret_conv;
19287 }
19288
19289 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
19290         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
19291         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19292         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
19293         uint64_t ret_ref = tag_ptr(ret_copy, true);
19294         return ret_ref;
19295 }
19296
19297 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
19298         void* o_ptr = untag_ptr(o);
19299         CHECK_ACCESS(o_ptr);
19300         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
19301         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
19302         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19303         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
19304         return tag_ptr(ret_conv, true);
19305 }
19306
19307 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
19308         void* e_ptr = untag_ptr(e);
19309         CHECK_ACCESS(e_ptr);
19310         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19311         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19312         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19313         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
19314         return tag_ptr(ret_conv, true);
19315 }
19316
19317 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
19318         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
19319         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
19320         return ret_conv;
19321 }
19322
19323 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
19324         if (!ptr_is_owned(_res)) return;
19325         void* _res_ptr = untag_ptr(_res);
19326         CHECK_ACCESS(_res_ptr);
19327         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
19328         FREE(untag_ptr(_res));
19329         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
19330 }
19331
19332 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
19333         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19334         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
19335         return tag_ptr(ret_conv, true);
19336 }
19337 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
19338         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
19339         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
19340         return ret_conv;
19341 }
19342
19343 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
19344         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
19345         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19346         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
19347         return tag_ptr(ret_conv, true);
19348 }
19349
19350 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
19351         void* o_ptr = untag_ptr(o);
19352         CHECK_ACCESS(o_ptr);
19353         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19354         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19355         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19356         *ret_copy = COption_NetAddressZ_some(o_conv);
19357         uint64_t ret_ref = tag_ptr(ret_copy, true);
19358         return ret_ref;
19359 }
19360
19361 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
19362         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19363         *ret_copy = COption_NetAddressZ_none();
19364         uint64_t ret_ref = tag_ptr(ret_copy, true);
19365         return ret_ref;
19366 }
19367
19368 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
19369         if (!ptr_is_owned(_res)) return;
19370         void* _res_ptr = untag_ptr(_res);
19371         CHECK_ACCESS(_res_ptr);
19372         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
19373         FREE(untag_ptr(_res));
19374         COption_NetAddressZ_free(_res_conv);
19375 }
19376
19377 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
19378         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19379         *ret_copy = COption_NetAddressZ_clone(arg);
19380         uint64_t ret_ref = tag_ptr(ret_copy, true);
19381         return ret_ref;
19382 }
19383 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
19384         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
19385         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
19386         return ret_conv;
19387 }
19388
19389 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
19390         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
19391         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19392         *ret_copy = COption_NetAddressZ_clone(orig_conv);
19393         uint64_t ret_ref = tag_ptr(ret_copy, true);
19394         return ret_ref;
19395 }
19396
19397 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
19398         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19399         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
19400         return tag_ptr(ret_conv, true);
19401 }
19402 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(uint64_t arg) {
19403         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
19404         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
19405         return ret_conv;
19406 }
19407
19408 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone(uint64_t orig) {
19409         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
19410         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19411         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
19412         return tag_ptr(ret_conv, true);
19413 }
19414
19415 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new(int8_tArray a, uint64_t b) {
19416         LDKPublicKey a_ref;
19417         CHECK(a->arr_len == 33);
19418         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
19419         void* b_ptr = untag_ptr(b);
19420         CHECK_ACCESS(b_ptr);
19421         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
19422         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
19423         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19424         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
19425         return tag_ptr(ret_conv, true);
19426 }
19427
19428 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free(uint64_t _res) {
19429         if (!ptr_is_owned(_res)) return;
19430         void* _res_ptr = untag_ptr(_res);
19431         CHECK_ACCESS(_res_ptr);
19432         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
19433         FREE(untag_ptr(_res));
19434         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
19435 }
19436
19437 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(uint64_tArray _res) {
19438         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
19439         _res_constr.datalen = _res->arr_len;
19440         if (_res_constr.datalen > 0)
19441                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
19442         else
19443                 _res_constr.data = NULL;
19444         uint64_t* _res_vals = _res->elems;
19445         for (size_t o = 0; o < _res_constr.datalen; o++) {
19446                 uint64_t _res_conv_40 = _res_vals[o];
19447                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
19448                 CHECK_ACCESS(_res_conv_40_ptr);
19449                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
19450                 FREE(untag_ptr(_res_conv_40));
19451                 _res_constr.data[o] = _res_conv_40_conv;
19452         }
19453         FREE(_res);
19454         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
19455 }
19456
19457 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
19458         LDKCVec_u8Z o_ref;
19459         o_ref.datalen = o->arr_len;
19460         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19461         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
19462         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19463         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
19464         return tag_ptr(ret_conv, true);
19465 }
19466
19467 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
19468         LDKPeerHandleError e_conv;
19469         e_conv.inner = untag_ptr(e);
19470         e_conv.is_owned = ptr_is_owned(e);
19471         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19472         e_conv = PeerHandleError_clone(&e_conv);
19473         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19474         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
19475         return tag_ptr(ret_conv, true);
19476 }
19477
19478 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
19479         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
19480         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
19481         return ret_conv;
19482 }
19483
19484 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
19485         if (!ptr_is_owned(_res)) return;
19486         void* _res_ptr = untag_ptr(_res);
19487         CHECK_ACCESS(_res_ptr);
19488         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
19489         FREE(untag_ptr(_res));
19490         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
19491 }
19492
19493 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
19494         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19495         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
19496         return tag_ptr(ret_conv, true);
19497 }
19498 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19499         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
19500         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
19501         return ret_conv;
19502 }
19503
19504 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
19505         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
19506         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19507         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
19508         return tag_ptr(ret_conv, true);
19509 }
19510
19511 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
19512         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19513         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
19514         return tag_ptr(ret_conv, true);
19515 }
19516
19517 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
19518         LDKPeerHandleError e_conv;
19519         e_conv.inner = untag_ptr(e);
19520         e_conv.is_owned = ptr_is_owned(e);
19521         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19522         e_conv = PeerHandleError_clone(&e_conv);
19523         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19524         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
19525         return tag_ptr(ret_conv, true);
19526 }
19527
19528 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
19529         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
19530         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
19531         return ret_conv;
19532 }
19533
19534 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
19535         if (!ptr_is_owned(_res)) return;
19536         void* _res_ptr = untag_ptr(_res);
19537         CHECK_ACCESS(_res_ptr);
19538         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
19539         FREE(untag_ptr(_res));
19540         CResult_NonePeerHandleErrorZ_free(_res_conv);
19541 }
19542
19543 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
19544         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19545         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
19546         return tag_ptr(ret_conv, true);
19547 }
19548 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
19549         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
19550         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
19551         return ret_conv;
19552 }
19553
19554 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
19555         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
19556         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19557         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
19558         return tag_ptr(ret_conv, true);
19559 }
19560
19561 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
19562         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19563         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
19564         return tag_ptr(ret_conv, true);
19565 }
19566
19567 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
19568         LDKPeerHandleError e_conv;
19569         e_conv.inner = untag_ptr(e);
19570         e_conv.is_owned = ptr_is_owned(e);
19571         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19572         e_conv = PeerHandleError_clone(&e_conv);
19573         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19574         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
19575         return tag_ptr(ret_conv, true);
19576 }
19577
19578 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
19579         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
19580         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
19581         return ret_conv;
19582 }
19583
19584 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
19585         if (!ptr_is_owned(_res)) return;
19586         void* _res_ptr = untag_ptr(_res);
19587         CHECK_ACCESS(_res_ptr);
19588         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
19589         FREE(untag_ptr(_res));
19590         CResult_boolPeerHandleErrorZ_free(_res_conv);
19591 }
19592
19593 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
19594         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19595         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
19596         return tag_ptr(ret_conv, true);
19597 }
19598 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19599         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
19600         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
19601         return ret_conv;
19602 }
19603
19604 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
19605         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
19606         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19607         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
19608         return tag_ptr(ret_conv, true);
19609 }
19610
19611 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
19612         void* o_ptr = untag_ptr(o);
19613         CHECK_ACCESS(o_ptr);
19614         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
19615         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
19616         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19617         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
19618         return tag_ptr(ret_conv, true);
19619 }
19620
19621 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
19622         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
19623         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19624         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
19625         return tag_ptr(ret_conv, true);
19626 }
19627
19628 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
19629         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
19630         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
19631         return ret_conv;
19632 }
19633
19634 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
19635         if (!ptr_is_owned(_res)) return;
19636         void* _res_ptr = untag_ptr(_res);
19637         CHECK_ACCESS(_res_ptr);
19638         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
19639         FREE(untag_ptr(_res));
19640         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
19641 }
19642
19643 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
19644         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19645         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
19646         return tag_ptr(ret_conv, true);
19647 }
19648 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
19649         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
19650         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
19651         return ret_conv;
19652 }
19653
19654 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
19655         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
19656         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19657         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
19658         return tag_ptr(ret_conv, true);
19659 }
19660
19661 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
19662         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19663         *ret_conv = CResult_NoneSendErrorZ_ok();
19664         return tag_ptr(ret_conv, true);
19665 }
19666
19667 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
19668         void* e_ptr = untag_ptr(e);
19669         CHECK_ACCESS(e_ptr);
19670         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
19671         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
19672         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19673         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
19674         return tag_ptr(ret_conv, true);
19675 }
19676
19677 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
19678         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
19679         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
19680         return ret_conv;
19681 }
19682
19683 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
19684         if (!ptr_is_owned(_res)) return;
19685         void* _res_ptr = untag_ptr(_res);
19686         CHECK_ACCESS(_res_ptr);
19687         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
19688         FREE(untag_ptr(_res));
19689         CResult_NoneSendErrorZ_free(_res_conv);
19690 }
19691
19692 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
19693         LDKBlindedPath o_conv;
19694         o_conv.inner = untag_ptr(o);
19695         o_conv.is_owned = ptr_is_owned(o);
19696         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19697         o_conv = BlindedPath_clone(&o_conv);
19698         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19699         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
19700         return tag_ptr(ret_conv, true);
19701 }
19702
19703 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
19704         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19705         *ret_conv = CResult_BlindedPathNoneZ_err();
19706         return tag_ptr(ret_conv, true);
19707 }
19708
19709 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
19710         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
19711         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
19712         return ret_conv;
19713 }
19714
19715 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
19716         if (!ptr_is_owned(_res)) return;
19717         void* _res_ptr = untag_ptr(_res);
19718         CHECK_ACCESS(_res_ptr);
19719         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
19720         FREE(untag_ptr(_res));
19721         CResult_BlindedPathNoneZ_free(_res_conv);
19722 }
19723
19724 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
19725         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19726         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
19727         return tag_ptr(ret_conv, true);
19728 }
19729 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
19730         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
19731         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
19732         return ret_conv;
19733 }
19734
19735 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
19736         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
19737         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19738         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
19739         return tag_ptr(ret_conv, true);
19740 }
19741
19742 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
19743         LDKBlindedPath o_conv;
19744         o_conv.inner = untag_ptr(o);
19745         o_conv.is_owned = ptr_is_owned(o);
19746         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19747         o_conv = BlindedPath_clone(&o_conv);
19748         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19749         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
19750         return tag_ptr(ret_conv, true);
19751 }
19752
19753 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
19754         void* e_ptr = untag_ptr(e);
19755         CHECK_ACCESS(e_ptr);
19756         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19757         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19758         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19759         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
19760         return tag_ptr(ret_conv, true);
19761 }
19762
19763 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
19764         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
19765         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
19766         return ret_conv;
19767 }
19768
19769 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
19770         if (!ptr_is_owned(_res)) return;
19771         void* _res_ptr = untag_ptr(_res);
19772         CHECK_ACCESS(_res_ptr);
19773         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
19774         FREE(untag_ptr(_res));
19775         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
19776 }
19777
19778 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
19779         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19780         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
19781         return tag_ptr(ret_conv, true);
19782 }
19783 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
19784         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
19785         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
19786         return ret_conv;
19787 }
19788
19789 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
19790         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
19791         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19792         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
19793         return tag_ptr(ret_conv, true);
19794 }
19795
19796 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
19797         LDKBlindedHop o_conv;
19798         o_conv.inner = untag_ptr(o);
19799         o_conv.is_owned = ptr_is_owned(o);
19800         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19801         o_conv = BlindedHop_clone(&o_conv);
19802         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19803         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
19804         return tag_ptr(ret_conv, true);
19805 }
19806
19807 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
19808         void* e_ptr = untag_ptr(e);
19809         CHECK_ACCESS(e_ptr);
19810         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19811         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19812         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19813         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
19814         return tag_ptr(ret_conv, true);
19815 }
19816
19817 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
19818         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
19819         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
19820         return ret_conv;
19821 }
19822
19823 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
19824         if (!ptr_is_owned(_res)) return;
19825         void* _res_ptr = untag_ptr(_res);
19826         CHECK_ACCESS(_res_ptr);
19827         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
19828         FREE(untag_ptr(_res));
19829         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
19830 }
19831
19832 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
19833         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19834         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
19835         return tag_ptr(ret_conv, true);
19836 }
19837 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
19838         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
19839         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
19840         return ret_conv;
19841 }
19842
19843 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
19844         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
19845         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19846         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
19847         return tag_ptr(ret_conv, true);
19848 }
19849
19850 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
19851         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19852         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
19853         return tag_ptr(ret_conv, true);
19854 }
19855
19856 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
19857         void* e_ptr = untag_ptr(e);
19858         CHECK_ACCESS(e_ptr);
19859         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
19860         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
19861         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19862         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
19863         return tag_ptr(ret_conv, true);
19864 }
19865
19866 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
19867         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
19868         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
19869         return ret_conv;
19870 }
19871
19872 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
19873         if (!ptr_is_owned(_res)) return;
19874         void* _res_ptr = untag_ptr(_res);
19875         CHECK_ACCESS(_res_ptr);
19876         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
19877         FREE(untag_ptr(_res));
19878         CResult_u32GraphSyncErrorZ_free(_res_conv);
19879 }
19880
19881 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
19882         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19883         *ret_conv = CResult_NoneErrorZ_ok();
19884         return tag_ptr(ret_conv, true);
19885 }
19886
19887 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
19888         LDKIOError e_conv = LDKIOError_from_js(e);
19889         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19890         *ret_conv = CResult_NoneErrorZ_err(e_conv);
19891         return tag_ptr(ret_conv, true);
19892 }
19893
19894 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
19895         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
19896         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
19897         return ret_conv;
19898 }
19899
19900 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
19901         if (!ptr_is_owned(_res)) return;
19902         void* _res_ptr = untag_ptr(_res);
19903         CHECK_ACCESS(_res_ptr);
19904         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
19905         FREE(untag_ptr(_res));
19906         CResult_NoneErrorZ_free(_res_conv);
19907 }
19908
19909 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
19910         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19911         *ret_conv = CResult_NoneErrorZ_clone(arg);
19912         return tag_ptr(ret_conv, true);
19913 }
19914 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
19915         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
19916         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
19917         return ret_conv;
19918 }
19919
19920 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
19921         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
19922         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19923         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
19924         return tag_ptr(ret_conv, true);
19925 }
19926
19927 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
19928         void* o_ptr = untag_ptr(o);
19929         CHECK_ACCESS(o_ptr);
19930         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19931         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19932         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19933         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
19934         return tag_ptr(ret_conv, true);
19935 }
19936
19937 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
19938         void* e_ptr = untag_ptr(e);
19939         CHECK_ACCESS(e_ptr);
19940         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19941         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19942         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19943         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
19944         return tag_ptr(ret_conv, true);
19945 }
19946
19947 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
19948         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
19949         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
19950         return ret_conv;
19951 }
19952
19953 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
19954         if (!ptr_is_owned(_res)) return;
19955         void* _res_ptr = untag_ptr(_res);
19956         CHECK_ACCESS(_res_ptr);
19957         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
19958         FREE(untag_ptr(_res));
19959         CResult_NetAddressDecodeErrorZ_free(_res_conv);
19960 }
19961
19962 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
19963         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19964         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
19965         return tag_ptr(ret_conv, true);
19966 }
19967 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
19968         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
19969         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
19970         return ret_conv;
19971 }
19972
19973 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
19974         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
19975         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19976         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
19977         return tag_ptr(ret_conv, true);
19978 }
19979
19980 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
19981         LDKCVec_UpdateAddHTLCZ _res_constr;
19982         _res_constr.datalen = _res->arr_len;
19983         if (_res_constr.datalen > 0)
19984                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19985         else
19986                 _res_constr.data = NULL;
19987         uint64_t* _res_vals = _res->elems;
19988         for (size_t p = 0; p < _res_constr.datalen; p++) {
19989                 uint64_t _res_conv_15 = _res_vals[p];
19990                 LDKUpdateAddHTLC _res_conv_15_conv;
19991                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
19992                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
19993                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
19994                 _res_constr.data[p] = _res_conv_15_conv;
19995         }
19996         FREE(_res);
19997         CVec_UpdateAddHTLCZ_free(_res_constr);
19998 }
19999
20000 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
20001         LDKCVec_UpdateFulfillHTLCZ _res_constr;
20002         _res_constr.datalen = _res->arr_len;
20003         if (_res_constr.datalen > 0)
20004                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20005         else
20006                 _res_constr.data = NULL;
20007         uint64_t* _res_vals = _res->elems;
20008         for (size_t t = 0; t < _res_constr.datalen; t++) {
20009                 uint64_t _res_conv_19 = _res_vals[t];
20010                 LDKUpdateFulfillHTLC _res_conv_19_conv;
20011                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
20012                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
20013                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
20014                 _res_constr.data[t] = _res_conv_19_conv;
20015         }
20016         FREE(_res);
20017         CVec_UpdateFulfillHTLCZ_free(_res_constr);
20018 }
20019
20020 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
20021         LDKCVec_UpdateFailHTLCZ _res_constr;
20022         _res_constr.datalen = _res->arr_len;
20023         if (_res_constr.datalen > 0)
20024                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20025         else
20026                 _res_constr.data = NULL;
20027         uint64_t* _res_vals = _res->elems;
20028         for (size_t q = 0; q < _res_constr.datalen; q++) {
20029                 uint64_t _res_conv_16 = _res_vals[q];
20030                 LDKUpdateFailHTLC _res_conv_16_conv;
20031                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20032                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20033                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20034                 _res_constr.data[q] = _res_conv_16_conv;
20035         }
20036         FREE(_res);
20037         CVec_UpdateFailHTLCZ_free(_res_constr);
20038 }
20039
20040 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
20041         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
20042         _res_constr.datalen = _res->arr_len;
20043         if (_res_constr.datalen > 0)
20044                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20045         else
20046                 _res_constr.data = NULL;
20047         uint64_t* _res_vals = _res->elems;
20048         for (size_t z = 0; z < _res_constr.datalen; z++) {
20049                 uint64_t _res_conv_25 = _res_vals[z];
20050                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
20051                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
20052                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
20053                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
20054                 _res_constr.data[z] = _res_conv_25_conv;
20055         }
20056         FREE(_res);
20057         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
20058 }
20059
20060 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
20061         LDKAcceptChannel o_conv;
20062         o_conv.inner = untag_ptr(o);
20063         o_conv.is_owned = ptr_is_owned(o);
20064         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20065         o_conv = AcceptChannel_clone(&o_conv);
20066         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20067         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
20068         return tag_ptr(ret_conv, true);
20069 }
20070
20071 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
20072         void* e_ptr = untag_ptr(e);
20073         CHECK_ACCESS(e_ptr);
20074         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20075         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20076         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20077         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
20078         return tag_ptr(ret_conv, true);
20079 }
20080
20081 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
20082         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
20083         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
20084         return ret_conv;
20085 }
20086
20087 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
20088         if (!ptr_is_owned(_res)) return;
20089         void* _res_ptr = untag_ptr(_res);
20090         CHECK_ACCESS(_res_ptr);
20091         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
20092         FREE(untag_ptr(_res));
20093         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
20094 }
20095
20096 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
20097         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20098         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
20099         return tag_ptr(ret_conv, true);
20100 }
20101 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20102         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
20103         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
20104         return ret_conv;
20105 }
20106
20107 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
20108         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
20109         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20110         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
20111         return tag_ptr(ret_conv, true);
20112 }
20113
20114 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
20115         LDKAnnouncementSignatures o_conv;
20116         o_conv.inner = untag_ptr(o);
20117         o_conv.is_owned = ptr_is_owned(o);
20118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20119         o_conv = AnnouncementSignatures_clone(&o_conv);
20120         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20121         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
20122         return tag_ptr(ret_conv, true);
20123 }
20124
20125 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
20126         void* e_ptr = untag_ptr(e);
20127         CHECK_ACCESS(e_ptr);
20128         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20129         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20130         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20131         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
20132         return tag_ptr(ret_conv, true);
20133 }
20134
20135 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
20136         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
20137         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
20138         return ret_conv;
20139 }
20140
20141 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
20142         if (!ptr_is_owned(_res)) return;
20143         void* _res_ptr = untag_ptr(_res);
20144         CHECK_ACCESS(_res_ptr);
20145         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
20146         FREE(untag_ptr(_res));
20147         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
20148 }
20149
20150 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
20151         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20152         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
20153         return tag_ptr(ret_conv, true);
20154 }
20155 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20156         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
20157         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
20158         return ret_conv;
20159 }
20160
20161 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
20162         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
20163         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20164         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
20165         return tag_ptr(ret_conv, true);
20166 }
20167
20168 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
20169         LDKChannelReestablish o_conv;
20170         o_conv.inner = untag_ptr(o);
20171         o_conv.is_owned = ptr_is_owned(o);
20172         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20173         o_conv = ChannelReestablish_clone(&o_conv);
20174         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20175         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
20176         return tag_ptr(ret_conv, true);
20177 }
20178
20179 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
20180         void* e_ptr = untag_ptr(e);
20181         CHECK_ACCESS(e_ptr);
20182         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20183         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20184         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20185         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
20186         return tag_ptr(ret_conv, true);
20187 }
20188
20189 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
20190         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
20191         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
20192         return ret_conv;
20193 }
20194
20195 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
20196         if (!ptr_is_owned(_res)) return;
20197         void* _res_ptr = untag_ptr(_res);
20198         CHECK_ACCESS(_res_ptr);
20199         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
20200         FREE(untag_ptr(_res));
20201         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
20202 }
20203
20204 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
20205         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20206         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
20207         return tag_ptr(ret_conv, true);
20208 }
20209 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
20210         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
20211         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
20212         return ret_conv;
20213 }
20214
20215 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
20216         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
20217         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20218         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
20219         return tag_ptr(ret_conv, true);
20220 }
20221
20222 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
20223         LDKClosingSigned o_conv;
20224         o_conv.inner = untag_ptr(o);
20225         o_conv.is_owned = ptr_is_owned(o);
20226         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20227         o_conv = ClosingSigned_clone(&o_conv);
20228         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20229         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
20230         return tag_ptr(ret_conv, true);
20231 }
20232
20233 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
20234         void* e_ptr = untag_ptr(e);
20235         CHECK_ACCESS(e_ptr);
20236         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20237         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20238         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20239         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
20240         return tag_ptr(ret_conv, true);
20241 }
20242
20243 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
20244         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
20245         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
20246         return ret_conv;
20247 }
20248
20249 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
20250         if (!ptr_is_owned(_res)) return;
20251         void* _res_ptr = untag_ptr(_res);
20252         CHECK_ACCESS(_res_ptr);
20253         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
20254         FREE(untag_ptr(_res));
20255         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
20256 }
20257
20258 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
20259         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20260         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
20261         return tag_ptr(ret_conv, true);
20262 }
20263 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20264         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
20265         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
20266         return ret_conv;
20267 }
20268
20269 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
20270         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
20271         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20272         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
20273         return tag_ptr(ret_conv, true);
20274 }
20275
20276 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
20277         LDKClosingSignedFeeRange o_conv;
20278         o_conv.inner = untag_ptr(o);
20279         o_conv.is_owned = ptr_is_owned(o);
20280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20281         o_conv = ClosingSignedFeeRange_clone(&o_conv);
20282         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20283         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
20284         return tag_ptr(ret_conv, true);
20285 }
20286
20287 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
20288         void* e_ptr = untag_ptr(e);
20289         CHECK_ACCESS(e_ptr);
20290         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20291         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20292         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20293         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
20294         return tag_ptr(ret_conv, true);
20295 }
20296
20297 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
20298         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
20299         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
20300         return ret_conv;
20301 }
20302
20303 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
20304         if (!ptr_is_owned(_res)) return;
20305         void* _res_ptr = untag_ptr(_res);
20306         CHECK_ACCESS(_res_ptr);
20307         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
20308         FREE(untag_ptr(_res));
20309         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
20310 }
20311
20312 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
20313         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20314         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
20315         return tag_ptr(ret_conv, true);
20316 }
20317 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20318         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
20319         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
20320         return ret_conv;
20321 }
20322
20323 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
20324         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
20325         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20326         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
20327         return tag_ptr(ret_conv, true);
20328 }
20329
20330 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
20331         LDKCommitmentSigned o_conv;
20332         o_conv.inner = untag_ptr(o);
20333         o_conv.is_owned = ptr_is_owned(o);
20334         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20335         o_conv = CommitmentSigned_clone(&o_conv);
20336         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20337         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
20338         return tag_ptr(ret_conv, true);
20339 }
20340
20341 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
20342         void* e_ptr = untag_ptr(e);
20343         CHECK_ACCESS(e_ptr);
20344         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20345         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20346         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20347         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
20348         return tag_ptr(ret_conv, true);
20349 }
20350
20351 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
20352         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
20353         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
20354         return ret_conv;
20355 }
20356
20357 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
20358         if (!ptr_is_owned(_res)) return;
20359         void* _res_ptr = untag_ptr(_res);
20360         CHECK_ACCESS(_res_ptr);
20361         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
20362         FREE(untag_ptr(_res));
20363         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
20364 }
20365
20366 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
20367         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20368         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
20369         return tag_ptr(ret_conv, true);
20370 }
20371 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20372         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
20373         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
20374         return ret_conv;
20375 }
20376
20377 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
20378         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
20379         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20380         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
20381         return tag_ptr(ret_conv, true);
20382 }
20383
20384 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
20385         LDKFundingCreated o_conv;
20386         o_conv.inner = untag_ptr(o);
20387         o_conv.is_owned = ptr_is_owned(o);
20388         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20389         o_conv = FundingCreated_clone(&o_conv);
20390         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20391         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
20392         return tag_ptr(ret_conv, true);
20393 }
20394
20395 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
20396         void* e_ptr = untag_ptr(e);
20397         CHECK_ACCESS(e_ptr);
20398         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20399         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20400         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20401         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
20402         return tag_ptr(ret_conv, true);
20403 }
20404
20405 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
20406         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
20407         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
20408         return ret_conv;
20409 }
20410
20411 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
20412         if (!ptr_is_owned(_res)) return;
20413         void* _res_ptr = untag_ptr(_res);
20414         CHECK_ACCESS(_res_ptr);
20415         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
20416         FREE(untag_ptr(_res));
20417         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
20418 }
20419
20420 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
20421         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20422         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
20423         return tag_ptr(ret_conv, true);
20424 }
20425 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
20426         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
20427         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
20428         return ret_conv;
20429 }
20430
20431 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
20432         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
20433         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20434         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
20435         return tag_ptr(ret_conv, true);
20436 }
20437
20438 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
20439         LDKFundingSigned o_conv;
20440         o_conv.inner = untag_ptr(o);
20441         o_conv.is_owned = ptr_is_owned(o);
20442         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20443         o_conv = FundingSigned_clone(&o_conv);
20444         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20445         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
20446         return tag_ptr(ret_conv, true);
20447 }
20448
20449 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
20450         void* e_ptr = untag_ptr(e);
20451         CHECK_ACCESS(e_ptr);
20452         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20453         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20454         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20455         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
20456         return tag_ptr(ret_conv, true);
20457 }
20458
20459 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
20460         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
20461         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
20462         return ret_conv;
20463 }
20464
20465 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
20466         if (!ptr_is_owned(_res)) return;
20467         void* _res_ptr = untag_ptr(_res);
20468         CHECK_ACCESS(_res_ptr);
20469         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
20470         FREE(untag_ptr(_res));
20471         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
20472 }
20473
20474 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
20475         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20476         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
20477         return tag_ptr(ret_conv, true);
20478 }
20479 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20480         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
20481         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
20482         return ret_conv;
20483 }
20484
20485 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
20486         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
20487         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20488         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
20489         return tag_ptr(ret_conv, true);
20490 }
20491
20492 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
20493         LDKChannelReady o_conv;
20494         o_conv.inner = untag_ptr(o);
20495         o_conv.is_owned = ptr_is_owned(o);
20496         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20497         o_conv = ChannelReady_clone(&o_conv);
20498         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20499         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
20500         return tag_ptr(ret_conv, true);
20501 }
20502
20503 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
20504         void* e_ptr = untag_ptr(e);
20505         CHECK_ACCESS(e_ptr);
20506         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20507         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20508         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20509         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
20510         return tag_ptr(ret_conv, true);
20511 }
20512
20513 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
20514         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
20515         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
20516         return ret_conv;
20517 }
20518
20519 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
20520         if (!ptr_is_owned(_res)) return;
20521         void* _res_ptr = untag_ptr(_res);
20522         CHECK_ACCESS(_res_ptr);
20523         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
20524         FREE(untag_ptr(_res));
20525         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
20526 }
20527
20528 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
20529         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20530         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
20531         return tag_ptr(ret_conv, true);
20532 }
20533 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
20534         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
20535         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
20536         return ret_conv;
20537 }
20538
20539 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
20540         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
20541         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20542         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
20543         return tag_ptr(ret_conv, true);
20544 }
20545
20546 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
20547         LDKInit o_conv;
20548         o_conv.inner = untag_ptr(o);
20549         o_conv.is_owned = ptr_is_owned(o);
20550         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20551         o_conv = Init_clone(&o_conv);
20552         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20553         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
20554         return tag_ptr(ret_conv, true);
20555 }
20556
20557 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
20558         void* e_ptr = untag_ptr(e);
20559         CHECK_ACCESS(e_ptr);
20560         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20561         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20562         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20563         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
20564         return tag_ptr(ret_conv, true);
20565 }
20566
20567 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
20568         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
20569         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
20570         return ret_conv;
20571 }
20572
20573 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
20574         if (!ptr_is_owned(_res)) return;
20575         void* _res_ptr = untag_ptr(_res);
20576         CHECK_ACCESS(_res_ptr);
20577         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
20578         FREE(untag_ptr(_res));
20579         CResult_InitDecodeErrorZ_free(_res_conv);
20580 }
20581
20582 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
20583         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20584         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
20585         return tag_ptr(ret_conv, true);
20586 }
20587 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
20588         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
20589         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
20590         return ret_conv;
20591 }
20592
20593 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
20594         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
20595         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20596         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
20597         return tag_ptr(ret_conv, true);
20598 }
20599
20600 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
20601         LDKOpenChannel o_conv;
20602         o_conv.inner = untag_ptr(o);
20603         o_conv.is_owned = ptr_is_owned(o);
20604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20605         o_conv = OpenChannel_clone(&o_conv);
20606         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20607         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
20608         return tag_ptr(ret_conv, true);
20609 }
20610
20611 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
20612         void* e_ptr = untag_ptr(e);
20613         CHECK_ACCESS(e_ptr);
20614         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20615         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20616         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20617         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
20618         return tag_ptr(ret_conv, true);
20619 }
20620
20621 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
20622         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
20623         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
20624         return ret_conv;
20625 }
20626
20627 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
20628         if (!ptr_is_owned(_res)) return;
20629         void* _res_ptr = untag_ptr(_res);
20630         CHECK_ACCESS(_res_ptr);
20631         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
20632         FREE(untag_ptr(_res));
20633         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
20634 }
20635
20636 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
20637         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20638         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
20639         return tag_ptr(ret_conv, true);
20640 }
20641 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20642         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
20643         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
20644         return ret_conv;
20645 }
20646
20647 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
20648         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
20649         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20650         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
20651         return tag_ptr(ret_conv, true);
20652 }
20653
20654 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
20655         LDKRevokeAndACK o_conv;
20656         o_conv.inner = untag_ptr(o);
20657         o_conv.is_owned = ptr_is_owned(o);
20658         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20659         o_conv = RevokeAndACK_clone(&o_conv);
20660         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20661         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
20662         return tag_ptr(ret_conv, true);
20663 }
20664
20665 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
20666         void* e_ptr = untag_ptr(e);
20667         CHECK_ACCESS(e_ptr);
20668         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20669         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20670         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20671         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
20672         return tag_ptr(ret_conv, true);
20673 }
20674
20675 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
20676         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
20677         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
20678         return ret_conv;
20679 }
20680
20681 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
20682         if (!ptr_is_owned(_res)) return;
20683         void* _res_ptr = untag_ptr(_res);
20684         CHECK_ACCESS(_res_ptr);
20685         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
20686         FREE(untag_ptr(_res));
20687         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
20688 }
20689
20690 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
20691         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20692         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
20693         return tag_ptr(ret_conv, true);
20694 }
20695 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
20696         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
20697         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
20698         return ret_conv;
20699 }
20700
20701 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
20702         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
20703         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20704         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
20705         return tag_ptr(ret_conv, true);
20706 }
20707
20708 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
20709         LDKShutdown o_conv;
20710         o_conv.inner = untag_ptr(o);
20711         o_conv.is_owned = ptr_is_owned(o);
20712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20713         o_conv = Shutdown_clone(&o_conv);
20714         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20715         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
20716         return tag_ptr(ret_conv, true);
20717 }
20718
20719 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
20720         void* e_ptr = untag_ptr(e);
20721         CHECK_ACCESS(e_ptr);
20722         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20723         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20724         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20725         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
20726         return tag_ptr(ret_conv, true);
20727 }
20728
20729 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
20730         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
20731         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
20732         return ret_conv;
20733 }
20734
20735 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
20736         if (!ptr_is_owned(_res)) return;
20737         void* _res_ptr = untag_ptr(_res);
20738         CHECK_ACCESS(_res_ptr);
20739         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
20740         FREE(untag_ptr(_res));
20741         CResult_ShutdownDecodeErrorZ_free(_res_conv);
20742 }
20743
20744 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
20745         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20746         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
20747         return tag_ptr(ret_conv, true);
20748 }
20749 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
20750         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
20751         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
20752         return ret_conv;
20753 }
20754
20755 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
20756         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
20757         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20758         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
20759         return tag_ptr(ret_conv, true);
20760 }
20761
20762 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
20763         LDKUpdateFailHTLC o_conv;
20764         o_conv.inner = untag_ptr(o);
20765         o_conv.is_owned = ptr_is_owned(o);
20766         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20767         o_conv = UpdateFailHTLC_clone(&o_conv);
20768         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20769         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
20770         return tag_ptr(ret_conv, true);
20771 }
20772
20773 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
20774         void* e_ptr = untag_ptr(e);
20775         CHECK_ACCESS(e_ptr);
20776         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20777         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20778         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20779         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
20780         return tag_ptr(ret_conv, true);
20781 }
20782
20783 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
20784         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
20785         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
20786         return ret_conv;
20787 }
20788
20789 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
20790         if (!ptr_is_owned(_res)) return;
20791         void* _res_ptr = untag_ptr(_res);
20792         CHECK_ACCESS(_res_ptr);
20793         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
20794         FREE(untag_ptr(_res));
20795         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
20796 }
20797
20798 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
20799         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20800         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
20801         return tag_ptr(ret_conv, true);
20802 }
20803 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20804         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
20805         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
20806         return ret_conv;
20807 }
20808
20809 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
20810         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
20811         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20812         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
20813         return tag_ptr(ret_conv, true);
20814 }
20815
20816 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
20817         LDKUpdateFailMalformedHTLC o_conv;
20818         o_conv.inner = untag_ptr(o);
20819         o_conv.is_owned = ptr_is_owned(o);
20820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20821         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
20822         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20823         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
20824         return tag_ptr(ret_conv, true);
20825 }
20826
20827 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
20828         void* e_ptr = untag_ptr(e);
20829         CHECK_ACCESS(e_ptr);
20830         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20831         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20832         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20833         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
20834         return tag_ptr(ret_conv, true);
20835 }
20836
20837 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
20838         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
20839         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
20840         return ret_conv;
20841 }
20842
20843 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
20844         if (!ptr_is_owned(_res)) return;
20845         void* _res_ptr = untag_ptr(_res);
20846         CHECK_ACCESS(_res_ptr);
20847         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
20848         FREE(untag_ptr(_res));
20849         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
20850 }
20851
20852 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
20853         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20854         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
20855         return tag_ptr(ret_conv, true);
20856 }
20857 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20858         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
20859         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
20860         return ret_conv;
20861 }
20862
20863 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
20864         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
20865         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20866         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
20867         return tag_ptr(ret_conv, true);
20868 }
20869
20870 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
20871         LDKUpdateFee o_conv;
20872         o_conv.inner = untag_ptr(o);
20873         o_conv.is_owned = ptr_is_owned(o);
20874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20875         o_conv = UpdateFee_clone(&o_conv);
20876         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20877         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
20878         return tag_ptr(ret_conv, true);
20879 }
20880
20881 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
20882         void* e_ptr = untag_ptr(e);
20883         CHECK_ACCESS(e_ptr);
20884         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20885         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20886         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20887         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
20888         return tag_ptr(ret_conv, true);
20889 }
20890
20891 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
20892         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
20893         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
20894         return ret_conv;
20895 }
20896
20897 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
20898         if (!ptr_is_owned(_res)) return;
20899         void* _res_ptr = untag_ptr(_res);
20900         CHECK_ACCESS(_res_ptr);
20901         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
20902         FREE(untag_ptr(_res));
20903         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
20904 }
20905
20906 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
20907         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20908         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
20909         return tag_ptr(ret_conv, true);
20910 }
20911 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
20912         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
20913         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
20914         return ret_conv;
20915 }
20916
20917 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
20918         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
20919         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20920         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
20921         return tag_ptr(ret_conv, true);
20922 }
20923
20924 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
20925         LDKUpdateFulfillHTLC o_conv;
20926         o_conv.inner = untag_ptr(o);
20927         o_conv.is_owned = ptr_is_owned(o);
20928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20929         o_conv = UpdateFulfillHTLC_clone(&o_conv);
20930         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20931         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
20932         return tag_ptr(ret_conv, true);
20933 }
20934
20935 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
20936         void* e_ptr = untag_ptr(e);
20937         CHECK_ACCESS(e_ptr);
20938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20940         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20941         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
20942         return tag_ptr(ret_conv, true);
20943 }
20944
20945 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
20946         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
20947         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
20948         return ret_conv;
20949 }
20950
20951 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
20952         if (!ptr_is_owned(_res)) return;
20953         void* _res_ptr = untag_ptr(_res);
20954         CHECK_ACCESS(_res_ptr);
20955         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
20956         FREE(untag_ptr(_res));
20957         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
20958 }
20959
20960 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
20961         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20962         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
20963         return tag_ptr(ret_conv, true);
20964 }
20965 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20966         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
20967         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
20968         return ret_conv;
20969 }
20970
20971 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
20972         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
20973         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20974         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
20975         return tag_ptr(ret_conv, true);
20976 }
20977
20978 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
20979         LDKUpdateAddHTLC o_conv;
20980         o_conv.inner = untag_ptr(o);
20981         o_conv.is_owned = ptr_is_owned(o);
20982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20983         o_conv = UpdateAddHTLC_clone(&o_conv);
20984         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20985         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
20986         return tag_ptr(ret_conv, true);
20987 }
20988
20989 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
20990         void* e_ptr = untag_ptr(e);
20991         CHECK_ACCESS(e_ptr);
20992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20994         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20995         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
20996         return tag_ptr(ret_conv, true);
20997 }
20998
20999 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
21000         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
21001         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
21002         return ret_conv;
21003 }
21004
21005 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
21006         if (!ptr_is_owned(_res)) return;
21007         void* _res_ptr = untag_ptr(_res);
21008         CHECK_ACCESS(_res_ptr);
21009         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
21010         FREE(untag_ptr(_res));
21011         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
21012 }
21013
21014 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
21015         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21016         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
21017         return tag_ptr(ret_conv, true);
21018 }
21019 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
21020         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
21021         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
21022         return ret_conv;
21023 }
21024
21025 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
21026         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
21027         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21028         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
21029         return tag_ptr(ret_conv, true);
21030 }
21031
21032 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
21033         LDKOnionMessage o_conv;
21034         o_conv.inner = untag_ptr(o);
21035         o_conv.is_owned = ptr_is_owned(o);
21036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21037         o_conv = OnionMessage_clone(&o_conv);
21038         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21039         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
21040         return tag_ptr(ret_conv, true);
21041 }
21042
21043 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
21044         void* e_ptr = untag_ptr(e);
21045         CHECK_ACCESS(e_ptr);
21046         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21047         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21048         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21049         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
21050         return tag_ptr(ret_conv, true);
21051 }
21052
21053 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
21054         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
21055         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
21056         return ret_conv;
21057 }
21058
21059 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
21060         if (!ptr_is_owned(_res)) return;
21061         void* _res_ptr = untag_ptr(_res);
21062         CHECK_ACCESS(_res_ptr);
21063         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
21064         FREE(untag_ptr(_res));
21065         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
21066 }
21067
21068 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
21069         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21070         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
21071         return tag_ptr(ret_conv, true);
21072 }
21073 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21074         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
21075         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
21076         return ret_conv;
21077 }
21078
21079 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
21080         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
21081         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21082         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
21083         return tag_ptr(ret_conv, true);
21084 }
21085
21086 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
21087         LDKPing o_conv;
21088         o_conv.inner = untag_ptr(o);
21089         o_conv.is_owned = ptr_is_owned(o);
21090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21091         o_conv = Ping_clone(&o_conv);
21092         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21093         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
21094         return tag_ptr(ret_conv, true);
21095 }
21096
21097 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
21098         void* e_ptr = untag_ptr(e);
21099         CHECK_ACCESS(e_ptr);
21100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21102         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21103         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
21104         return tag_ptr(ret_conv, true);
21105 }
21106
21107 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
21108         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
21109         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
21110         return ret_conv;
21111 }
21112
21113 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
21114         if (!ptr_is_owned(_res)) return;
21115         void* _res_ptr = untag_ptr(_res);
21116         CHECK_ACCESS(_res_ptr);
21117         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
21118         FREE(untag_ptr(_res));
21119         CResult_PingDecodeErrorZ_free(_res_conv);
21120 }
21121
21122 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
21123         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21124         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
21125         return tag_ptr(ret_conv, true);
21126 }
21127 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
21128         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
21129         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
21130         return ret_conv;
21131 }
21132
21133 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
21134         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
21135         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21136         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
21137         return tag_ptr(ret_conv, true);
21138 }
21139
21140 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
21141         LDKPong o_conv;
21142         o_conv.inner = untag_ptr(o);
21143         o_conv.is_owned = ptr_is_owned(o);
21144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21145         o_conv = Pong_clone(&o_conv);
21146         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21147         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
21148         return tag_ptr(ret_conv, true);
21149 }
21150
21151 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
21152         void* e_ptr = untag_ptr(e);
21153         CHECK_ACCESS(e_ptr);
21154         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21155         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21156         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21157         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
21158         return tag_ptr(ret_conv, true);
21159 }
21160
21161 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
21162         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
21163         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
21164         return ret_conv;
21165 }
21166
21167 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
21168         if (!ptr_is_owned(_res)) return;
21169         void* _res_ptr = untag_ptr(_res);
21170         CHECK_ACCESS(_res_ptr);
21171         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
21172         FREE(untag_ptr(_res));
21173         CResult_PongDecodeErrorZ_free(_res_conv);
21174 }
21175
21176 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
21177         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21178         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
21179         return tag_ptr(ret_conv, true);
21180 }
21181 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
21182         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
21183         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
21184         return ret_conv;
21185 }
21186
21187 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
21188         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
21189         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21190         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
21191         return tag_ptr(ret_conv, true);
21192 }
21193
21194 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21195         LDKUnsignedChannelAnnouncement o_conv;
21196         o_conv.inner = untag_ptr(o);
21197         o_conv.is_owned = ptr_is_owned(o);
21198         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21199         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
21200         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21201         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
21202         return tag_ptr(ret_conv, true);
21203 }
21204
21205 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21206         void* e_ptr = untag_ptr(e);
21207         CHECK_ACCESS(e_ptr);
21208         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21209         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21210         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21211         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
21212         return tag_ptr(ret_conv, true);
21213 }
21214
21215 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21216         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21217         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21218         return ret_conv;
21219 }
21220
21221 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21222         if (!ptr_is_owned(_res)) return;
21223         void* _res_ptr = untag_ptr(_res);
21224         CHECK_ACCESS(_res_ptr);
21225         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21226         FREE(untag_ptr(_res));
21227         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
21228 }
21229
21230 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21231         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21232         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
21233         return tag_ptr(ret_conv, true);
21234 }
21235 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21236         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21237         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21238         return ret_conv;
21239 }
21240
21241 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21242         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21243         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21244         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21245         return tag_ptr(ret_conv, true);
21246 }
21247
21248 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21249         LDKChannelAnnouncement o_conv;
21250         o_conv.inner = untag_ptr(o);
21251         o_conv.is_owned = ptr_is_owned(o);
21252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21253         o_conv = ChannelAnnouncement_clone(&o_conv);
21254         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21255         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
21256         return tag_ptr(ret_conv, true);
21257 }
21258
21259 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21260         void* e_ptr = untag_ptr(e);
21261         CHECK_ACCESS(e_ptr);
21262         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21263         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21264         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21265         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
21266         return tag_ptr(ret_conv, true);
21267 }
21268
21269 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21270         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21271         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21272         return ret_conv;
21273 }
21274
21275 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21276         if (!ptr_is_owned(_res)) return;
21277         void* _res_ptr = untag_ptr(_res);
21278         CHECK_ACCESS(_res_ptr);
21279         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21280         FREE(untag_ptr(_res));
21281         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
21282 }
21283
21284 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21285         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21286         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
21287         return tag_ptr(ret_conv, true);
21288 }
21289 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21290         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21291         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21292         return ret_conv;
21293 }
21294
21295 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21296         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21297         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21298         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21299         return tag_ptr(ret_conv, true);
21300 }
21301
21302 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21303         LDKUnsignedChannelUpdate o_conv;
21304         o_conv.inner = untag_ptr(o);
21305         o_conv.is_owned = ptr_is_owned(o);
21306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21307         o_conv = UnsignedChannelUpdate_clone(&o_conv);
21308         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21309         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
21310         return tag_ptr(ret_conv, true);
21311 }
21312
21313 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
21314         void* e_ptr = untag_ptr(e);
21315         CHECK_ACCESS(e_ptr);
21316         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21317         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21318         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21319         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
21320         return tag_ptr(ret_conv, true);
21321 }
21322
21323 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21324         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
21325         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
21326         return ret_conv;
21327 }
21328
21329 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21330         if (!ptr_is_owned(_res)) return;
21331         void* _res_ptr = untag_ptr(_res);
21332         CHECK_ACCESS(_res_ptr);
21333         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
21334         FREE(untag_ptr(_res));
21335         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
21336 }
21337
21338 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21339         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21340         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
21341         return tag_ptr(ret_conv, true);
21342 }
21343 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21344         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21345         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21346         return ret_conv;
21347 }
21348
21349 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21350         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21351         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21352         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
21353         return tag_ptr(ret_conv, true);
21354 }
21355
21356 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21357         LDKChannelUpdate o_conv;
21358         o_conv.inner = untag_ptr(o);
21359         o_conv.is_owned = ptr_is_owned(o);
21360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21361         o_conv = ChannelUpdate_clone(&o_conv);
21362         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21363         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
21364         return tag_ptr(ret_conv, true);
21365 }
21366
21367 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
21368         void* e_ptr = untag_ptr(e);
21369         CHECK_ACCESS(e_ptr);
21370         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21371         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21372         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21373         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
21374         return tag_ptr(ret_conv, true);
21375 }
21376
21377 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21378         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
21379         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
21380         return ret_conv;
21381 }
21382
21383 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21384         if (!ptr_is_owned(_res)) return;
21385         void* _res_ptr = untag_ptr(_res);
21386         CHECK_ACCESS(_res_ptr);
21387         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
21388         FREE(untag_ptr(_res));
21389         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
21390 }
21391
21392 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21393         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21394         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
21395         return tag_ptr(ret_conv, true);
21396 }
21397 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21398         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21399         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21400         return ret_conv;
21401 }
21402
21403 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21404         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21405         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21406         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
21407         return tag_ptr(ret_conv, true);
21408 }
21409
21410 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
21411         LDKErrorMessage o_conv;
21412         o_conv.inner = untag_ptr(o);
21413         o_conv.is_owned = ptr_is_owned(o);
21414         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21415         o_conv = ErrorMessage_clone(&o_conv);
21416         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21417         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
21418         return tag_ptr(ret_conv, true);
21419 }
21420
21421 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
21422         void* e_ptr = untag_ptr(e);
21423         CHECK_ACCESS(e_ptr);
21424         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21425         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21426         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21427         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
21428         return tag_ptr(ret_conv, true);
21429 }
21430
21431 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
21432         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
21433         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
21434         return ret_conv;
21435 }
21436
21437 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
21438         if (!ptr_is_owned(_res)) return;
21439         void* _res_ptr = untag_ptr(_res);
21440         CHECK_ACCESS(_res_ptr);
21441         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
21442         FREE(untag_ptr(_res));
21443         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
21444 }
21445
21446 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
21447         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21448         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
21449         return tag_ptr(ret_conv, true);
21450 }
21451 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21452         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
21453         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
21454         return ret_conv;
21455 }
21456
21457 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
21458         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
21459         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21460         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
21461         return tag_ptr(ret_conv, true);
21462 }
21463
21464 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
21465         LDKWarningMessage o_conv;
21466         o_conv.inner = untag_ptr(o);
21467         o_conv.is_owned = ptr_is_owned(o);
21468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21469         o_conv = WarningMessage_clone(&o_conv);
21470         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21471         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
21472         return tag_ptr(ret_conv, true);
21473 }
21474
21475 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
21476         void* e_ptr = untag_ptr(e);
21477         CHECK_ACCESS(e_ptr);
21478         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21479         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21480         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21481         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
21482         return tag_ptr(ret_conv, true);
21483 }
21484
21485 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
21486         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
21487         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
21488         return ret_conv;
21489 }
21490
21491 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
21492         if (!ptr_is_owned(_res)) return;
21493         void* _res_ptr = untag_ptr(_res);
21494         CHECK_ACCESS(_res_ptr);
21495         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
21496         FREE(untag_ptr(_res));
21497         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
21498 }
21499
21500 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
21501         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21502         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
21503         return tag_ptr(ret_conv, true);
21504 }
21505 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21506         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
21507         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
21508         return ret_conv;
21509 }
21510
21511 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
21512         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
21513         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21514         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
21515         return tag_ptr(ret_conv, true);
21516 }
21517
21518 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21519         LDKUnsignedNodeAnnouncement o_conv;
21520         o_conv.inner = untag_ptr(o);
21521         o_conv.is_owned = ptr_is_owned(o);
21522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21523         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
21524         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21525         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
21526         return tag_ptr(ret_conv, true);
21527 }
21528
21529 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21530         void* e_ptr = untag_ptr(e);
21531         CHECK_ACCESS(e_ptr);
21532         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21533         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21534         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21535         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
21536         return tag_ptr(ret_conv, true);
21537 }
21538
21539 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21540         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21541         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21542         return ret_conv;
21543 }
21544
21545 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21546         if (!ptr_is_owned(_res)) return;
21547         void* _res_ptr = untag_ptr(_res);
21548         CHECK_ACCESS(_res_ptr);
21549         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
21550         FREE(untag_ptr(_res));
21551         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
21552 }
21553
21554 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21555         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21556         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
21557         return tag_ptr(ret_conv, true);
21558 }
21559 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21560         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21561         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21562         return ret_conv;
21563 }
21564
21565 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21566         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21567         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21568         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
21569         return tag_ptr(ret_conv, true);
21570 }
21571
21572 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21573         LDKNodeAnnouncement o_conv;
21574         o_conv.inner = untag_ptr(o);
21575         o_conv.is_owned = ptr_is_owned(o);
21576         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21577         o_conv = NodeAnnouncement_clone(&o_conv);
21578         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21579         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
21580         return tag_ptr(ret_conv, true);
21581 }
21582
21583 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21584         void* e_ptr = untag_ptr(e);
21585         CHECK_ACCESS(e_ptr);
21586         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21587         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21588         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21589         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
21590         return tag_ptr(ret_conv, true);
21591 }
21592
21593 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21594         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21595         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21596         return ret_conv;
21597 }
21598
21599 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21600         if (!ptr_is_owned(_res)) return;
21601         void* _res_ptr = untag_ptr(_res);
21602         CHECK_ACCESS(_res_ptr);
21603         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
21604         FREE(untag_ptr(_res));
21605         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
21606 }
21607
21608 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21609         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21610         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
21611         return tag_ptr(ret_conv, true);
21612 }
21613 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21614         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21615         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21616         return ret_conv;
21617 }
21618
21619 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21620         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21621         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21622         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
21623         return tag_ptr(ret_conv, true);
21624 }
21625
21626 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
21627         LDKQueryShortChannelIds o_conv;
21628         o_conv.inner = untag_ptr(o);
21629         o_conv.is_owned = ptr_is_owned(o);
21630         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21631         o_conv = QueryShortChannelIds_clone(&o_conv);
21632         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21633         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
21634         return tag_ptr(ret_conv, true);
21635 }
21636
21637 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
21638         void* e_ptr = untag_ptr(e);
21639         CHECK_ACCESS(e_ptr);
21640         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21641         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21642         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21643         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
21644         return tag_ptr(ret_conv, true);
21645 }
21646
21647 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
21648         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
21649         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
21650         return ret_conv;
21651 }
21652
21653 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
21654         if (!ptr_is_owned(_res)) return;
21655         void* _res_ptr = untag_ptr(_res);
21656         CHECK_ACCESS(_res_ptr);
21657         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
21658         FREE(untag_ptr(_res));
21659         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
21660 }
21661
21662 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
21663         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21664         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
21665         return tag_ptr(ret_conv, true);
21666 }
21667 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
21668         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
21669         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
21670         return ret_conv;
21671 }
21672
21673 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
21674         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
21675         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21676         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
21677         return tag_ptr(ret_conv, true);
21678 }
21679
21680 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
21681         LDKReplyShortChannelIdsEnd o_conv;
21682         o_conv.inner = untag_ptr(o);
21683         o_conv.is_owned = ptr_is_owned(o);
21684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21685         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
21686         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21687         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
21688         return tag_ptr(ret_conv, true);
21689 }
21690
21691 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
21692         void* e_ptr = untag_ptr(e);
21693         CHECK_ACCESS(e_ptr);
21694         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21695         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21696         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21697         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
21698         return tag_ptr(ret_conv, true);
21699 }
21700
21701 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
21702         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
21703         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
21704         return ret_conv;
21705 }
21706
21707 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
21708         if (!ptr_is_owned(_res)) return;
21709         void* _res_ptr = untag_ptr(_res);
21710         CHECK_ACCESS(_res_ptr);
21711         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
21712         FREE(untag_ptr(_res));
21713         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
21714 }
21715
21716 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
21717         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21718         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
21719         return tag_ptr(ret_conv, true);
21720 }
21721 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
21722         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
21723         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
21724         return ret_conv;
21725 }
21726
21727 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
21728         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
21729         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21730         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
21731         return tag_ptr(ret_conv, true);
21732 }
21733
21734 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
21735         LDKQueryChannelRange o_conv;
21736         o_conv.inner = untag_ptr(o);
21737         o_conv.is_owned = ptr_is_owned(o);
21738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21739         o_conv = QueryChannelRange_clone(&o_conv);
21740         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21741         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
21742         return tag_ptr(ret_conv, true);
21743 }
21744
21745 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
21746         void* e_ptr = untag_ptr(e);
21747         CHECK_ACCESS(e_ptr);
21748         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21749         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21750         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21751         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
21752         return tag_ptr(ret_conv, true);
21753 }
21754
21755 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21756         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
21757         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
21758         return ret_conv;
21759 }
21760
21761 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
21762         if (!ptr_is_owned(_res)) return;
21763         void* _res_ptr = untag_ptr(_res);
21764         CHECK_ACCESS(_res_ptr);
21765         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
21766         FREE(untag_ptr(_res));
21767         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
21768 }
21769
21770 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21771         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21772         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
21773         return tag_ptr(ret_conv, true);
21774 }
21775 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21776         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
21777         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21778         return ret_conv;
21779 }
21780
21781 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21782         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
21783         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21784         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
21785         return tag_ptr(ret_conv, true);
21786 }
21787
21788 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
21789         LDKReplyChannelRange o_conv;
21790         o_conv.inner = untag_ptr(o);
21791         o_conv.is_owned = ptr_is_owned(o);
21792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21793         o_conv = ReplyChannelRange_clone(&o_conv);
21794         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21795         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
21796         return tag_ptr(ret_conv, true);
21797 }
21798
21799 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
21800         void* e_ptr = untag_ptr(e);
21801         CHECK_ACCESS(e_ptr);
21802         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21803         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21804         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21805         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
21806         return tag_ptr(ret_conv, true);
21807 }
21808
21809 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21810         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
21811         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
21812         return ret_conv;
21813 }
21814
21815 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
21816         if (!ptr_is_owned(_res)) return;
21817         void* _res_ptr = untag_ptr(_res);
21818         CHECK_ACCESS(_res_ptr);
21819         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
21820         FREE(untag_ptr(_res));
21821         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
21822 }
21823
21824 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21825         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21826         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
21827         return tag_ptr(ret_conv, true);
21828 }
21829 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21830         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
21831         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21832         return ret_conv;
21833 }
21834
21835 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21836         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
21837         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21838         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
21839         return tag_ptr(ret_conv, true);
21840 }
21841
21842 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
21843         LDKGossipTimestampFilter o_conv;
21844         o_conv.inner = untag_ptr(o);
21845         o_conv.is_owned = ptr_is_owned(o);
21846         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21847         o_conv = GossipTimestampFilter_clone(&o_conv);
21848         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21849         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
21850         return tag_ptr(ret_conv, true);
21851 }
21852
21853 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
21854         void* e_ptr = untag_ptr(e);
21855         CHECK_ACCESS(e_ptr);
21856         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21857         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21858         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21859         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
21860         return tag_ptr(ret_conv, true);
21861 }
21862
21863 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
21864         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
21865         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
21866         return ret_conv;
21867 }
21868
21869 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
21870         if (!ptr_is_owned(_res)) return;
21871         void* _res_ptr = untag_ptr(_res);
21872         CHECK_ACCESS(_res_ptr);
21873         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
21874         FREE(untag_ptr(_res));
21875         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
21876 }
21877
21878 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
21879         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21880         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
21881         return tag_ptr(ret_conv, true);
21882 }
21883 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
21884         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
21885         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
21886         return ret_conv;
21887 }
21888
21889 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
21890         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
21891         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21892         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
21893         return tag_ptr(ret_conv, true);
21894 }
21895
21896 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
21897         void* o_ptr = untag_ptr(o);
21898         CHECK_ACCESS(o_ptr);
21899         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
21900         if (o_conv.free == LDKFilter_JCalls_free) {
21901                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21902                 LDKFilter_JCalls_cloned(&o_conv);
21903         }
21904         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21905         *ret_copy = COption_FilterZ_some(o_conv);
21906         uint64_t ret_ref = tag_ptr(ret_copy, true);
21907         return ret_ref;
21908 }
21909
21910 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
21911         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21912         *ret_copy = COption_FilterZ_none();
21913         uint64_t ret_ref = tag_ptr(ret_copy, true);
21914         return ret_ref;
21915 }
21916
21917 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
21918         if (!ptr_is_owned(_res)) return;
21919         void* _res_ptr = untag_ptr(_res);
21920         CHECK_ACCESS(_res_ptr);
21921         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
21922         FREE(untag_ptr(_res));
21923         COption_FilterZ_free(_res_conv);
21924 }
21925
21926 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
21927         LDKLockedChannelMonitor o_conv;
21928         o_conv.inner = untag_ptr(o);
21929         o_conv.is_owned = ptr_is_owned(o);
21930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21931         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
21932         
21933         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21934         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
21935         return tag_ptr(ret_conv, true);
21936 }
21937
21938 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
21939         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21940         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
21941         return tag_ptr(ret_conv, true);
21942 }
21943
21944 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
21945         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
21946         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
21947         return ret_conv;
21948 }
21949
21950 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
21951         if (!ptr_is_owned(_res)) return;
21952         void* _res_ptr = untag_ptr(_res);
21953         CHECK_ACCESS(_res_ptr);
21954         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
21955         FREE(untag_ptr(_res));
21956         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
21957 }
21958
21959 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
21960         LDKCVec_OutPointZ _res_constr;
21961         _res_constr.datalen = _res->arr_len;
21962         if (_res_constr.datalen > 0)
21963                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
21964         else
21965                 _res_constr.data = NULL;
21966         uint64_t* _res_vals = _res->elems;
21967         for (size_t k = 0; k < _res_constr.datalen; k++) {
21968                 uint64_t _res_conv_10 = _res_vals[k];
21969                 LDKOutPoint _res_conv_10_conv;
21970                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21971                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21972                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21973                 _res_constr.data[k] = _res_conv_10_conv;
21974         }
21975         FREE(_res);
21976         CVec_OutPointZ_free(_res_constr);
21977 }
21978
21979 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
21980         LDKCVec_MonitorUpdateIdZ _res_constr;
21981         _res_constr.datalen = _res->arr_len;
21982         if (_res_constr.datalen > 0)
21983                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21984         else
21985                 _res_constr.data = NULL;
21986         uint64_t* _res_vals = _res->elems;
21987         for (size_t r = 0; r < _res_constr.datalen; r++) {
21988                 uint64_t _res_conv_17 = _res_vals[r];
21989                 LDKMonitorUpdateId _res_conv_17_conv;
21990                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
21991                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
21992                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
21993                 _res_constr.data[r] = _res_conv_17_conv;
21994         }
21995         FREE(_res);
21996         CVec_MonitorUpdateIdZ_free(_res_constr);
21997 }
21998
21999 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
22000         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22001         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
22002         return tag_ptr(ret_conv, true);
22003 }
22004 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
22005         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
22006         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
22007         return ret_conv;
22008 }
22009
22010 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
22011         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
22012         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22013         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
22014         return tag_ptr(ret_conv, true);
22015 }
22016
22017 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
22018         LDKOutPoint a_conv;
22019         a_conv.inner = untag_ptr(a);
22020         a_conv.is_owned = ptr_is_owned(a);
22021         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22022         a_conv = OutPoint_clone(&a_conv);
22023         LDKCVec_MonitorUpdateIdZ b_constr;
22024         b_constr.datalen = b->arr_len;
22025         if (b_constr.datalen > 0)
22026                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
22027         else
22028                 b_constr.data = NULL;
22029         uint64_t* b_vals = b->elems;
22030         for (size_t r = 0; r < b_constr.datalen; r++) {
22031                 uint64_t b_conv_17 = b_vals[r];
22032                 LDKMonitorUpdateId b_conv_17_conv;
22033                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
22034                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
22035                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
22036                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
22037                 b_constr.data[r] = b_conv_17_conv;
22038         }
22039         FREE(b);
22040         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22041         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
22042         return tag_ptr(ret_conv, true);
22043 }
22044
22045 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
22046         if (!ptr_is_owned(_res)) return;
22047         void* _res_ptr = untag_ptr(_res);
22048         CHECK_ACCESS(_res_ptr);
22049         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
22050         FREE(untag_ptr(_res));
22051         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
22052 }
22053
22054 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
22055         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
22056         _res_constr.datalen = _res->arr_len;
22057         if (_res_constr.datalen > 0)
22058                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
22059         else
22060                 _res_constr.data = NULL;
22061         uint64_t* _res_vals = _res->elems;
22062         for (size_t p = 0; p < _res_constr.datalen; p++) {
22063                 uint64_t _res_conv_41 = _res_vals[p];
22064                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
22065                 CHECK_ACCESS(_res_conv_41_ptr);
22066                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
22067                 FREE(untag_ptr(_res_conv_41));
22068                 _res_constr.data[p] = _res_conv_41_conv;
22069         }
22070         FREE(_res);
22071         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
22072 }
22073
22074 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
22075         LDKCVec_PhantomRouteHintsZ _res_constr;
22076         _res_constr.datalen = _res->arr_len;
22077         if (_res_constr.datalen > 0)
22078                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
22079         else
22080                 _res_constr.data = NULL;
22081         uint64_t* _res_vals = _res->elems;
22082         for (size_t t = 0; t < _res_constr.datalen; t++) {
22083                 uint64_t _res_conv_19 = _res_vals[t];
22084                 LDKPhantomRouteHints _res_conv_19_conv;
22085                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
22086                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
22087                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22088                 _res_constr.data[t] = _res_conv_19_conv;
22089         }
22090         FREE(_res);
22091         CVec_PhantomRouteHintsZ_free(_res_constr);
22092 }
22093
22094 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
22095         LDKInvoice o_conv;
22096         o_conv.inner = untag_ptr(o);
22097         o_conv.is_owned = ptr_is_owned(o);
22098         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22099         o_conv = Invoice_clone(&o_conv);
22100         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22101         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
22102         return tag_ptr(ret_conv, true);
22103 }
22104
22105 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
22106         void* e_ptr = untag_ptr(e);
22107         CHECK_ACCESS(e_ptr);
22108         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
22109         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
22110         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22111         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
22112         return tag_ptr(ret_conv, true);
22113 }
22114
22115 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
22116         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
22117         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
22118         return ret_conv;
22119 }
22120
22121 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
22122         if (!ptr_is_owned(_res)) return;
22123         void* _res_ptr = untag_ptr(_res);
22124         CHECK_ACCESS(_res_ptr);
22125         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
22126         FREE(untag_ptr(_res));
22127         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
22128 }
22129
22130 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
22131         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22132         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
22133         return tag_ptr(ret_conv, true);
22134 }
22135 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
22136         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
22137         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
22138         return ret_conv;
22139 }
22140
22141 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
22142         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
22143         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22144         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
22145         return tag_ptr(ret_conv, true);
22146 }
22147
22148 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
22149         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
22150         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22151         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
22152         return tag_ptr(ret_conv, true);
22153 }
22154
22155 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
22156         void* e_ptr = untag_ptr(e);
22157         CHECK_ACCESS(e_ptr);
22158         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
22159         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
22160         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22161         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
22162         return tag_ptr(ret_conv, true);
22163 }
22164
22165 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
22166         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
22167         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
22168         return ret_conv;
22169 }
22170
22171 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
22172         if (!ptr_is_owned(_res)) return;
22173         void* _res_ptr = untag_ptr(_res);
22174         CHECK_ACCESS(_res_ptr);
22175         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
22176         FREE(untag_ptr(_res));
22177         CResult_SiPrefixParseErrorZ_free(_res_conv);
22178 }
22179
22180 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
22181         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22182         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
22183         return tag_ptr(ret_conv, true);
22184 }
22185 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
22186         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
22187         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
22188         return ret_conv;
22189 }
22190
22191 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
22192         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
22193         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22194         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
22195         return tag_ptr(ret_conv, true);
22196 }
22197
22198 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
22199         LDKInvoice o_conv;
22200         o_conv.inner = untag_ptr(o);
22201         o_conv.is_owned = ptr_is_owned(o);
22202         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22203         o_conv = Invoice_clone(&o_conv);
22204         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22205         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
22206         return tag_ptr(ret_conv, true);
22207 }
22208
22209 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
22210         void* e_ptr = untag_ptr(e);
22211         CHECK_ACCESS(e_ptr);
22212         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
22213         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
22214         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22215         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
22216         return tag_ptr(ret_conv, true);
22217 }
22218
22219 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
22220         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
22221         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
22222         return ret_conv;
22223 }
22224
22225 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
22226         if (!ptr_is_owned(_res)) return;
22227         void* _res_ptr = untag_ptr(_res);
22228         CHECK_ACCESS(_res_ptr);
22229         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
22230         FREE(untag_ptr(_res));
22231         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
22232 }
22233
22234 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
22235         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22236         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
22237         return tag_ptr(ret_conv, true);
22238 }
22239 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
22240         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
22241         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
22242         return ret_conv;
22243 }
22244
22245 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
22246         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
22247         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22248         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
22249         return tag_ptr(ret_conv, true);
22250 }
22251
22252 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
22253         LDKSignedRawInvoice o_conv;
22254         o_conv.inner = untag_ptr(o);
22255         o_conv.is_owned = ptr_is_owned(o);
22256         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22257         o_conv = SignedRawInvoice_clone(&o_conv);
22258         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22259         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
22260         return tag_ptr(ret_conv, true);
22261 }
22262
22263 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
22264         void* e_ptr = untag_ptr(e);
22265         CHECK_ACCESS(e_ptr);
22266         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
22267         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
22268         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22269         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
22270         return tag_ptr(ret_conv, true);
22271 }
22272
22273 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
22274         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
22275         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
22276         return ret_conv;
22277 }
22278
22279 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
22280         if (!ptr_is_owned(_res)) return;
22281         void* _res_ptr = untag_ptr(_res);
22282         CHECK_ACCESS(_res_ptr);
22283         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
22284         FREE(untag_ptr(_res));
22285         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
22286 }
22287
22288 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
22289         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22290         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
22291         return tag_ptr(ret_conv, true);
22292 }
22293 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
22294         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
22295         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
22296         return ret_conv;
22297 }
22298
22299 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
22300         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
22301         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22302         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
22303         return tag_ptr(ret_conv, true);
22304 }
22305
22306 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
22307         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22308         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
22309         return tag_ptr(ret_conv, true);
22310 }
22311 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
22312         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
22313         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
22314         return ret_conv;
22315 }
22316
22317 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
22318         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
22319         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22320         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
22321         return tag_ptr(ret_conv, true);
22322 }
22323
22324 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
22325         LDKRawInvoice a_conv;
22326         a_conv.inner = untag_ptr(a);
22327         a_conv.is_owned = ptr_is_owned(a);
22328         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22329         a_conv = RawInvoice_clone(&a_conv);
22330         LDKThirtyTwoBytes b_ref;
22331         CHECK(b->arr_len == 32);
22332         memcpy(b_ref.data, b->elems, 32); FREE(b);
22333         LDKInvoiceSignature c_conv;
22334         c_conv.inner = untag_ptr(c);
22335         c_conv.is_owned = ptr_is_owned(c);
22336         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22337         c_conv = InvoiceSignature_clone(&c_conv);
22338         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22339         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
22340         return tag_ptr(ret_conv, true);
22341 }
22342
22343 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
22344         if (!ptr_is_owned(_res)) return;
22345         void* _res_ptr = untag_ptr(_res);
22346         CHECK_ACCESS(_res_ptr);
22347         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
22348         FREE(untag_ptr(_res));
22349         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
22350 }
22351
22352 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
22353         LDKPayeePubKey o_conv;
22354         o_conv.inner = untag_ptr(o);
22355         o_conv.is_owned = ptr_is_owned(o);
22356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22357         o_conv = PayeePubKey_clone(&o_conv);
22358         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22359         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
22360         return tag_ptr(ret_conv, true);
22361 }
22362
22363 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
22364         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
22365         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22366         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
22367         return tag_ptr(ret_conv, true);
22368 }
22369
22370 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
22371         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
22372         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
22373         return ret_conv;
22374 }
22375
22376 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
22377         if (!ptr_is_owned(_res)) return;
22378         void* _res_ptr = untag_ptr(_res);
22379         CHECK_ACCESS(_res_ptr);
22380         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
22381         FREE(untag_ptr(_res));
22382         CResult_PayeePubKeyErrorZ_free(_res_conv);
22383 }
22384
22385 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
22386         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22387         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
22388         return tag_ptr(ret_conv, true);
22389 }
22390 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
22391         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
22392         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
22393         return ret_conv;
22394 }
22395
22396 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
22397         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
22398         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22399         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
22400         return tag_ptr(ret_conv, true);
22401 }
22402
22403 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
22404         LDKCVec_PrivateRouteZ _res_constr;
22405         _res_constr.datalen = _res->arr_len;
22406         if (_res_constr.datalen > 0)
22407                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
22408         else
22409                 _res_constr.data = NULL;
22410         uint64_t* _res_vals = _res->elems;
22411         for (size_t o = 0; o < _res_constr.datalen; o++) {
22412                 uint64_t _res_conv_14 = _res_vals[o];
22413                 LDKPrivateRoute _res_conv_14_conv;
22414                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
22415                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
22416                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
22417                 _res_constr.data[o] = _res_conv_14_conv;
22418         }
22419         FREE(_res);
22420         CVec_PrivateRouteZ_free(_res_constr);
22421 }
22422
22423 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
22424         LDKPositiveTimestamp o_conv;
22425         o_conv.inner = untag_ptr(o);
22426         o_conv.is_owned = ptr_is_owned(o);
22427         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22428         o_conv = PositiveTimestamp_clone(&o_conv);
22429         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22430         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
22431         return tag_ptr(ret_conv, true);
22432 }
22433
22434 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
22435         LDKCreationError e_conv = LDKCreationError_from_js(e);
22436         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22437         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
22438         return tag_ptr(ret_conv, true);
22439 }
22440
22441 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
22442         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
22443         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
22444         return ret_conv;
22445 }
22446
22447 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
22448         if (!ptr_is_owned(_res)) return;
22449         void* _res_ptr = untag_ptr(_res);
22450         CHECK_ACCESS(_res_ptr);
22451         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
22452         FREE(untag_ptr(_res));
22453         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
22454 }
22455
22456 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
22457         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22458         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
22459         return tag_ptr(ret_conv, true);
22460 }
22461 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
22462         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
22463         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
22464         return ret_conv;
22465 }
22466
22467 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
22468         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
22469         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22470         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
22471         return tag_ptr(ret_conv, true);
22472 }
22473
22474 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
22475         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22476         *ret_conv = CResult_NoneSemanticErrorZ_ok();
22477         return tag_ptr(ret_conv, true);
22478 }
22479
22480 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
22481         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
22482         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22483         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
22484         return tag_ptr(ret_conv, true);
22485 }
22486
22487 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
22488         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
22489         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
22490         return ret_conv;
22491 }
22492
22493 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
22494         if (!ptr_is_owned(_res)) return;
22495         void* _res_ptr = untag_ptr(_res);
22496         CHECK_ACCESS(_res_ptr);
22497         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
22498         FREE(untag_ptr(_res));
22499         CResult_NoneSemanticErrorZ_free(_res_conv);
22500 }
22501
22502 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
22503         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22504         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
22505         return tag_ptr(ret_conv, true);
22506 }
22507 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
22508         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
22509         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
22510         return ret_conv;
22511 }
22512
22513 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
22514         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
22515         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22516         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
22517         return tag_ptr(ret_conv, true);
22518 }
22519
22520 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
22521         LDKInvoice o_conv;
22522         o_conv.inner = untag_ptr(o);
22523         o_conv.is_owned = ptr_is_owned(o);
22524         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22525         o_conv = Invoice_clone(&o_conv);
22526         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22527         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
22528         return tag_ptr(ret_conv, true);
22529 }
22530
22531 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
22532         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
22533         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22534         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
22535         return tag_ptr(ret_conv, true);
22536 }
22537
22538 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
22539         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
22540         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
22541         return ret_conv;
22542 }
22543
22544 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
22545         if (!ptr_is_owned(_res)) return;
22546         void* _res_ptr = untag_ptr(_res);
22547         CHECK_ACCESS(_res_ptr);
22548         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
22549         FREE(untag_ptr(_res));
22550         CResult_InvoiceSemanticErrorZ_free(_res_conv);
22551 }
22552
22553 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
22554         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22555         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
22556         return tag_ptr(ret_conv, true);
22557 }
22558 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
22559         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
22560         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
22561         return ret_conv;
22562 }
22563
22564 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
22565         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
22566         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22567         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
22568         return tag_ptr(ret_conv, true);
22569 }
22570
22571 void  __attribute__((export_name("TS_CVec_AddressZ_free"))) TS_CVec_AddressZ_free(ptrArray _res) {
22572         LDKCVec_AddressZ _res_constr;
22573         _res_constr.datalen = _res->arr_len;
22574         if (_res_constr.datalen > 0)
22575                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_AddressZ Elements");
22576         else
22577                 _res_constr.data = NULL;
22578         jstring* _res_vals = (void*) _res->elems;
22579         for (size_t i = 0; i < _res_constr.datalen; i++) {
22580                 jstring _res_conv_8 = _res_vals[i];
22581                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
22582                 _res_constr.data[i] = dummy;
22583         }
22584         FREE(_res);
22585         CVec_AddressZ_free(_res_constr);
22586 }
22587
22588 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
22589         LDKDescription o_conv;
22590         o_conv.inner = untag_ptr(o);
22591         o_conv.is_owned = ptr_is_owned(o);
22592         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22593         o_conv = Description_clone(&o_conv);
22594         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22595         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
22596         return tag_ptr(ret_conv, true);
22597 }
22598
22599 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
22600         LDKCreationError e_conv = LDKCreationError_from_js(e);
22601         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22602         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
22603         return tag_ptr(ret_conv, true);
22604 }
22605
22606 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
22607         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
22608         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
22609         return ret_conv;
22610 }
22611
22612 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
22613         if (!ptr_is_owned(_res)) return;
22614         void* _res_ptr = untag_ptr(_res);
22615         CHECK_ACCESS(_res_ptr);
22616         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
22617         FREE(untag_ptr(_res));
22618         CResult_DescriptionCreationErrorZ_free(_res_conv);
22619 }
22620
22621 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
22622         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22623         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
22624         return tag_ptr(ret_conv, true);
22625 }
22626 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
22627         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
22628         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
22629         return ret_conv;
22630 }
22631
22632 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
22633         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
22634         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22635         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
22636         return tag_ptr(ret_conv, true);
22637 }
22638
22639 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
22640         LDKPrivateRoute o_conv;
22641         o_conv.inner = untag_ptr(o);
22642         o_conv.is_owned = ptr_is_owned(o);
22643         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22644         o_conv = PrivateRoute_clone(&o_conv);
22645         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22646         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
22647         return tag_ptr(ret_conv, true);
22648 }
22649
22650 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
22651         LDKCreationError e_conv = LDKCreationError_from_js(e);
22652         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22653         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
22654         return tag_ptr(ret_conv, true);
22655 }
22656
22657 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
22658         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
22659         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
22660         return ret_conv;
22661 }
22662
22663 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
22664         if (!ptr_is_owned(_res)) return;
22665         void* _res_ptr = untag_ptr(_res);
22666         CHECK_ACCESS(_res_ptr);
22667         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
22668         FREE(untag_ptr(_res));
22669         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
22670 }
22671
22672 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
22673         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22674         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
22675         return tag_ptr(ret_conv, true);
22676 }
22677 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
22678         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
22679         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
22680         return ret_conv;
22681 }
22682
22683 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
22684         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
22685         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22686         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
22687         return tag_ptr(ret_conv, true);
22688 }
22689
22690 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
22691         if (!ptr_is_owned(this_ptr)) return;
22692         void* this_ptr_ptr = untag_ptr(this_ptr);
22693         CHECK_ACCESS(this_ptr_ptr);
22694         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
22695         FREE(untag_ptr(this_ptr));
22696         APIError_free(this_ptr_conv);
22697 }
22698
22699 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
22700         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22701         *ret_copy = APIError_clone(arg);
22702         uint64_t ret_ref = tag_ptr(ret_copy, true);
22703         return ret_ref;
22704 }
22705 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
22706         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
22707         int64_t ret_conv = APIError_clone_ptr(arg_conv);
22708         return ret_conv;
22709 }
22710
22711 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
22712         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
22713         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22714         *ret_copy = APIError_clone(orig_conv);
22715         uint64_t ret_ref = tag_ptr(ret_copy, true);
22716         return ret_ref;
22717 }
22718
22719 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
22720         LDKStr err_conv = str_ref_to_owned_c(err);
22721         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22722         *ret_copy = APIError_apimisuse_error(err_conv);
22723         uint64_t ret_ref = tag_ptr(ret_copy, true);
22724         return ret_ref;
22725 }
22726
22727 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
22728         LDKStr err_conv = str_ref_to_owned_c(err);
22729         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22730         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
22731         uint64_t ret_ref = tag_ptr(ret_copy, true);
22732         return ret_ref;
22733 }
22734
22735 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
22736         LDKStr err_conv = str_ref_to_owned_c(err);
22737         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22738         *ret_copy = APIError_invalid_route(err_conv);
22739         uint64_t ret_ref = tag_ptr(ret_copy, true);
22740         return ret_ref;
22741 }
22742
22743 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
22744         LDKStr err_conv = str_ref_to_owned_c(err);
22745         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22746         *ret_copy = APIError_channel_unavailable(err_conv);
22747         uint64_t ret_ref = tag_ptr(ret_copy, true);
22748         return ret_ref;
22749 }
22750
22751 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
22752         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22753         *ret_copy = APIError_monitor_update_in_progress();
22754         uint64_t ret_ref = tag_ptr(ret_copy, true);
22755         return ret_ref;
22756 }
22757
22758 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
22759         LDKShutdownScript script_conv;
22760         script_conv.inner = untag_ptr(script);
22761         script_conv.is_owned = ptr_is_owned(script);
22762         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
22763         script_conv = ShutdownScript_clone(&script_conv);
22764         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22765         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
22766         uint64_t ret_ref = tag_ptr(ret_copy, true);
22767         return ret_ref;
22768 }
22769
22770 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
22771         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
22772         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
22773         jboolean ret_conv = APIError_eq(a_conv, b_conv);
22774         return ret_conv;
22775 }
22776
22777 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
22778         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
22779         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
22780         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22781         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22782         CVec_u8Z_free(ret_var);
22783         return ret_arr;
22784 }
22785
22786 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
22787         LDKu8slice ser_ref;
22788         ser_ref.datalen = ser->arr_len;
22789         ser_ref.data = ser->elems;
22790         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
22791         *ret_conv = APIError_read(ser_ref);
22792         FREE(ser);
22793         return tag_ptr(ret_conv, true);
22794 }
22795
22796 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
22797         LDKBigSize this_obj_conv;
22798         this_obj_conv.inner = untag_ptr(this_obj);
22799         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22801         BigSize_free(this_obj_conv);
22802 }
22803
22804 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
22805         LDKBigSize this_ptr_conv;
22806         this_ptr_conv.inner = untag_ptr(this_ptr);
22807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22809         this_ptr_conv.is_owned = false;
22810         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
22811         return ret_conv;
22812 }
22813
22814 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
22815         LDKBigSize this_ptr_conv;
22816         this_ptr_conv.inner = untag_ptr(this_ptr);
22817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22819         this_ptr_conv.is_owned = false;
22820         BigSize_set_a(&this_ptr_conv, val);
22821 }
22822
22823 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
22824         LDKBigSize ret_var = BigSize_new(a_arg);
22825         uint64_t ret_ref = 0;
22826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22828         return ret_ref;
22829 }
22830
22831 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
22832         LDKHostname this_obj_conv;
22833         this_obj_conv.inner = untag_ptr(this_obj);
22834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22836         Hostname_free(this_obj_conv);
22837 }
22838
22839 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
22840         LDKHostname ret_var = Hostname_clone(arg);
22841         uint64_t ret_ref = 0;
22842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22844         return ret_ref;
22845 }
22846 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
22847         LDKHostname arg_conv;
22848         arg_conv.inner = untag_ptr(arg);
22849         arg_conv.is_owned = ptr_is_owned(arg);
22850         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22851         arg_conv.is_owned = false;
22852         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
22853         return ret_conv;
22854 }
22855
22856 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
22857         LDKHostname orig_conv;
22858         orig_conv.inner = untag_ptr(orig);
22859         orig_conv.is_owned = ptr_is_owned(orig);
22860         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22861         orig_conv.is_owned = false;
22862         LDKHostname ret_var = Hostname_clone(&orig_conv);
22863         uint64_t ret_ref = 0;
22864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22866         return ret_ref;
22867 }
22868
22869 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
22870         LDKHostname a_conv;
22871         a_conv.inner = untag_ptr(a);
22872         a_conv.is_owned = ptr_is_owned(a);
22873         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22874         a_conv.is_owned = false;
22875         LDKHostname b_conv;
22876         b_conv.inner = untag_ptr(b);
22877         b_conv.is_owned = ptr_is_owned(b);
22878         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22879         b_conv.is_owned = false;
22880         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
22881         return ret_conv;
22882 }
22883
22884 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
22885         LDKHostname this_arg_conv;
22886         this_arg_conv.inner = untag_ptr(this_arg);
22887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22889         this_arg_conv.is_owned = false;
22890         int8_t ret_conv = Hostname_len(&this_arg_conv);
22891         return ret_conv;
22892 }
22893
22894 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
22895         LDKu8slice msg_ref;
22896         msg_ref.datalen = msg->arr_len;
22897         msg_ref.data = msg->elems;
22898         uint8_t sk_arr[32];
22899         CHECK(sk->arr_len == 32);
22900         memcpy(sk_arr, sk->elems, 32); FREE(sk);
22901         uint8_t (*sk_ref)[32] = &sk_arr;
22902         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22903         *ret_conv = sign(msg_ref, sk_ref);
22904         FREE(msg);
22905         return tag_ptr(ret_conv, true);
22906 }
22907
22908 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
22909         LDKu8slice msg_ref;
22910         msg_ref.datalen = msg->arr_len;
22911         msg_ref.data = msg->elems;
22912         LDKStr sig_conv = str_ref_to_owned_c(sig);
22913         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22914         *ret_conv = recover_pk(msg_ref, sig_conv);
22915         FREE(msg);
22916         return tag_ptr(ret_conv, true);
22917 }
22918
22919 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
22920         LDKu8slice msg_ref;
22921         msg_ref.datalen = msg->arr_len;
22922         msg_ref.data = msg->elems;
22923         LDKStr sig_conv = str_ref_to_owned_c(sig);
22924         LDKPublicKey pk_ref;
22925         CHECK(pk->arr_len == 33);
22926         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
22927         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
22928         FREE(msg);
22929         return ret_conv;
22930 }
22931
22932 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
22933         LDKu8slice hrp_bytes_ref;
22934         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
22935         hrp_bytes_ref.data = hrp_bytes->elems;
22936         LDKCVec_U5Z data_without_signature_constr;
22937         data_without_signature_constr.datalen = data_without_signature->arr_len;
22938         if (data_without_signature_constr.datalen > 0)
22939                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
22940         else
22941                 data_without_signature_constr.data = NULL;
22942         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
22943         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
22944                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
22945                 
22946                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
22947         }
22948         FREE(data_without_signature);
22949         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
22950         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22951         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22952         CVec_u8Z_free(ret_var);
22953         FREE(hrp_bytes);
22954         return ret_arr;
22955 }
22956
22957 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
22958         if (!ptr_is_owned(this_ptr)) return;
22959         void* this_ptr_ptr = untag_ptr(this_ptr);
22960         CHECK_ACCESS(this_ptr_ptr);
22961         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
22962         FREE(untag_ptr(this_ptr));
22963         Persister_free(this_ptr_conv);
22964 }
22965
22966 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
22967         LDKUntrustedString this_obj_conv;
22968         this_obj_conv.inner = untag_ptr(this_obj);
22969         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22971         UntrustedString_free(this_obj_conv);
22972 }
22973
22974 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
22975         LDKUntrustedString this_ptr_conv;
22976         this_ptr_conv.inner = untag_ptr(this_ptr);
22977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22979         this_ptr_conv.is_owned = false;
22980         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
22981         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22982         Str_free(ret_str);
22983         return ret_conv;
22984 }
22985
22986 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
22987         LDKUntrustedString this_ptr_conv;
22988         this_ptr_conv.inner = untag_ptr(this_ptr);
22989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22991         this_ptr_conv.is_owned = false;
22992         LDKStr val_conv = str_ref_to_owned_c(val);
22993         UntrustedString_set_a(&this_ptr_conv, val_conv);
22994 }
22995
22996 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
22997         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
22998         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
22999         uint64_t ret_ref = 0;
23000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23002         return ret_ref;
23003 }
23004
23005 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
23006         LDKUntrustedString ret_var = UntrustedString_clone(arg);
23007         uint64_t ret_ref = 0;
23008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23010         return ret_ref;
23011 }
23012 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
23013         LDKUntrustedString arg_conv;
23014         arg_conv.inner = untag_ptr(arg);
23015         arg_conv.is_owned = ptr_is_owned(arg);
23016         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23017         arg_conv.is_owned = false;
23018         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
23019         return ret_conv;
23020 }
23021
23022 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
23023         LDKUntrustedString orig_conv;
23024         orig_conv.inner = untag_ptr(orig);
23025         orig_conv.is_owned = ptr_is_owned(orig);
23026         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23027         orig_conv.is_owned = false;
23028         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
23029         uint64_t ret_ref = 0;
23030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23032         return ret_ref;
23033 }
23034
23035 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
23036         LDKUntrustedString a_conv;
23037         a_conv.inner = untag_ptr(a);
23038         a_conv.is_owned = ptr_is_owned(a);
23039         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23040         a_conv.is_owned = false;
23041         LDKUntrustedString b_conv;
23042         b_conv.inner = untag_ptr(b);
23043         b_conv.is_owned = ptr_is_owned(b);
23044         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23045         b_conv.is_owned = false;
23046         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
23047         return ret_conv;
23048 }
23049
23050 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
23051         LDKUntrustedString obj_conv;
23052         obj_conv.inner = untag_ptr(obj);
23053         obj_conv.is_owned = ptr_is_owned(obj);
23054         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23055         obj_conv.is_owned = false;
23056         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
23057         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23058         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23059         CVec_u8Z_free(ret_var);
23060         return ret_arr;
23061 }
23062
23063 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
23064         LDKu8slice ser_ref;
23065         ser_ref.datalen = ser->arr_len;
23066         ser_ref.data = ser->elems;
23067         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
23068         *ret_conv = UntrustedString_read(ser_ref);
23069         FREE(ser);
23070         return tag_ptr(ret_conv, true);
23071 }
23072
23073 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
23074         LDKPrintableString this_obj_conv;
23075         this_obj_conv.inner = untag_ptr(this_obj);
23076         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23078         PrintableString_free(this_obj_conv);
23079 }
23080
23081 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
23082         LDKPrintableString this_ptr_conv;
23083         this_ptr_conv.inner = untag_ptr(this_ptr);
23084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23086         this_ptr_conv.is_owned = false;
23087         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
23088         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23089         Str_free(ret_str);
23090         return ret_conv;
23091 }
23092
23093 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
23094         LDKPrintableString this_ptr_conv;
23095         this_ptr_conv.inner = untag_ptr(this_ptr);
23096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23098         this_ptr_conv.is_owned = false;
23099         LDKStr val_conv = str_ref_to_owned_c(val);
23100         PrintableString_set_a(&this_ptr_conv, val_conv);
23101 }
23102
23103 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
23104         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
23105         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
23106         uint64_t ret_ref = 0;
23107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23109         return ret_ref;
23110 }
23111
23112 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
23113         if (!ptr_is_owned(this_ptr)) return;
23114         void* this_ptr_ptr = untag_ptr(this_ptr);
23115         CHECK_ACCESS(this_ptr_ptr);
23116         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
23117         FREE(untag_ptr(this_ptr));
23118         FutureCallback_free(this_ptr_conv);
23119 }
23120
23121 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
23122         LDKFuture this_obj_conv;
23123         this_obj_conv.inner = untag_ptr(this_obj);
23124         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23126         Future_free(this_obj_conv);
23127 }
23128
23129 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
23130         LDKFuture ret_var = Future_clone(arg);
23131         uint64_t ret_ref = 0;
23132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23134         return ret_ref;
23135 }
23136 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
23137         LDKFuture arg_conv;
23138         arg_conv.inner = untag_ptr(arg);
23139         arg_conv.is_owned = ptr_is_owned(arg);
23140         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23141         arg_conv.is_owned = false;
23142         int64_t ret_conv = Future_clone_ptr(&arg_conv);
23143         return ret_conv;
23144 }
23145
23146 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
23147         LDKFuture orig_conv;
23148         orig_conv.inner = untag_ptr(orig);
23149         orig_conv.is_owned = ptr_is_owned(orig);
23150         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23151         orig_conv.is_owned = false;
23152         LDKFuture ret_var = Future_clone(&orig_conv);
23153         uint64_t ret_ref = 0;
23154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23156         return ret_ref;
23157 }
23158
23159 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
23160         LDKFuture this_arg_conv;
23161         this_arg_conv.inner = untag_ptr(this_arg);
23162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23164         this_arg_conv.is_owned = false;
23165         void* callback_ptr = untag_ptr(callback);
23166         CHECK_ACCESS(callback_ptr);
23167         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
23168         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
23169                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23170                 LDKFutureCallback_JCalls_cloned(&callback_conv);
23171         }
23172         Future_register_callback_fn(&this_arg_conv, callback_conv);
23173 }
23174
23175 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
23176         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
23177         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
23178         return ret_conv;
23179 }
23180
23181 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
23182         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
23183         return ret_conv;
23184 }
23185
23186 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
23187         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
23188         return ret_conv;
23189 }
23190
23191 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
23192         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
23193         return ret_conv;
23194 }
23195
23196 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
23197         uint32_t ret_conv = LDKLevel_to_js(Level_info());
23198         return ret_conv;
23199 }
23200
23201 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
23202         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
23203         return ret_conv;
23204 }
23205
23206 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
23207         uint32_t ret_conv = LDKLevel_to_js(Level_error());
23208         return ret_conv;
23209 }
23210
23211 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
23212         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
23213         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
23214         jboolean ret_conv = Level_eq(a_conv, b_conv);
23215         return ret_conv;
23216 }
23217
23218 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
23219         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
23220         int64_t ret_conv = Level_hash(o_conv);
23221         return ret_conv;
23222 }
23223
23224 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
23225         uint32_t ret_conv = LDKLevel_to_js(Level_max());
23226         return ret_conv;
23227 }
23228
23229 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
23230         LDKRecord this_obj_conv;
23231         this_obj_conv.inner = untag_ptr(this_obj);
23232         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23234         Record_free(this_obj_conv);
23235 }
23236
23237 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
23238         LDKRecord this_ptr_conv;
23239         this_ptr_conv.inner = untag_ptr(this_ptr);
23240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23242         this_ptr_conv.is_owned = false;
23243         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
23244         return ret_conv;
23245 }
23246
23247 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
23248         LDKRecord this_ptr_conv;
23249         this_ptr_conv.inner = untag_ptr(this_ptr);
23250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23252         this_ptr_conv.is_owned = false;
23253         LDKLevel val_conv = LDKLevel_from_js(val);
23254         Record_set_level(&this_ptr_conv, val_conv);
23255 }
23256
23257 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
23258         LDKRecord this_ptr_conv;
23259         this_ptr_conv.inner = untag_ptr(this_ptr);
23260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23262         this_ptr_conv.is_owned = false;
23263         LDKStr ret_str = Record_get_args(&this_ptr_conv);
23264         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23265         Str_free(ret_str);
23266         return ret_conv;
23267 }
23268
23269 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
23270         LDKRecord this_ptr_conv;
23271         this_ptr_conv.inner = untag_ptr(this_ptr);
23272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23274         this_ptr_conv.is_owned = false;
23275         LDKStr val_conv = str_ref_to_owned_c(val);
23276         Record_set_args(&this_ptr_conv, val_conv);
23277 }
23278
23279 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
23280         LDKRecord this_ptr_conv;
23281         this_ptr_conv.inner = untag_ptr(this_ptr);
23282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23284         this_ptr_conv.is_owned = false;
23285         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23286         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23287         Str_free(ret_str);
23288         return ret_conv;
23289 }
23290
23291 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
23292         LDKRecord this_ptr_conv;
23293         this_ptr_conv.inner = untag_ptr(this_ptr);
23294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23296         this_ptr_conv.is_owned = false;
23297         LDKStr val_conv = str_ref_to_owned_c(val);
23298         Record_set_module_path(&this_ptr_conv, val_conv);
23299 }
23300
23301 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
23302         LDKRecord this_ptr_conv;
23303         this_ptr_conv.inner = untag_ptr(this_ptr);
23304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23306         this_ptr_conv.is_owned = false;
23307         LDKStr ret_str = Record_get_file(&this_ptr_conv);
23308         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23309         Str_free(ret_str);
23310         return ret_conv;
23311 }
23312
23313 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
23314         LDKRecord this_ptr_conv;
23315         this_ptr_conv.inner = untag_ptr(this_ptr);
23316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23318         this_ptr_conv.is_owned = false;
23319         LDKStr val_conv = str_ref_to_owned_c(val);
23320         Record_set_file(&this_ptr_conv, val_conv);
23321 }
23322
23323 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
23324         LDKRecord this_ptr_conv;
23325         this_ptr_conv.inner = untag_ptr(this_ptr);
23326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23328         this_ptr_conv.is_owned = false;
23329         int32_t ret_conv = Record_get_line(&this_ptr_conv);
23330         return ret_conv;
23331 }
23332
23333 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
23334         LDKRecord this_ptr_conv;
23335         this_ptr_conv.inner = untag_ptr(this_ptr);
23336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23338         this_ptr_conv.is_owned = false;
23339         Record_set_line(&this_ptr_conv, val);
23340 }
23341
23342 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23343         LDKRecord ret_var = Record_clone(arg);
23344         uint64_t ret_ref = 0;
23345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23347         return ret_ref;
23348 }
23349 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
23350         LDKRecord arg_conv;
23351         arg_conv.inner = untag_ptr(arg);
23352         arg_conv.is_owned = ptr_is_owned(arg);
23353         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23354         arg_conv.is_owned = false;
23355         int64_t ret_conv = Record_clone_ptr(&arg_conv);
23356         return ret_conv;
23357 }
23358
23359 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
23360         LDKRecord orig_conv;
23361         orig_conv.inner = untag_ptr(orig);
23362         orig_conv.is_owned = ptr_is_owned(orig);
23363         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23364         orig_conv.is_owned = false;
23365         LDKRecord ret_var = Record_clone(&orig_conv);
23366         uint64_t ret_ref = 0;
23367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23369         return ret_ref;
23370 }
23371
23372 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
23373         if (!ptr_is_owned(this_ptr)) return;
23374         void* this_ptr_ptr = untag_ptr(this_ptr);
23375         CHECK_ACCESS(this_ptr_ptr);
23376         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23377         FREE(untag_ptr(this_ptr));
23378         Logger_free(this_ptr_conv);
23379 }
23380
23381 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
23382         LDKChannelHandshakeConfig this_obj_conv;
23383         this_obj_conv.inner = untag_ptr(this_obj);
23384         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23386         ChannelHandshakeConfig_free(this_obj_conv);
23387 }
23388
23389 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
23390         LDKChannelHandshakeConfig this_ptr_conv;
23391         this_ptr_conv.inner = untag_ptr(this_ptr);
23392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23394         this_ptr_conv.is_owned = false;
23395         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23396         return ret_conv;
23397 }
23398
23399 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
23400         LDKChannelHandshakeConfig this_ptr_conv;
23401         this_ptr_conv.inner = untag_ptr(this_ptr);
23402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23404         this_ptr_conv.is_owned = false;
23405         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23406 }
23407
23408 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
23409         LDKChannelHandshakeConfig this_ptr_conv;
23410         this_ptr_conv.inner = untag_ptr(this_ptr);
23411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23413         this_ptr_conv.is_owned = false;
23414         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23415         return ret_conv;
23416 }
23417
23418 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) {
23419         LDKChannelHandshakeConfig this_ptr_conv;
23420         this_ptr_conv.inner = untag_ptr(this_ptr);
23421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23423         this_ptr_conv.is_owned = false;
23424         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23425 }
23426
23427 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
23428         LDKChannelHandshakeConfig this_ptr_conv;
23429         this_ptr_conv.inner = untag_ptr(this_ptr);
23430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23432         this_ptr_conv.is_owned = false;
23433         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23434         return ret_conv;
23435 }
23436
23437 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) {
23438         LDKChannelHandshakeConfig this_ptr_conv;
23439         this_ptr_conv.inner = untag_ptr(this_ptr);
23440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23442         this_ptr_conv.is_owned = false;
23443         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23444 }
23445
23446 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) {
23447         LDKChannelHandshakeConfig this_ptr_conv;
23448         this_ptr_conv.inner = untag_ptr(this_ptr);
23449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23451         this_ptr_conv.is_owned = false;
23452         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
23453         return ret_conv;
23454 }
23455
23456 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) {
23457         LDKChannelHandshakeConfig this_ptr_conv;
23458         this_ptr_conv.inner = untag_ptr(this_ptr);
23459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23461         this_ptr_conv.is_owned = false;
23462         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
23463 }
23464
23465 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
23466         LDKChannelHandshakeConfig this_ptr_conv;
23467         this_ptr_conv.inner = untag_ptr(this_ptr);
23468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23470         this_ptr_conv.is_owned = false;
23471         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
23472         return ret_conv;
23473 }
23474
23475 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
23476         LDKChannelHandshakeConfig this_ptr_conv;
23477         this_ptr_conv.inner = untag_ptr(this_ptr);
23478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23480         this_ptr_conv.is_owned = false;
23481         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
23482 }
23483
23484 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
23485         LDKChannelHandshakeConfig this_ptr_conv;
23486         this_ptr_conv.inner = untag_ptr(this_ptr);
23487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23489         this_ptr_conv.is_owned = false;
23490         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
23491         return ret_conv;
23492 }
23493
23494 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
23495         LDKChannelHandshakeConfig this_ptr_conv;
23496         this_ptr_conv.inner = untag_ptr(this_ptr);
23497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23499         this_ptr_conv.is_owned = false;
23500         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
23501 }
23502
23503 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
23504         LDKChannelHandshakeConfig this_ptr_conv;
23505         this_ptr_conv.inner = untag_ptr(this_ptr);
23506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23508         this_ptr_conv.is_owned = false;
23509         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
23510         return ret_conv;
23511 }
23512
23513 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
23514         LDKChannelHandshakeConfig this_ptr_conv;
23515         this_ptr_conv.inner = untag_ptr(this_ptr);
23516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23518         this_ptr_conv.is_owned = false;
23519         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
23520 }
23521
23522 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) {
23523         LDKChannelHandshakeConfig this_ptr_conv;
23524         this_ptr_conv.inner = untag_ptr(this_ptr);
23525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23527         this_ptr_conv.is_owned = false;
23528         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
23529         return ret_conv;
23530 }
23531
23532 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) {
23533         LDKChannelHandshakeConfig this_ptr_conv;
23534         this_ptr_conv.inner = untag_ptr(this_ptr);
23535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23537         this_ptr_conv.is_owned = false;
23538         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
23539 }
23540
23541 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
23542         LDKChannelHandshakeConfig this_ptr_conv;
23543         this_ptr_conv.inner = untag_ptr(this_ptr);
23544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23546         this_ptr_conv.is_owned = false;
23547         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
23548         return ret_conv;
23549 }
23550
23551 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) {
23552         LDKChannelHandshakeConfig this_ptr_conv;
23553         this_ptr_conv.inner = untag_ptr(this_ptr);
23554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23556         this_ptr_conv.is_owned = false;
23557         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
23558 }
23559
23560 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) {
23561         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);
23562         uint64_t ret_ref = 0;
23563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23565         return ret_ref;
23566 }
23567
23568 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23569         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23570         uint64_t ret_ref = 0;
23571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23573         return ret_ref;
23574 }
23575 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
23576         LDKChannelHandshakeConfig arg_conv;
23577         arg_conv.inner = untag_ptr(arg);
23578         arg_conv.is_owned = ptr_is_owned(arg);
23579         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23580         arg_conv.is_owned = false;
23581         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23582         return ret_conv;
23583 }
23584
23585 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
23586         LDKChannelHandshakeConfig orig_conv;
23587         orig_conv.inner = untag_ptr(orig);
23588         orig_conv.is_owned = ptr_is_owned(orig);
23589         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23590         orig_conv.is_owned = false;
23591         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23592         uint64_t ret_ref = 0;
23593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23595         return ret_ref;
23596 }
23597
23598 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
23599         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23600         uint64_t ret_ref = 0;
23601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23603         return ret_ref;
23604 }
23605
23606 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
23607         LDKChannelHandshakeLimits this_obj_conv;
23608         this_obj_conv.inner = untag_ptr(this_obj);
23609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23611         ChannelHandshakeLimits_free(this_obj_conv);
23612 }
23613
23614 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
23615         LDKChannelHandshakeLimits this_ptr_conv;
23616         this_ptr_conv.inner = untag_ptr(this_ptr);
23617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23619         this_ptr_conv.is_owned = false;
23620         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23621         return ret_conv;
23622 }
23623
23624 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
23625         LDKChannelHandshakeLimits this_ptr_conv;
23626         this_ptr_conv.inner = untag_ptr(this_ptr);
23627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23629         this_ptr_conv.is_owned = false;
23630         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23631 }
23632
23633 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
23634         LDKChannelHandshakeLimits this_ptr_conv;
23635         this_ptr_conv.inner = untag_ptr(this_ptr);
23636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23638         this_ptr_conv.is_owned = false;
23639         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
23640         return ret_conv;
23641 }
23642
23643 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
23644         LDKChannelHandshakeLimits this_ptr_conv;
23645         this_ptr_conv.inner = untag_ptr(this_ptr);
23646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23648         this_ptr_conv.is_owned = false;
23649         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
23650 }
23651
23652 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
23653         LDKChannelHandshakeLimits this_ptr_conv;
23654         this_ptr_conv.inner = untag_ptr(this_ptr);
23655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23657         this_ptr_conv.is_owned = false;
23658         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23659         return ret_conv;
23660 }
23661
23662 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) {
23663         LDKChannelHandshakeLimits this_ptr_conv;
23664         this_ptr_conv.inner = untag_ptr(this_ptr);
23665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23667         this_ptr_conv.is_owned = false;
23668         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23669 }
23670
23671 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) {
23672         LDKChannelHandshakeLimits this_ptr_conv;
23673         this_ptr_conv.inner = untag_ptr(this_ptr);
23674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23676         this_ptr_conv.is_owned = false;
23677         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23678         return ret_conv;
23679 }
23680
23681 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) {
23682         LDKChannelHandshakeLimits this_ptr_conv;
23683         this_ptr_conv.inner = untag_ptr(this_ptr);
23684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23686         this_ptr_conv.is_owned = false;
23687         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23688 }
23689
23690 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
23691         LDKChannelHandshakeLimits this_ptr_conv;
23692         this_ptr_conv.inner = untag_ptr(this_ptr);
23693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23695         this_ptr_conv.is_owned = false;
23696         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
23697         return ret_conv;
23698 }
23699
23700 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) {
23701         LDKChannelHandshakeLimits this_ptr_conv;
23702         this_ptr_conv.inner = untag_ptr(this_ptr);
23703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23705         this_ptr_conv.is_owned = false;
23706         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
23707 }
23708
23709 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
23710         LDKChannelHandshakeLimits this_ptr_conv;
23711         this_ptr_conv.inner = untag_ptr(this_ptr);
23712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23714         this_ptr_conv.is_owned = false;
23715         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
23716         return ret_conv;
23717 }
23718
23719 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) {
23720         LDKChannelHandshakeLimits this_ptr_conv;
23721         this_ptr_conv.inner = untag_ptr(this_ptr);
23722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23724         this_ptr_conv.is_owned = false;
23725         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
23726 }
23727
23728 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
23729         LDKChannelHandshakeLimits this_ptr_conv;
23730         this_ptr_conv.inner = untag_ptr(this_ptr);
23731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23733         this_ptr_conv.is_owned = false;
23734         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
23735         return ret_conv;
23736 }
23737
23738 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
23739         LDKChannelHandshakeLimits this_ptr_conv;
23740         this_ptr_conv.inner = untag_ptr(this_ptr);
23741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23743         this_ptr_conv.is_owned = false;
23744         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
23745 }
23746
23747 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
23748         LDKChannelHandshakeLimits this_ptr_conv;
23749         this_ptr_conv.inner = untag_ptr(this_ptr);
23750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23752         this_ptr_conv.is_owned = false;
23753         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
23754         return ret_conv;
23755 }
23756
23757 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
23758         LDKChannelHandshakeLimits this_ptr_conv;
23759         this_ptr_conv.inner = untag_ptr(this_ptr);
23760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23762         this_ptr_conv.is_owned = false;
23763         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
23764 }
23765
23766 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
23767         LDKChannelHandshakeLimits this_ptr_conv;
23768         this_ptr_conv.inner = untag_ptr(this_ptr);
23769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23771         this_ptr_conv.is_owned = false;
23772         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
23773         return ret_conv;
23774 }
23775
23776 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
23777         LDKChannelHandshakeLimits this_ptr_conv;
23778         this_ptr_conv.inner = untag_ptr(this_ptr);
23779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23781         this_ptr_conv.is_owned = false;
23782         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
23783 }
23784
23785 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
23786         LDKChannelHandshakeLimits this_ptr_conv;
23787         this_ptr_conv.inner = untag_ptr(this_ptr);
23788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23790         this_ptr_conv.is_owned = false;
23791         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
23792         return ret_conv;
23793 }
23794
23795 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) {
23796         LDKChannelHandshakeLimits this_ptr_conv;
23797         this_ptr_conv.inner = untag_ptr(this_ptr);
23798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23800         this_ptr_conv.is_owned = false;
23801         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
23802 }
23803
23804 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) {
23805         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);
23806         uint64_t ret_ref = 0;
23807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23809         return ret_ref;
23810 }
23811
23812 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
23813         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
23814         uint64_t ret_ref = 0;
23815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23817         return ret_ref;
23818 }
23819 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
23820         LDKChannelHandshakeLimits arg_conv;
23821         arg_conv.inner = untag_ptr(arg);
23822         arg_conv.is_owned = ptr_is_owned(arg);
23823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23824         arg_conv.is_owned = false;
23825         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
23826         return ret_conv;
23827 }
23828
23829 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
23830         LDKChannelHandshakeLimits orig_conv;
23831         orig_conv.inner = untag_ptr(orig);
23832         orig_conv.is_owned = ptr_is_owned(orig);
23833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23834         orig_conv.is_owned = false;
23835         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
23836         uint64_t ret_ref = 0;
23837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23839         return ret_ref;
23840 }
23841
23842 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
23843         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
23844         uint64_t ret_ref = 0;
23845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23847         return ret_ref;
23848 }
23849
23850 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
23851         LDKChannelConfig this_obj_conv;
23852         this_obj_conv.inner = untag_ptr(this_obj);
23853         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23855         ChannelConfig_free(this_obj_conv);
23856 }
23857
23858 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
23859         LDKChannelConfig this_ptr_conv;
23860         this_ptr_conv.inner = untag_ptr(this_ptr);
23861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23863         this_ptr_conv.is_owned = false;
23864         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
23865         return ret_conv;
23866 }
23867
23868 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) {
23869         LDKChannelConfig this_ptr_conv;
23870         this_ptr_conv.inner = untag_ptr(this_ptr);
23871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23873         this_ptr_conv.is_owned = false;
23874         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
23875 }
23876
23877 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
23878         LDKChannelConfig this_ptr_conv;
23879         this_ptr_conv.inner = untag_ptr(this_ptr);
23880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23882         this_ptr_conv.is_owned = false;
23883         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
23884         return ret_conv;
23885 }
23886
23887 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) {
23888         LDKChannelConfig this_ptr_conv;
23889         this_ptr_conv.inner = untag_ptr(this_ptr);
23890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23892         this_ptr_conv.is_owned = false;
23893         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
23894 }
23895
23896 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
23897         LDKChannelConfig this_ptr_conv;
23898         this_ptr_conv.inner = untag_ptr(this_ptr);
23899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23901         this_ptr_conv.is_owned = false;
23902         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
23903         return ret_conv;
23904 }
23905
23906 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
23907         LDKChannelConfig this_ptr_conv;
23908         this_ptr_conv.inner = untag_ptr(this_ptr);
23909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23911         this_ptr_conv.is_owned = false;
23912         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
23913 }
23914
23915 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) {
23916         LDKChannelConfig this_ptr_conv;
23917         this_ptr_conv.inner = untag_ptr(this_ptr);
23918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23920         this_ptr_conv.is_owned = false;
23921         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
23922         return ret_conv;
23923 }
23924
23925 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) {
23926         LDKChannelConfig this_ptr_conv;
23927         this_ptr_conv.inner = untag_ptr(this_ptr);
23928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23930         this_ptr_conv.is_owned = false;
23931         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
23932 }
23933
23934 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) {
23935         LDKChannelConfig this_ptr_conv;
23936         this_ptr_conv.inner = untag_ptr(this_ptr);
23937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23939         this_ptr_conv.is_owned = false;
23940         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
23941         return ret_conv;
23942 }
23943
23944 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) {
23945         LDKChannelConfig this_ptr_conv;
23946         this_ptr_conv.inner = untag_ptr(this_ptr);
23947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23949         this_ptr_conv.is_owned = false;
23950         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
23951 }
23952
23953 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) {
23954         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);
23955         uint64_t ret_ref = 0;
23956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23958         return ret_ref;
23959 }
23960
23961 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
23962         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
23963         uint64_t ret_ref = 0;
23964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23966         return ret_ref;
23967 }
23968 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
23969         LDKChannelConfig arg_conv;
23970         arg_conv.inner = untag_ptr(arg);
23971         arg_conv.is_owned = ptr_is_owned(arg);
23972         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23973         arg_conv.is_owned = false;
23974         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
23975         return ret_conv;
23976 }
23977
23978 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
23979         LDKChannelConfig orig_conv;
23980         orig_conv.inner = untag_ptr(orig);
23981         orig_conv.is_owned = ptr_is_owned(orig);
23982         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23983         orig_conv.is_owned = false;
23984         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
23985         uint64_t ret_ref = 0;
23986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23988         return ret_ref;
23989 }
23990
23991 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
23992         LDKChannelConfig a_conv;
23993         a_conv.inner = untag_ptr(a);
23994         a_conv.is_owned = ptr_is_owned(a);
23995         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23996         a_conv.is_owned = false;
23997         LDKChannelConfig b_conv;
23998         b_conv.inner = untag_ptr(b);
23999         b_conv.is_owned = ptr_is_owned(b);
24000         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24001         b_conv.is_owned = false;
24002         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
24003         return ret_conv;
24004 }
24005
24006 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
24007         LDKChannelConfig ret_var = ChannelConfig_default();
24008         uint64_t ret_ref = 0;
24009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24011         return ret_ref;
24012 }
24013
24014 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
24015         LDKChannelConfig obj_conv;
24016         obj_conv.inner = untag_ptr(obj);
24017         obj_conv.is_owned = ptr_is_owned(obj);
24018         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24019         obj_conv.is_owned = false;
24020         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24021         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24022         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24023         CVec_u8Z_free(ret_var);
24024         return ret_arr;
24025 }
24026
24027 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
24028         LDKu8slice ser_ref;
24029         ser_ref.datalen = ser->arr_len;
24030         ser_ref.data = ser->elems;
24031         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24032         *ret_conv = ChannelConfig_read(ser_ref);
24033         FREE(ser);
24034         return tag_ptr(ret_conv, true);
24035 }
24036
24037 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
24038         LDKUserConfig this_obj_conv;
24039         this_obj_conv.inner = untag_ptr(this_obj);
24040         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24042         UserConfig_free(this_obj_conv);
24043 }
24044
24045 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
24046         LDKUserConfig this_ptr_conv;
24047         this_ptr_conv.inner = untag_ptr(this_ptr);
24048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24050         this_ptr_conv.is_owned = false;
24051         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
24052         uint64_t ret_ref = 0;
24053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24055         return ret_ref;
24056 }
24057
24058 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
24059         LDKUserConfig this_ptr_conv;
24060         this_ptr_conv.inner = untag_ptr(this_ptr);
24061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24063         this_ptr_conv.is_owned = false;
24064         LDKChannelHandshakeConfig val_conv;
24065         val_conv.inner = untag_ptr(val);
24066         val_conv.is_owned = ptr_is_owned(val);
24067         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24068         val_conv = ChannelHandshakeConfig_clone(&val_conv);
24069         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
24070 }
24071
24072 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
24073         LDKUserConfig this_ptr_conv;
24074         this_ptr_conv.inner = untag_ptr(this_ptr);
24075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24077         this_ptr_conv.is_owned = false;
24078         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
24079         uint64_t ret_ref = 0;
24080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24082         return ret_ref;
24083 }
24084
24085 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
24086         LDKUserConfig this_ptr_conv;
24087         this_ptr_conv.inner = untag_ptr(this_ptr);
24088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24090         this_ptr_conv.is_owned = false;
24091         LDKChannelHandshakeLimits val_conv;
24092         val_conv.inner = untag_ptr(val);
24093         val_conv.is_owned = ptr_is_owned(val);
24094         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24095         val_conv = ChannelHandshakeLimits_clone(&val_conv);
24096         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
24097 }
24098
24099 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
24100         LDKUserConfig this_ptr_conv;
24101         this_ptr_conv.inner = untag_ptr(this_ptr);
24102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24104         this_ptr_conv.is_owned = false;
24105         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
24106         uint64_t ret_ref = 0;
24107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24109         return ret_ref;
24110 }
24111
24112 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
24113         LDKUserConfig this_ptr_conv;
24114         this_ptr_conv.inner = untag_ptr(this_ptr);
24115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24117         this_ptr_conv.is_owned = false;
24118         LDKChannelConfig val_conv;
24119         val_conv.inner = untag_ptr(val);
24120         val_conv.is_owned = ptr_is_owned(val);
24121         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24122         val_conv = ChannelConfig_clone(&val_conv);
24123         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
24124 }
24125
24126 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
24127         LDKUserConfig this_ptr_conv;
24128         this_ptr_conv.inner = untag_ptr(this_ptr);
24129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24131         this_ptr_conv.is_owned = false;
24132         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24133         return ret_conv;
24134 }
24135
24136 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) {
24137         LDKUserConfig this_ptr_conv;
24138         this_ptr_conv.inner = untag_ptr(this_ptr);
24139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24141         this_ptr_conv.is_owned = false;
24142         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24143 }
24144
24145 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
24146         LDKUserConfig this_ptr_conv;
24147         this_ptr_conv.inner = untag_ptr(this_ptr);
24148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24150         this_ptr_conv.is_owned = false;
24151         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24152         return ret_conv;
24153 }
24154
24155 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24156         LDKUserConfig this_ptr_conv;
24157         this_ptr_conv.inner = untag_ptr(this_ptr);
24158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24160         this_ptr_conv.is_owned = false;
24161         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24162 }
24163
24164 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
24165         LDKUserConfig this_ptr_conv;
24166         this_ptr_conv.inner = untag_ptr(this_ptr);
24167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24169         this_ptr_conv.is_owned = false;
24170         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24171         return ret_conv;
24172 }
24173
24174 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24175         LDKUserConfig this_ptr_conv;
24176         this_ptr_conv.inner = untag_ptr(this_ptr);
24177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24179         this_ptr_conv.is_owned = false;
24180         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24181 }
24182
24183 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
24184         LDKUserConfig this_ptr_conv;
24185         this_ptr_conv.inner = untag_ptr(this_ptr);
24186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24188         this_ptr_conv.is_owned = false;
24189         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
24190         return ret_conv;
24191 }
24192
24193 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
24194         LDKUserConfig this_ptr_conv;
24195         this_ptr_conv.inner = untag_ptr(this_ptr);
24196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24198         this_ptr_conv.is_owned = false;
24199         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
24200 }
24201
24202 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) {
24203         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
24204         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
24205         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
24206         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
24207         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
24208         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
24209         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
24210         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
24211         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
24212         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
24213         LDKChannelConfig channel_config_arg_conv;
24214         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
24215         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
24216         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
24217         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
24218         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);
24219         uint64_t ret_ref = 0;
24220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24222         return ret_ref;
24223 }
24224
24225 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24226         LDKUserConfig ret_var = UserConfig_clone(arg);
24227         uint64_t ret_ref = 0;
24228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24230         return ret_ref;
24231 }
24232 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
24233         LDKUserConfig arg_conv;
24234         arg_conv.inner = untag_ptr(arg);
24235         arg_conv.is_owned = ptr_is_owned(arg);
24236         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24237         arg_conv.is_owned = false;
24238         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
24239         return ret_conv;
24240 }
24241
24242 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
24243         LDKUserConfig orig_conv;
24244         orig_conv.inner = untag_ptr(orig);
24245         orig_conv.is_owned = ptr_is_owned(orig);
24246         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24247         orig_conv.is_owned = false;
24248         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24249         uint64_t ret_ref = 0;
24250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24252         return ret_ref;
24253 }
24254
24255 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
24256         LDKUserConfig ret_var = UserConfig_default();
24257         uint64_t ret_ref = 0;
24258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24260         return ret_ref;
24261 }
24262
24263 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
24264         LDKBestBlock this_obj_conv;
24265         this_obj_conv.inner = untag_ptr(this_obj);
24266         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24268         BestBlock_free(this_obj_conv);
24269 }
24270
24271 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24272         LDKBestBlock ret_var = BestBlock_clone(arg);
24273         uint64_t ret_ref = 0;
24274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24276         return ret_ref;
24277 }
24278 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
24279         LDKBestBlock arg_conv;
24280         arg_conv.inner = untag_ptr(arg);
24281         arg_conv.is_owned = ptr_is_owned(arg);
24282         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24283         arg_conv.is_owned = false;
24284         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
24285         return ret_conv;
24286 }
24287
24288 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
24289         LDKBestBlock orig_conv;
24290         orig_conv.inner = untag_ptr(orig);
24291         orig_conv.is_owned = ptr_is_owned(orig);
24292         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24293         orig_conv.is_owned = false;
24294         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24295         uint64_t ret_ref = 0;
24296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24298         return ret_ref;
24299 }
24300
24301 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
24302         LDKBestBlock a_conv;
24303         a_conv.inner = untag_ptr(a);
24304         a_conv.is_owned = ptr_is_owned(a);
24305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24306         a_conv.is_owned = false;
24307         LDKBestBlock b_conv;
24308         b_conv.inner = untag_ptr(b);
24309         b_conv.is_owned = ptr_is_owned(b);
24310         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24311         b_conv.is_owned = false;
24312         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
24313         return ret_conv;
24314 }
24315
24316 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
24317         LDKNetwork network_conv = LDKNetwork_from_js(network);
24318         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
24319         uint64_t ret_ref = 0;
24320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24322         return ret_ref;
24323 }
24324
24325 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
24326         LDKThirtyTwoBytes block_hash_ref;
24327         CHECK(block_hash->arr_len == 32);
24328         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
24329         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24330         uint64_t ret_ref = 0;
24331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24333         return ret_ref;
24334 }
24335
24336 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
24337         LDKBestBlock this_arg_conv;
24338         this_arg_conv.inner = untag_ptr(this_arg);
24339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24341         this_arg_conv.is_owned = false;
24342         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24343         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
24344         return ret_arr;
24345 }
24346
24347 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
24348         LDKBestBlock this_arg_conv;
24349         this_arg_conv.inner = untag_ptr(this_arg);
24350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24352         this_arg_conv.is_owned = false;
24353         int32_t ret_conv = BestBlock_height(&this_arg_conv);
24354         return ret_conv;
24355 }
24356
24357 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
24358         if (!ptr_is_owned(this_ptr)) return;
24359         void* this_ptr_ptr = untag_ptr(this_ptr);
24360         CHECK_ACCESS(this_ptr_ptr);
24361         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24362         FREE(untag_ptr(this_ptr));
24363         Listen_free(this_ptr_conv);
24364 }
24365
24366 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
24367         if (!ptr_is_owned(this_ptr)) return;
24368         void* this_ptr_ptr = untag_ptr(this_ptr);
24369         CHECK_ACCESS(this_ptr_ptr);
24370         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24371         FREE(untag_ptr(this_ptr));
24372         Confirm_free(this_ptr_conv);
24373 }
24374
24375 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
24376         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
24377         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
24378         return ret_conv;
24379 }
24380
24381 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
24382         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
24383         return ret_conv;
24384 }
24385
24386 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
24387         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
24388         return ret_conv;
24389 }
24390
24391 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
24392         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
24393         return ret_conv;
24394 }
24395
24396 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
24397         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
24398         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
24399         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
24400         return ret_conv;
24401 }
24402
24403 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
24404         if (!ptr_is_owned(this_ptr)) return;
24405         void* this_ptr_ptr = untag_ptr(this_ptr);
24406         CHECK_ACCESS(this_ptr_ptr);
24407         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24408         FREE(untag_ptr(this_ptr));
24409         Watch_free(this_ptr_conv);
24410 }
24411
24412 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
24413         if (!ptr_is_owned(this_ptr)) return;
24414         void* this_ptr_ptr = untag_ptr(this_ptr);
24415         CHECK_ACCESS(this_ptr_ptr);
24416         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24417         FREE(untag_ptr(this_ptr));
24418         Filter_free(this_ptr_conv);
24419 }
24420
24421 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
24422         LDKWatchedOutput this_obj_conv;
24423         this_obj_conv.inner = untag_ptr(this_obj);
24424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24426         WatchedOutput_free(this_obj_conv);
24427 }
24428
24429 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
24430         LDKWatchedOutput this_ptr_conv;
24431         this_ptr_conv.inner = untag_ptr(this_ptr);
24432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24434         this_ptr_conv.is_owned = false;
24435         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24436         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
24437         return ret_arr;
24438 }
24439
24440 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
24441         LDKWatchedOutput this_ptr_conv;
24442         this_ptr_conv.inner = untag_ptr(this_ptr);
24443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24445         this_ptr_conv.is_owned = false;
24446         LDKThirtyTwoBytes val_ref;
24447         CHECK(val->arr_len == 32);
24448         memcpy(val_ref.data, val->elems, 32); FREE(val);
24449         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24450 }
24451
24452 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
24453         LDKWatchedOutput this_ptr_conv;
24454         this_ptr_conv.inner = untag_ptr(this_ptr);
24455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24457         this_ptr_conv.is_owned = false;
24458         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24459         uint64_t ret_ref = 0;
24460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24462         return ret_ref;
24463 }
24464
24465 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
24466         LDKWatchedOutput this_ptr_conv;
24467         this_ptr_conv.inner = untag_ptr(this_ptr);
24468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24470         this_ptr_conv.is_owned = false;
24471         LDKOutPoint val_conv;
24472         val_conv.inner = untag_ptr(val);
24473         val_conv.is_owned = ptr_is_owned(val);
24474         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24475         val_conv = OutPoint_clone(&val_conv);
24476         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24477 }
24478
24479 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
24480         LDKWatchedOutput this_ptr_conv;
24481         this_ptr_conv.inner = untag_ptr(this_ptr);
24482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24484         this_ptr_conv.is_owned = false;
24485         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24486         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24487         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24488         return ret_arr;
24489 }
24490
24491 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
24492         LDKWatchedOutput this_ptr_conv;
24493         this_ptr_conv.inner = untag_ptr(this_ptr);
24494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24496         this_ptr_conv.is_owned = false;
24497         LDKCVec_u8Z val_ref;
24498         val_ref.datalen = val->arr_len;
24499         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24500         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
24501         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24502 }
24503
24504 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) {
24505         LDKThirtyTwoBytes block_hash_arg_ref;
24506         CHECK(block_hash_arg->arr_len == 32);
24507         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
24508         LDKOutPoint outpoint_arg_conv;
24509         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24510         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24511         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24512         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24513         LDKCVec_u8Z script_pubkey_arg_ref;
24514         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
24515         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24516         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
24517         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24518         uint64_t ret_ref = 0;
24519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24521         return ret_ref;
24522 }
24523
24524 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24525         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
24526         uint64_t ret_ref = 0;
24527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24529         return ret_ref;
24530 }
24531 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
24532         LDKWatchedOutput arg_conv;
24533         arg_conv.inner = untag_ptr(arg);
24534         arg_conv.is_owned = ptr_is_owned(arg);
24535         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24536         arg_conv.is_owned = false;
24537         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
24538         return ret_conv;
24539 }
24540
24541 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
24542         LDKWatchedOutput orig_conv;
24543         orig_conv.inner = untag_ptr(orig);
24544         orig_conv.is_owned = ptr_is_owned(orig);
24545         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24546         orig_conv.is_owned = false;
24547         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24548         uint64_t ret_ref = 0;
24549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24551         return ret_ref;
24552 }
24553
24554 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
24555         LDKWatchedOutput a_conv;
24556         a_conv.inner = untag_ptr(a);
24557         a_conv.is_owned = ptr_is_owned(a);
24558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24559         a_conv.is_owned = false;
24560         LDKWatchedOutput b_conv;
24561         b_conv.inner = untag_ptr(b);
24562         b_conv.is_owned = ptr_is_owned(b);
24563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24564         b_conv.is_owned = false;
24565         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
24566         return ret_conv;
24567 }
24568
24569 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
24570         LDKWatchedOutput o_conv;
24571         o_conv.inner = untag_ptr(o);
24572         o_conv.is_owned = ptr_is_owned(o);
24573         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24574         o_conv.is_owned = false;
24575         int64_t ret_conv = WatchedOutput_hash(&o_conv);
24576         return ret_conv;
24577 }
24578
24579 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
24580         if (!ptr_is_owned(this_ptr)) return;
24581         void* this_ptr_ptr = untag_ptr(this_ptr);
24582         CHECK_ACCESS(this_ptr_ptr);
24583         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24584         FREE(untag_ptr(this_ptr));
24585         BroadcasterInterface_free(this_ptr_conv);
24586 }
24587
24588 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
24589         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
24590         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
24591         return ret_conv;
24592 }
24593
24594 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
24595         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
24596         return ret_conv;
24597 }
24598
24599 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
24600         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
24601         return ret_conv;
24602 }
24603
24604 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
24605         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
24606         return ret_conv;
24607 }
24608
24609 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
24610         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
24611         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
24612         return ret_conv;
24613 }
24614
24615 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
24616         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
24617         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
24618         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
24619         return ret_conv;
24620 }
24621
24622 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
24623         if (!ptr_is_owned(this_ptr)) return;
24624         void* this_ptr_ptr = untag_ptr(this_ptr);
24625         CHECK_ACCESS(this_ptr_ptr);
24626         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24627         FREE(untag_ptr(this_ptr));
24628         FeeEstimator_free(this_ptr_conv);
24629 }
24630
24631 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
24632         LDKMonitorUpdateId this_obj_conv;
24633         this_obj_conv.inner = untag_ptr(this_obj);
24634         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24636         MonitorUpdateId_free(this_obj_conv);
24637 }
24638
24639 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24640         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24641         uint64_t ret_ref = 0;
24642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24644         return ret_ref;
24645 }
24646 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
24647         LDKMonitorUpdateId arg_conv;
24648         arg_conv.inner = untag_ptr(arg);
24649         arg_conv.is_owned = ptr_is_owned(arg);
24650         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24651         arg_conv.is_owned = false;
24652         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
24653         return ret_conv;
24654 }
24655
24656 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
24657         LDKMonitorUpdateId orig_conv;
24658         orig_conv.inner = untag_ptr(orig);
24659         orig_conv.is_owned = ptr_is_owned(orig);
24660         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24661         orig_conv.is_owned = false;
24662         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24663         uint64_t ret_ref = 0;
24664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24666         return ret_ref;
24667 }
24668
24669 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
24670         LDKMonitorUpdateId o_conv;
24671         o_conv.inner = untag_ptr(o);
24672         o_conv.is_owned = ptr_is_owned(o);
24673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24674         o_conv.is_owned = false;
24675         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
24676         return ret_conv;
24677 }
24678
24679 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
24680         LDKMonitorUpdateId a_conv;
24681         a_conv.inner = untag_ptr(a);
24682         a_conv.is_owned = ptr_is_owned(a);
24683         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24684         a_conv.is_owned = false;
24685         LDKMonitorUpdateId b_conv;
24686         b_conv.inner = untag_ptr(b);
24687         b_conv.is_owned = ptr_is_owned(b);
24688         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24689         b_conv.is_owned = false;
24690         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
24691         return ret_conv;
24692 }
24693
24694 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
24695         if (!ptr_is_owned(this_ptr)) return;
24696         void* this_ptr_ptr = untag_ptr(this_ptr);
24697         CHECK_ACCESS(this_ptr_ptr);
24698         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
24699         FREE(untag_ptr(this_ptr));
24700         Persist_free(this_ptr_conv);
24701 }
24702
24703 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
24704         LDKLockedChannelMonitor this_obj_conv;
24705         this_obj_conv.inner = untag_ptr(this_obj);
24706         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24708         LockedChannelMonitor_free(this_obj_conv);
24709 }
24710
24711 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
24712         LDKChainMonitor this_obj_conv;
24713         this_obj_conv.inner = untag_ptr(this_obj);
24714         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24716         ChainMonitor_free(this_obj_conv);
24717 }
24718
24719 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) {
24720         void* chain_source_ptr = untag_ptr(chain_source);
24721         CHECK_ACCESS(chain_source_ptr);
24722         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
24723         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
24724         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
24725                 // Manually implement clone for Java trait instances
24726                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
24727                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24728                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
24729                 }
24730         }
24731         void* broadcaster_ptr = untag_ptr(broadcaster);
24732         CHECK_ACCESS(broadcaster_ptr);
24733         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24734         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24735                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24736                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24737         }
24738         void* logger_ptr = untag_ptr(logger);
24739         CHECK_ACCESS(logger_ptr);
24740         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24741         if (logger_conv.free == LDKLogger_JCalls_free) {
24742                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24743                 LDKLogger_JCalls_cloned(&logger_conv);
24744         }
24745         void* feeest_ptr = untag_ptr(feeest);
24746         CHECK_ACCESS(feeest_ptr);
24747         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
24748         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
24749                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24750                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
24751         }
24752         void* persister_ptr = untag_ptr(persister);
24753         CHECK_ACCESS(persister_ptr);
24754         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
24755         if (persister_conv.free == LDKPersist_JCalls_free) {
24756                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24757                 LDKPersist_JCalls_cloned(&persister_conv);
24758         }
24759         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
24760         uint64_t ret_ref = 0;
24761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24763         return ret_ref;
24764 }
24765
24766 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
24767         LDKChainMonitor this_arg_conv;
24768         this_arg_conv.inner = untag_ptr(this_arg);
24769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24771         this_arg_conv.is_owned = false;
24772         LDKCVec_ChannelDetailsZ ignored_channels_constr;
24773         ignored_channels_constr.datalen = ignored_channels->arr_len;
24774         if (ignored_channels_constr.datalen > 0)
24775                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24776         else
24777                 ignored_channels_constr.data = NULL;
24778         uint64_t* ignored_channels_vals = ignored_channels->elems;
24779         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
24780                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
24781                 LDKChannelDetails ignored_channels_conv_16_conv;
24782                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
24783                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
24784                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
24785                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
24786                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
24787         }
24788         FREE(ignored_channels);
24789         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
24790         uint64_tArray ret_arr = NULL;
24791         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24792         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24793         for (size_t j = 0; j < ret_var.datalen; j++) {
24794                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24795                 *ret_conv_9_copy = ret_var.data[j];
24796                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24797                 ret_arr_ptr[j] = ret_conv_9_ref;
24798         }
24799         
24800         FREE(ret_var.data);
24801         return ret_arr;
24802 }
24803
24804 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
24805         LDKChainMonitor this_arg_conv;
24806         this_arg_conv.inner = untag_ptr(this_arg);
24807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24809         this_arg_conv.is_owned = false;
24810         LDKOutPoint funding_txo_conv;
24811         funding_txo_conv.inner = untag_ptr(funding_txo);
24812         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24813         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24814         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24815         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24816         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
24817         return tag_ptr(ret_conv, true);
24818 }
24819
24820 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
24821         LDKChainMonitor this_arg_conv;
24822         this_arg_conv.inner = untag_ptr(this_arg);
24823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24825         this_arg_conv.is_owned = false;
24826         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
24827         uint64_tArray ret_arr = NULL;
24828         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24829         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24830         for (size_t k = 0; k < ret_var.datalen; k++) {
24831                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
24832                 uint64_t ret_conv_10_ref = 0;
24833                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
24834                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
24835                 ret_arr_ptr[k] = ret_conv_10_ref;
24836         }
24837         
24838         FREE(ret_var.data);
24839         return ret_arr;
24840 }
24841
24842 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
24843         LDKChainMonitor this_arg_conv;
24844         this_arg_conv.inner = untag_ptr(this_arg);
24845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24847         this_arg_conv.is_owned = false;
24848         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
24849         uint64_tArray ret_arr = NULL;
24850         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24851         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24852         for (size_t p = 0; p < ret_var.datalen; p++) {
24853                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
24854                 *ret_conv_41_conv = ret_var.data[p];
24855                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
24856         }
24857         
24858         FREE(ret_var.data);
24859         return ret_arr;
24860 }
24861
24862 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) {
24863         LDKChainMonitor this_arg_conv;
24864         this_arg_conv.inner = untag_ptr(this_arg);
24865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24867         this_arg_conv.is_owned = false;
24868         LDKOutPoint funding_txo_conv;
24869         funding_txo_conv.inner = untag_ptr(funding_txo);
24870         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24871         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24872         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24873         LDKMonitorUpdateId completed_update_id_conv;
24874         completed_update_id_conv.inner = untag_ptr(completed_update_id);
24875         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
24876         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
24877         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
24878         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24879         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
24880         return tag_ptr(ret_conv, true);
24881 }
24882
24883 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
24884         LDKChainMonitor this_arg_conv;
24885         this_arg_conv.inner = untag_ptr(this_arg);
24886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24888         this_arg_conv.is_owned = false;
24889         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
24890         uint64_t ret_ref = 0;
24891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24893         return ret_ref;
24894 }
24895
24896 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
24897         LDKChainMonitor this_arg_conv;
24898         this_arg_conv.inner = untag_ptr(this_arg);
24899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24901         this_arg_conv.is_owned = false;
24902         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
24903 }
24904
24905 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
24906         LDKChainMonitor this_arg_conv;
24907         this_arg_conv.inner = untag_ptr(this_arg);
24908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24910         this_arg_conv.is_owned = false;
24911         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
24912         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
24913         return tag_ptr(ret_ret, true);
24914 }
24915
24916 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
24917         LDKChainMonitor this_arg_conv;
24918         this_arg_conv.inner = untag_ptr(this_arg);
24919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24921         this_arg_conv.is_owned = false;
24922         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
24923         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
24924         return tag_ptr(ret_ret, true);
24925 }
24926
24927 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
24928         LDKChainMonitor this_arg_conv;
24929         this_arg_conv.inner = untag_ptr(this_arg);
24930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24932         this_arg_conv.is_owned = false;
24933         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
24934         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
24935         return tag_ptr(ret_ret, true);
24936 }
24937
24938 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
24939         LDKChainMonitor this_arg_conv;
24940         this_arg_conv.inner = untag_ptr(this_arg);
24941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24943         this_arg_conv.is_owned = false;
24944         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
24945         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
24946         return tag_ptr(ret_ret, true);
24947 }
24948
24949 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
24950         LDKChannelMonitorUpdate this_obj_conv;
24951         this_obj_conv.inner = untag_ptr(this_obj);
24952         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24954         ChannelMonitorUpdate_free(this_obj_conv);
24955 }
24956
24957 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
24958         LDKChannelMonitorUpdate this_ptr_conv;
24959         this_ptr_conv.inner = untag_ptr(this_ptr);
24960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24962         this_ptr_conv.is_owned = false;
24963         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
24964         return ret_conv;
24965 }
24966
24967 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
24968         LDKChannelMonitorUpdate this_ptr_conv;
24969         this_ptr_conv.inner = untag_ptr(this_ptr);
24970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24972         this_ptr_conv.is_owned = false;
24973         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
24974 }
24975
24976 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
24977         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
24978         uint64_t ret_ref = 0;
24979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24981         return ret_ref;
24982 }
24983 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
24984         LDKChannelMonitorUpdate arg_conv;
24985         arg_conv.inner = untag_ptr(arg);
24986         arg_conv.is_owned = ptr_is_owned(arg);
24987         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24988         arg_conv.is_owned = false;
24989         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
24990         return ret_conv;
24991 }
24992
24993 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
24994         LDKChannelMonitorUpdate orig_conv;
24995         orig_conv.inner = untag_ptr(orig);
24996         orig_conv.is_owned = ptr_is_owned(orig);
24997         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24998         orig_conv.is_owned = false;
24999         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25000         uint64_t ret_ref = 0;
25001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25003         return ret_ref;
25004 }
25005
25006 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
25007         LDKChannelMonitorUpdate a_conv;
25008         a_conv.inner = untag_ptr(a);
25009         a_conv.is_owned = ptr_is_owned(a);
25010         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25011         a_conv.is_owned = false;
25012         LDKChannelMonitorUpdate b_conv;
25013         b_conv.inner = untag_ptr(b);
25014         b_conv.is_owned = ptr_is_owned(b);
25015         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25016         b_conv.is_owned = false;
25017         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
25018         return ret_conv;
25019 }
25020
25021 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
25022         LDKChannelMonitorUpdate obj_conv;
25023         obj_conv.inner = untag_ptr(obj);
25024         obj_conv.is_owned = ptr_is_owned(obj);
25025         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25026         obj_conv.is_owned = false;
25027         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25028         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25029         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25030         CVec_u8Z_free(ret_var);
25031         return ret_arr;
25032 }
25033
25034 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
25035         LDKu8slice ser_ref;
25036         ser_ref.datalen = ser->arr_len;
25037         ser_ref.data = ser->elems;
25038         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25039         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25040         FREE(ser);
25041         return tag_ptr(ret_conv, true);
25042 }
25043
25044 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
25045         if (!ptr_is_owned(this_ptr)) return;
25046         void* this_ptr_ptr = untag_ptr(this_ptr);
25047         CHECK_ACCESS(this_ptr_ptr);
25048         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25049         FREE(untag_ptr(this_ptr));
25050         MonitorEvent_free(this_ptr_conv);
25051 }
25052
25053 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25054         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25055         *ret_copy = MonitorEvent_clone(arg);
25056         uint64_t ret_ref = tag_ptr(ret_copy, true);
25057         return ret_ref;
25058 }
25059 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
25060         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
25061         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
25062         return ret_conv;
25063 }
25064
25065 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
25066         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
25067         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25068         *ret_copy = MonitorEvent_clone(orig_conv);
25069         uint64_t ret_ref = tag_ptr(ret_copy, true);
25070         return ret_ref;
25071 }
25072
25073 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
25074         LDKHTLCUpdate a_conv;
25075         a_conv.inner = untag_ptr(a);
25076         a_conv.is_owned = ptr_is_owned(a);
25077         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25078         a_conv = HTLCUpdate_clone(&a_conv);
25079         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25080         *ret_copy = MonitorEvent_htlcevent(a_conv);
25081         uint64_t ret_ref = tag_ptr(ret_copy, true);
25082         return ret_ref;
25083 }
25084
25085 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
25086         LDKOutPoint a_conv;
25087         a_conv.inner = untag_ptr(a);
25088         a_conv.is_owned = ptr_is_owned(a);
25089         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25090         a_conv = OutPoint_clone(&a_conv);
25091         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25092         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25093         uint64_t ret_ref = tag_ptr(ret_copy, true);
25094         return ret_ref;
25095 }
25096
25097 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
25098         LDKOutPoint funding_txo_conv;
25099         funding_txo_conv.inner = untag_ptr(funding_txo);
25100         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25101         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25102         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25103         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25104         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
25105         uint64_t ret_ref = tag_ptr(ret_copy, true);
25106         return ret_ref;
25107 }
25108
25109 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
25110         LDKOutPoint a_conv;
25111         a_conv.inner = untag_ptr(a);
25112         a_conv.is_owned = ptr_is_owned(a);
25113         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25114         a_conv = OutPoint_clone(&a_conv);
25115         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25116         *ret_copy = MonitorEvent_update_failed(a_conv);
25117         uint64_t ret_ref = tag_ptr(ret_copy, true);
25118         return ret_ref;
25119 }
25120
25121 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
25122         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
25123         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
25124         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
25125         return ret_conv;
25126 }
25127
25128 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
25129         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
25130         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25131         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25132         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25133         CVec_u8Z_free(ret_var);
25134         return ret_arr;
25135 }
25136
25137 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
25138         LDKu8slice ser_ref;
25139         ser_ref.datalen = ser->arr_len;
25140         ser_ref.data = ser->elems;
25141         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25142         *ret_conv = MonitorEvent_read(ser_ref);
25143         FREE(ser);
25144         return tag_ptr(ret_conv, true);
25145 }
25146
25147 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
25148         LDKHTLCUpdate this_obj_conv;
25149         this_obj_conv.inner = untag_ptr(this_obj);
25150         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25152         HTLCUpdate_free(this_obj_conv);
25153 }
25154
25155 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25156         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25157         uint64_t ret_ref = 0;
25158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25160         return ret_ref;
25161 }
25162 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
25163         LDKHTLCUpdate arg_conv;
25164         arg_conv.inner = untag_ptr(arg);
25165         arg_conv.is_owned = ptr_is_owned(arg);
25166         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25167         arg_conv.is_owned = false;
25168         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
25169         return ret_conv;
25170 }
25171
25172 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
25173         LDKHTLCUpdate orig_conv;
25174         orig_conv.inner = untag_ptr(orig);
25175         orig_conv.is_owned = ptr_is_owned(orig);
25176         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25177         orig_conv.is_owned = false;
25178         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25179         uint64_t ret_ref = 0;
25180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25182         return ret_ref;
25183 }
25184
25185 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
25186         LDKHTLCUpdate a_conv;
25187         a_conv.inner = untag_ptr(a);
25188         a_conv.is_owned = ptr_is_owned(a);
25189         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25190         a_conv.is_owned = false;
25191         LDKHTLCUpdate b_conv;
25192         b_conv.inner = untag_ptr(b);
25193         b_conv.is_owned = ptr_is_owned(b);
25194         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25195         b_conv.is_owned = false;
25196         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
25197         return ret_conv;
25198 }
25199
25200 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
25201         LDKHTLCUpdate obj_conv;
25202         obj_conv.inner = untag_ptr(obj);
25203         obj_conv.is_owned = ptr_is_owned(obj);
25204         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25205         obj_conv.is_owned = false;
25206         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25207         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25208         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25209         CVec_u8Z_free(ret_var);
25210         return ret_arr;
25211 }
25212
25213 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
25214         LDKu8slice ser_ref;
25215         ser_ref.datalen = ser->arr_len;
25216         ser_ref.data = ser->elems;
25217         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25218         *ret_conv = HTLCUpdate_read(ser_ref);
25219         FREE(ser);
25220         return tag_ptr(ret_conv, true);
25221 }
25222
25223 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
25224         if (!ptr_is_owned(this_ptr)) return;
25225         void* this_ptr_ptr = untag_ptr(this_ptr);
25226         CHECK_ACCESS(this_ptr_ptr);
25227         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25228         FREE(untag_ptr(this_ptr));
25229         Balance_free(this_ptr_conv);
25230 }
25231
25232 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25233         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25234         *ret_copy = Balance_clone(arg);
25235         uint64_t ret_ref = tag_ptr(ret_copy, true);
25236         return ret_ref;
25237 }
25238 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
25239         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
25240         int64_t ret_conv = Balance_clone_ptr(arg_conv);
25241         return ret_conv;
25242 }
25243
25244 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
25245         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
25246         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25247         *ret_copy = Balance_clone(orig_conv);
25248         uint64_t ret_ref = tag_ptr(ret_copy, true);
25249         return ret_ref;
25250 }
25251
25252 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
25253         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25254         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25255         uint64_t ret_ref = tag_ptr(ret_copy, true);
25256         return ret_ref;
25257 }
25258
25259 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
25260         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25261         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25262         uint64_t ret_ref = tag_ptr(ret_copy, true);
25263         return ret_ref;
25264 }
25265
25266 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
25267         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25268         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25269         uint64_t ret_ref = tag_ptr(ret_copy, true);
25270         return ret_ref;
25271 }
25272
25273 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) {
25274         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25275         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
25276         uint64_t ret_ref = tag_ptr(ret_copy, true);
25277         return ret_ref;
25278 }
25279
25280 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) {
25281         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25282         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
25283         uint64_t ret_ref = tag_ptr(ret_copy, true);
25284         return ret_ref;
25285 }
25286
25287 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
25288         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25289         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
25290         uint64_t ret_ref = tag_ptr(ret_copy, true);
25291         return ret_ref;
25292 }
25293
25294 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
25295         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
25296         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
25297         jboolean ret_conv = Balance_eq(a_conv, b_conv);
25298         return ret_conv;
25299 }
25300
25301 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
25302         LDKChannelMonitor this_obj_conv;
25303         this_obj_conv.inner = untag_ptr(this_obj);
25304         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25306         ChannelMonitor_free(this_obj_conv);
25307 }
25308
25309 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25310         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25311         uint64_t ret_ref = 0;
25312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25314         return ret_ref;
25315 }
25316 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
25317         LDKChannelMonitor arg_conv;
25318         arg_conv.inner = untag_ptr(arg);
25319         arg_conv.is_owned = ptr_is_owned(arg);
25320         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25321         arg_conv.is_owned = false;
25322         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
25323         return ret_conv;
25324 }
25325
25326 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
25327         LDKChannelMonitor orig_conv;
25328         orig_conv.inner = untag_ptr(orig);
25329         orig_conv.is_owned = ptr_is_owned(orig);
25330         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25331         orig_conv.is_owned = false;
25332         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25333         uint64_t ret_ref = 0;
25334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25336         return ret_ref;
25337 }
25338
25339 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
25340         LDKChannelMonitor obj_conv;
25341         obj_conv.inner = untag_ptr(obj);
25342         obj_conv.is_owned = ptr_is_owned(obj);
25343         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25344         obj_conv.is_owned = false;
25345         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25346         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25347         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25348         CVec_u8Z_free(ret_var);
25349         return ret_arr;
25350 }
25351
25352 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) {
25353         LDKChannelMonitor this_arg_conv;
25354         this_arg_conv.inner = untag_ptr(this_arg);
25355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25357         this_arg_conv.is_owned = false;
25358         LDKChannelMonitorUpdate updates_conv;
25359         updates_conv.inner = untag_ptr(updates);
25360         updates_conv.is_owned = ptr_is_owned(updates);
25361         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25362         updates_conv.is_owned = false;
25363         void* broadcaster_ptr = untag_ptr(broadcaster);
25364         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
25365         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25366         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25367         CHECK_ACCESS(fee_estimator_ptr);
25368         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25369         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25370                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25371                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25372         }
25373         void* logger_ptr = untag_ptr(logger);
25374         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25375         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25376         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25377         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25378         return tag_ptr(ret_conv, true);
25379 }
25380
25381 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
25382         LDKChannelMonitor this_arg_conv;
25383         this_arg_conv.inner = untag_ptr(this_arg);
25384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25386         this_arg_conv.is_owned = false;
25387         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25388         return ret_conv;
25389 }
25390
25391 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
25392         LDKChannelMonitor this_arg_conv;
25393         this_arg_conv.inner = untag_ptr(this_arg);
25394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25396         this_arg_conv.is_owned = false;
25397         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25398         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25399         return tag_ptr(ret_conv, true);
25400 }
25401
25402 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
25403         LDKChannelMonitor this_arg_conv;
25404         this_arg_conv.inner = untag_ptr(this_arg);
25405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25407         this_arg_conv.is_owned = false;
25408         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25409         uint64_tArray ret_arr = NULL;
25410         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25411         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25412         for (size_t o = 0; o < ret_var.datalen; o++) {
25413                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25414                 *ret_conv_40_conv = ret_var.data[o];
25415                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
25416         }
25417         
25418         FREE(ret_var.data);
25419         return ret_arr;
25420 }
25421
25422 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
25423         LDKChannelMonitor this_arg_conv;
25424         this_arg_conv.inner = untag_ptr(this_arg);
25425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25427         this_arg_conv.is_owned = false;
25428         void* filter_ptr = untag_ptr(filter);
25429         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
25430         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25431         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25432 }
25433
25434 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) {
25435         LDKChannelMonitor this_arg_conv;
25436         this_arg_conv.inner = untag_ptr(this_arg);
25437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25439         this_arg_conv.is_owned = false;
25440         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25441         uint64_tArray ret_arr = NULL;
25442         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25443         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25444         for (size_t o = 0; o < ret_var.datalen; o++) {
25445                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25446                 *ret_conv_14_copy = ret_var.data[o];
25447                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
25448                 ret_arr_ptr[o] = ret_conv_14_ref;
25449         }
25450         
25451         FREE(ret_var.data);
25452         return ret_arr;
25453 }
25454
25455 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
25456         LDKChannelMonitor this_arg_conv;
25457         this_arg_conv.inner = untag_ptr(this_arg);
25458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25460         this_arg_conv.is_owned = false;
25461         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25462         uint64_tArray ret_arr = NULL;
25463         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25464         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25465         for (size_t h = 0; h < ret_var.datalen; h++) {
25466                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25467                 *ret_conv_7_copy = ret_var.data[h];
25468                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
25469                 ret_arr_ptr[h] = ret_conv_7_ref;
25470         }
25471         
25472         FREE(ret_var.data);
25473         return ret_arr;
25474 }
25475
25476 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
25477         LDKChannelMonitor this_arg_conv;
25478         this_arg_conv.inner = untag_ptr(this_arg);
25479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25481         this_arg_conv.is_owned = false;
25482         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25483         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
25484         return ret_arr;
25485 }
25486
25487 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) {
25488         LDKChannelMonitor this_arg_conv;
25489         this_arg_conv.inner = untag_ptr(this_arg);
25490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25492         this_arg_conv.is_owned = false;
25493         void* logger_ptr = untag_ptr(logger);
25494         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25495         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25496         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25497         ptrArray ret_arr = NULL;
25498         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
25499         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
25500         for (size_t m = 0; m < ret_var.datalen; m++) {
25501                 LDKTransaction ret_conv_12_var = ret_var.data[m];
25502                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
25503                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
25504                 Transaction_free(ret_conv_12_var);
25505                 ret_arr_ptr[m] = ret_conv_12_arr;
25506         }
25507         
25508         FREE(ret_var.data);
25509         return ret_arr;
25510 }
25511
25512 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) {
25513         LDKChannelMonitor this_arg_conv;
25514         this_arg_conv.inner = untag_ptr(this_arg);
25515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25517         this_arg_conv.is_owned = false;
25518         uint8_t header_arr[80];
25519         CHECK(header->arr_len == 80);
25520         memcpy(header_arr, header->elems, 80); FREE(header);
25521         uint8_t (*header_ref)[80] = &header_arr;
25522         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25523         txdata_constr.datalen = txdata->arr_len;
25524         if (txdata_constr.datalen > 0)
25525                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25526         else
25527                 txdata_constr.data = NULL;
25528         uint64_t* txdata_vals = txdata->elems;
25529         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25530                 uint64_t txdata_conv_28 = txdata_vals[c];
25531                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25532                 CHECK_ACCESS(txdata_conv_28_ptr);
25533                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25534                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25535                 txdata_constr.data[c] = txdata_conv_28_conv;
25536         }
25537         FREE(txdata);
25538         void* broadcaster_ptr = untag_ptr(broadcaster);
25539         CHECK_ACCESS(broadcaster_ptr);
25540         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25541         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25542                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25543                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25544         }
25545         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25546         CHECK_ACCESS(fee_estimator_ptr);
25547         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25548         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25549                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25550                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25551         }
25552         void* logger_ptr = untag_ptr(logger);
25553         CHECK_ACCESS(logger_ptr);
25554         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25555         if (logger_conv.free == LDKLogger_JCalls_free) {
25556                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25557                 LDKLogger_JCalls_cloned(&logger_conv);
25558         }
25559         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);
25560         uint64_tArray ret_arr = NULL;
25561         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25562         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25563         for (size_t n = 0; n < ret_var.datalen; n++) {
25564                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25565                 *ret_conv_39_conv = ret_var.data[n];
25566                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25567         }
25568         
25569         FREE(ret_var.data);
25570         return ret_arr;
25571 }
25572
25573 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) {
25574         LDKChannelMonitor this_arg_conv;
25575         this_arg_conv.inner = untag_ptr(this_arg);
25576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25578         this_arg_conv.is_owned = false;
25579         uint8_t header_arr[80];
25580         CHECK(header->arr_len == 80);
25581         memcpy(header_arr, header->elems, 80); FREE(header);
25582         uint8_t (*header_ref)[80] = &header_arr;
25583         void* broadcaster_ptr = untag_ptr(broadcaster);
25584         CHECK_ACCESS(broadcaster_ptr);
25585         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25586         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25587                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25588                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25589         }
25590         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25591         CHECK_ACCESS(fee_estimator_ptr);
25592         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25593         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25594                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25595                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25596         }
25597         void* logger_ptr = untag_ptr(logger);
25598         CHECK_ACCESS(logger_ptr);
25599         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25600         if (logger_conv.free == LDKLogger_JCalls_free) {
25601                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25602                 LDKLogger_JCalls_cloned(&logger_conv);
25603         }
25604         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25605 }
25606
25607 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) {
25608         LDKChannelMonitor this_arg_conv;
25609         this_arg_conv.inner = untag_ptr(this_arg);
25610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25612         this_arg_conv.is_owned = false;
25613         uint8_t header_arr[80];
25614         CHECK(header->arr_len == 80);
25615         memcpy(header_arr, header->elems, 80); FREE(header);
25616         uint8_t (*header_ref)[80] = &header_arr;
25617         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25618         txdata_constr.datalen = txdata->arr_len;
25619         if (txdata_constr.datalen > 0)
25620                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25621         else
25622                 txdata_constr.data = NULL;
25623         uint64_t* txdata_vals = txdata->elems;
25624         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25625                 uint64_t txdata_conv_28 = txdata_vals[c];
25626                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25627                 CHECK_ACCESS(txdata_conv_28_ptr);
25628                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25629                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25630                 txdata_constr.data[c] = txdata_conv_28_conv;
25631         }
25632         FREE(txdata);
25633         void* broadcaster_ptr = untag_ptr(broadcaster);
25634         CHECK_ACCESS(broadcaster_ptr);
25635         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25636         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25637                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25638                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25639         }
25640         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25641         CHECK_ACCESS(fee_estimator_ptr);
25642         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25643         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25644                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25645                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25646         }
25647         void* logger_ptr = untag_ptr(logger);
25648         CHECK_ACCESS(logger_ptr);
25649         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25650         if (logger_conv.free == LDKLogger_JCalls_free) {
25651                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25652                 LDKLogger_JCalls_cloned(&logger_conv);
25653         }
25654         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);
25655         uint64_tArray ret_arr = NULL;
25656         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25657         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25658         for (size_t n = 0; n < ret_var.datalen; n++) {
25659                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25660                 *ret_conv_39_conv = ret_var.data[n];
25661                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25662         }
25663         
25664         FREE(ret_var.data);
25665         return ret_arr;
25666 }
25667
25668 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) {
25669         LDKChannelMonitor this_arg_conv;
25670         this_arg_conv.inner = untag_ptr(this_arg);
25671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25673         this_arg_conv.is_owned = false;
25674         uint8_t txid_arr[32];
25675         CHECK(txid->arr_len == 32);
25676         memcpy(txid_arr, txid->elems, 32); FREE(txid);
25677         uint8_t (*txid_ref)[32] = &txid_arr;
25678         void* broadcaster_ptr = untag_ptr(broadcaster);
25679         CHECK_ACCESS(broadcaster_ptr);
25680         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25681         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25682                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25683                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25684         }
25685         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25686         CHECK_ACCESS(fee_estimator_ptr);
25687         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25688         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25689                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25690                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25691         }
25692         void* logger_ptr = untag_ptr(logger);
25693         CHECK_ACCESS(logger_ptr);
25694         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25695         if (logger_conv.free == LDKLogger_JCalls_free) {
25696                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25697                 LDKLogger_JCalls_cloned(&logger_conv);
25698         }
25699         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25700 }
25701
25702 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) {
25703         LDKChannelMonitor this_arg_conv;
25704         this_arg_conv.inner = untag_ptr(this_arg);
25705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25707         this_arg_conv.is_owned = false;
25708         uint8_t header_arr[80];
25709         CHECK(header->arr_len == 80);
25710         memcpy(header_arr, header->elems, 80); FREE(header);
25711         uint8_t (*header_ref)[80] = &header_arr;
25712         void* broadcaster_ptr = untag_ptr(broadcaster);
25713         CHECK_ACCESS(broadcaster_ptr);
25714         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25715         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25716                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25717                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25718         }
25719         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25720         CHECK_ACCESS(fee_estimator_ptr);
25721         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25722         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25723                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25724                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25725         }
25726         void* logger_ptr = untag_ptr(logger);
25727         CHECK_ACCESS(logger_ptr);
25728         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25729         if (logger_conv.free == LDKLogger_JCalls_free) {
25730                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25731                 LDKLogger_JCalls_cloned(&logger_conv);
25732         }
25733         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25734         uint64_tArray ret_arr = NULL;
25735         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25736         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25737         for (size_t n = 0; n < ret_var.datalen; n++) {
25738                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25739                 *ret_conv_39_conv = ret_var.data[n];
25740                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25741         }
25742         
25743         FREE(ret_var.data);
25744         return ret_arr;
25745 }
25746
25747 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
25748         LDKChannelMonitor this_arg_conv;
25749         this_arg_conv.inner = untag_ptr(this_arg);
25750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25752         this_arg_conv.is_owned = false;
25753         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
25754         uint64_tArray ret_arr = NULL;
25755         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25756         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25757         for (size_t z = 0; z < ret_var.datalen; z++) {
25758                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
25759                 *ret_conv_25_conv = ret_var.data[z];
25760                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
25761         }
25762         
25763         FREE(ret_var.data);
25764         return ret_arr;
25765 }
25766
25767 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
25768         LDKChannelMonitor this_arg_conv;
25769         this_arg_conv.inner = untag_ptr(this_arg);
25770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25772         this_arg_conv.is_owned = false;
25773         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
25774         uint64_t ret_ref = 0;
25775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25777         return ret_ref;
25778 }
25779
25780 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) {
25781         LDKChannelMonitor this_arg_conv;
25782         this_arg_conv.inner = untag_ptr(this_arg);
25783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25785         this_arg_conv.is_owned = false;
25786         void* broadcaster_ptr = untag_ptr(broadcaster);
25787         CHECK_ACCESS(broadcaster_ptr);
25788         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25789         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25790                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25791                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25792         }
25793         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25794         CHECK_ACCESS(fee_estimator_ptr);
25795         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25796         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25797                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25798                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25799         }
25800         void* logger_ptr = untag_ptr(logger);
25801         CHECK_ACCESS(logger_ptr);
25802         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25803         if (logger_conv.free == LDKLogger_JCalls_free) {
25804                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25805                 LDKLogger_JCalls_cloned(&logger_conv);
25806         }
25807         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25808 }
25809
25810 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
25811         LDKChannelMonitor this_arg_conv;
25812         this_arg_conv.inner = untag_ptr(this_arg);
25813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25815         this_arg_conv.is_owned = false;
25816         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
25817         uint64_tArray ret_arr = NULL;
25818         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25819         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25820         for (size_t j = 0; j < ret_var.datalen; j++) {
25821                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25822                 *ret_conv_9_copy = ret_var.data[j];
25823                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25824                 ret_arr_ptr[j] = ret_conv_9_ref;
25825         }
25826         
25827         FREE(ret_var.data);
25828         return ret_arr;
25829 }
25830
25831 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
25832         LDKu8slice ser_ref;
25833         ser_ref.datalen = ser->arr_len;
25834         ser_ref.data = ser->elems;
25835         void* arg_a_ptr = untag_ptr(arg_a);
25836         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
25837         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
25838         void* arg_b_ptr = untag_ptr(arg_b);
25839         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
25840         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
25841         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25842         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
25843         FREE(ser);
25844         return tag_ptr(ret_conv, true);
25845 }
25846
25847 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
25848         LDKOutPoint this_obj_conv;
25849         this_obj_conv.inner = untag_ptr(this_obj);
25850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25852         OutPoint_free(this_obj_conv);
25853 }
25854
25855 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
25856         LDKOutPoint this_ptr_conv;
25857         this_ptr_conv.inner = untag_ptr(this_ptr);
25858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25860         this_ptr_conv.is_owned = false;
25861         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25862         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
25863         return ret_arr;
25864 }
25865
25866 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
25867         LDKOutPoint this_ptr_conv;
25868         this_ptr_conv.inner = untag_ptr(this_ptr);
25869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25871         this_ptr_conv.is_owned = false;
25872         LDKThirtyTwoBytes val_ref;
25873         CHECK(val->arr_len == 32);
25874         memcpy(val_ref.data, val->elems, 32); FREE(val);
25875         OutPoint_set_txid(&this_ptr_conv, val_ref);
25876 }
25877
25878 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
25879         LDKOutPoint this_ptr_conv;
25880         this_ptr_conv.inner = untag_ptr(this_ptr);
25881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25883         this_ptr_conv.is_owned = false;
25884         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
25885         return ret_conv;
25886 }
25887
25888 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
25889         LDKOutPoint this_ptr_conv;
25890         this_ptr_conv.inner = untag_ptr(this_ptr);
25891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25893         this_ptr_conv.is_owned = false;
25894         OutPoint_set_index(&this_ptr_conv, val);
25895 }
25896
25897 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
25898         LDKThirtyTwoBytes txid_arg_ref;
25899         CHECK(txid_arg->arr_len == 32);
25900         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
25901         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
25902         uint64_t ret_ref = 0;
25903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25905         return ret_ref;
25906 }
25907
25908 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
25909         LDKOutPoint ret_var = OutPoint_clone(arg);
25910         uint64_t ret_ref = 0;
25911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25913         return ret_ref;
25914 }
25915 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
25916         LDKOutPoint arg_conv;
25917         arg_conv.inner = untag_ptr(arg);
25918         arg_conv.is_owned = ptr_is_owned(arg);
25919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25920         arg_conv.is_owned = false;
25921         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
25922         return ret_conv;
25923 }
25924
25925 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
25926         LDKOutPoint orig_conv;
25927         orig_conv.inner = untag_ptr(orig);
25928         orig_conv.is_owned = ptr_is_owned(orig);
25929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25930         orig_conv.is_owned = false;
25931         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
25932         uint64_t ret_ref = 0;
25933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25935         return ret_ref;
25936 }
25937
25938 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
25939         LDKOutPoint a_conv;
25940         a_conv.inner = untag_ptr(a);
25941         a_conv.is_owned = ptr_is_owned(a);
25942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25943         a_conv.is_owned = false;
25944         LDKOutPoint b_conv;
25945         b_conv.inner = untag_ptr(b);
25946         b_conv.is_owned = ptr_is_owned(b);
25947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25948         b_conv.is_owned = false;
25949         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
25950         return ret_conv;
25951 }
25952
25953 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
25954         LDKOutPoint o_conv;
25955         o_conv.inner = untag_ptr(o);
25956         o_conv.is_owned = ptr_is_owned(o);
25957         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25958         o_conv.is_owned = false;
25959         int64_t ret_conv = OutPoint_hash(&o_conv);
25960         return ret_conv;
25961 }
25962
25963 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
25964         LDKOutPoint this_arg_conv;
25965         this_arg_conv.inner = untag_ptr(this_arg);
25966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25968         this_arg_conv.is_owned = false;
25969         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25970         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
25971         return ret_arr;
25972 }
25973
25974 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
25975         LDKOutPoint obj_conv;
25976         obj_conv.inner = untag_ptr(obj);
25977         obj_conv.is_owned = ptr_is_owned(obj);
25978         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25979         obj_conv.is_owned = false;
25980         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
25981         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25982         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25983         CVec_u8Z_free(ret_var);
25984         return ret_arr;
25985 }
25986
25987 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
25988         LDKu8slice ser_ref;
25989         ser_ref.datalen = ser->arr_len;
25990         ser_ref.data = ser->elems;
25991         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
25992         *ret_conv = OutPoint_read(ser_ref);
25993         FREE(ser);
25994         return tag_ptr(ret_conv, true);
25995 }
25996
25997 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
25998         LDKDelayedPaymentOutputDescriptor this_obj_conv;
25999         this_obj_conv.inner = untag_ptr(this_obj);
26000         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26002         DelayedPaymentOutputDescriptor_free(this_obj_conv);
26003 }
26004
26005 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26006         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26007         this_ptr_conv.inner = untag_ptr(this_ptr);
26008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26010         this_ptr_conv.is_owned = false;
26011         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26012         uint64_t ret_ref = 0;
26013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26015         return ret_ref;
26016 }
26017
26018 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26019         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26020         this_ptr_conv.inner = untag_ptr(this_ptr);
26021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26023         this_ptr_conv.is_owned = false;
26024         LDKOutPoint val_conv;
26025         val_conv.inner = untag_ptr(val);
26026         val_conv.is_owned = ptr_is_owned(val);
26027         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26028         val_conv = OutPoint_clone(&val_conv);
26029         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26030 }
26031
26032 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
26033         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26034         this_ptr_conv.inner = untag_ptr(this_ptr);
26035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26037         this_ptr_conv.is_owned = false;
26038         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26039         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26040         return ret_arr;
26041 }
26042
26043 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
26044         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26045         this_ptr_conv.inner = untag_ptr(this_ptr);
26046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26048         this_ptr_conv.is_owned = false;
26049         LDKPublicKey val_ref;
26050         CHECK(val->arr_len == 33);
26051         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26052         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26053 }
26054
26055 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
26056         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26057         this_ptr_conv.inner = untag_ptr(this_ptr);
26058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26060         this_ptr_conv.is_owned = false;
26061         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26062         return ret_conv;
26063 }
26064
26065 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
26066         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26067         this_ptr_conv.inner = untag_ptr(this_ptr);
26068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26070         this_ptr_conv.is_owned = false;
26071         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26072 }
26073
26074 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26075         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26076         this_ptr_conv.inner = untag_ptr(this_ptr);
26077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26079         this_ptr_conv.is_owned = false;
26080         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26081         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
26082         return tag_ptr(ret_ref, true);
26083 }
26084
26085 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26086         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26087         this_ptr_conv.inner = untag_ptr(this_ptr);
26088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26090         this_ptr_conv.is_owned = false;
26091         void* val_ptr = untag_ptr(val);
26092         CHECK_ACCESS(val_ptr);
26093         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26094         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26095         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26096 }
26097
26098 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
26099         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26100         this_ptr_conv.inner = untag_ptr(this_ptr);
26101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26103         this_ptr_conv.is_owned = false;
26104         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26105         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
26106         return ret_arr;
26107 }
26108
26109 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
26110         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26111         this_ptr_conv.inner = untag_ptr(this_ptr);
26112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26114         this_ptr_conv.is_owned = false;
26115         LDKPublicKey val_ref;
26116         CHECK(val->arr_len == 33);
26117         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26118         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26119 }
26120
26121 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26122         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26123         this_ptr_conv.inner = untag_ptr(this_ptr);
26124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26126         this_ptr_conv.is_owned = false;
26127         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26128         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26129         return ret_arr;
26130 }
26131
26132 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26133         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26134         this_ptr_conv.inner = untag_ptr(this_ptr);
26135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26137         this_ptr_conv.is_owned = false;
26138         LDKThirtyTwoBytes val_ref;
26139         CHECK(val->arr_len == 32);
26140         memcpy(val_ref.data, val->elems, 32); FREE(val);
26141         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26142 }
26143
26144 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26145         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26146         this_ptr_conv.inner = untag_ptr(this_ptr);
26147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26149         this_ptr_conv.is_owned = false;
26150         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26151         return ret_conv;
26152 }
26153
26154 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26155         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26156         this_ptr_conv.inner = untag_ptr(this_ptr);
26157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26159         this_ptr_conv.is_owned = false;
26160         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26161 }
26162
26163 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) {
26164         LDKOutPoint outpoint_arg_conv;
26165         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26166         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26167         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26168         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26169         LDKPublicKey per_commitment_point_arg_ref;
26170         CHECK(per_commitment_point_arg->arr_len == 33);
26171         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
26172         void* output_arg_ptr = untag_ptr(output_arg);
26173         CHECK_ACCESS(output_arg_ptr);
26174         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26175         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26176         LDKPublicKey revocation_pubkey_arg_ref;
26177         CHECK(revocation_pubkey_arg->arr_len == 33);
26178         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
26179         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26180         CHECK(channel_keys_id_arg->arr_len == 32);
26181         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26182         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);
26183         uint64_t ret_ref = 0;
26184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26186         return ret_ref;
26187 }
26188
26189 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26190         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26191         uint64_t ret_ref = 0;
26192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26194         return ret_ref;
26195 }
26196 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26197         LDKDelayedPaymentOutputDescriptor arg_conv;
26198         arg_conv.inner = untag_ptr(arg);
26199         arg_conv.is_owned = ptr_is_owned(arg);
26200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26201         arg_conv.is_owned = false;
26202         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26203         return ret_conv;
26204 }
26205
26206 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
26207         LDKDelayedPaymentOutputDescriptor orig_conv;
26208         orig_conv.inner = untag_ptr(orig);
26209         orig_conv.is_owned = ptr_is_owned(orig);
26210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26211         orig_conv.is_owned = false;
26212         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26213         uint64_t ret_ref = 0;
26214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26216         return ret_ref;
26217 }
26218
26219 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26220         LDKDelayedPaymentOutputDescriptor a_conv;
26221         a_conv.inner = untag_ptr(a);
26222         a_conv.is_owned = ptr_is_owned(a);
26223         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26224         a_conv.is_owned = false;
26225         LDKDelayedPaymentOutputDescriptor b_conv;
26226         b_conv.inner = untag_ptr(b);
26227         b_conv.is_owned = ptr_is_owned(b);
26228         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26229         b_conv.is_owned = false;
26230         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26231         return ret_conv;
26232 }
26233
26234 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
26235         LDKDelayedPaymentOutputDescriptor obj_conv;
26236         obj_conv.inner = untag_ptr(obj);
26237         obj_conv.is_owned = ptr_is_owned(obj);
26238         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26239         obj_conv.is_owned = false;
26240         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26241         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26242         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26243         CVec_u8Z_free(ret_var);
26244         return ret_arr;
26245 }
26246
26247 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
26248         LDKu8slice ser_ref;
26249         ser_ref.datalen = ser->arr_len;
26250         ser_ref.data = ser->elems;
26251         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26252         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26253         FREE(ser);
26254         return tag_ptr(ret_conv, true);
26255 }
26256
26257 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
26258         LDKStaticPaymentOutputDescriptor this_obj_conv;
26259         this_obj_conv.inner = untag_ptr(this_obj);
26260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26262         StaticPaymentOutputDescriptor_free(this_obj_conv);
26263 }
26264
26265 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26266         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26267         this_ptr_conv.inner = untag_ptr(this_ptr);
26268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26270         this_ptr_conv.is_owned = false;
26271         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26272         uint64_t ret_ref = 0;
26273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26275         return ret_ref;
26276 }
26277
26278 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26279         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26280         this_ptr_conv.inner = untag_ptr(this_ptr);
26281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26283         this_ptr_conv.is_owned = false;
26284         LDKOutPoint val_conv;
26285         val_conv.inner = untag_ptr(val);
26286         val_conv.is_owned = ptr_is_owned(val);
26287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26288         val_conv = OutPoint_clone(&val_conv);
26289         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26290 }
26291
26292 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26293         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26294         this_ptr_conv.inner = untag_ptr(this_ptr);
26295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26297         this_ptr_conv.is_owned = false;
26298         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26299         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
26300         return tag_ptr(ret_ref, true);
26301 }
26302
26303 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26304         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26305         this_ptr_conv.inner = untag_ptr(this_ptr);
26306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26308         this_ptr_conv.is_owned = false;
26309         void* val_ptr = untag_ptr(val);
26310         CHECK_ACCESS(val_ptr);
26311         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26312         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26313         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26314 }
26315
26316 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26317         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26318         this_ptr_conv.inner = untag_ptr(this_ptr);
26319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26321         this_ptr_conv.is_owned = false;
26322         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26323         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26324         return ret_arr;
26325 }
26326
26327 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26328         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26329         this_ptr_conv.inner = untag_ptr(this_ptr);
26330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26332         this_ptr_conv.is_owned = false;
26333         LDKThirtyTwoBytes val_ref;
26334         CHECK(val->arr_len == 32);
26335         memcpy(val_ref.data, val->elems, 32); FREE(val);
26336         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26337 }
26338
26339 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26340         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26341         this_ptr_conv.inner = untag_ptr(this_ptr);
26342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26344         this_ptr_conv.is_owned = false;
26345         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26346         return ret_conv;
26347 }
26348
26349 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26350         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26351         this_ptr_conv.inner = untag_ptr(this_ptr);
26352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26354         this_ptr_conv.is_owned = false;
26355         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26356 }
26357
26358 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) {
26359         LDKOutPoint outpoint_arg_conv;
26360         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26361         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26362         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26363         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26364         void* output_arg_ptr = untag_ptr(output_arg);
26365         CHECK_ACCESS(output_arg_ptr);
26366         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26367         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26368         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26369         CHECK(channel_keys_id_arg->arr_len == 32);
26370         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26371         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26372         uint64_t ret_ref = 0;
26373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26375         return ret_ref;
26376 }
26377
26378 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26379         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26380         uint64_t ret_ref = 0;
26381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26383         return ret_ref;
26384 }
26385 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26386         LDKStaticPaymentOutputDescriptor arg_conv;
26387         arg_conv.inner = untag_ptr(arg);
26388         arg_conv.is_owned = ptr_is_owned(arg);
26389         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26390         arg_conv.is_owned = false;
26391         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26392         return ret_conv;
26393 }
26394
26395 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
26396         LDKStaticPaymentOutputDescriptor orig_conv;
26397         orig_conv.inner = untag_ptr(orig);
26398         orig_conv.is_owned = ptr_is_owned(orig);
26399         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26400         orig_conv.is_owned = false;
26401         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26402         uint64_t ret_ref = 0;
26403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26405         return ret_ref;
26406 }
26407
26408 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26409         LDKStaticPaymentOutputDescriptor a_conv;
26410         a_conv.inner = untag_ptr(a);
26411         a_conv.is_owned = ptr_is_owned(a);
26412         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26413         a_conv.is_owned = false;
26414         LDKStaticPaymentOutputDescriptor b_conv;
26415         b_conv.inner = untag_ptr(b);
26416         b_conv.is_owned = ptr_is_owned(b);
26417         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26418         b_conv.is_owned = false;
26419         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26420         return ret_conv;
26421 }
26422
26423 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
26424         LDKStaticPaymentOutputDescriptor obj_conv;
26425         obj_conv.inner = untag_ptr(obj);
26426         obj_conv.is_owned = ptr_is_owned(obj);
26427         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26428         obj_conv.is_owned = false;
26429         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26430         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26431         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26432         CVec_u8Z_free(ret_var);
26433         return ret_arr;
26434 }
26435
26436 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
26437         LDKu8slice ser_ref;
26438         ser_ref.datalen = ser->arr_len;
26439         ser_ref.data = ser->elems;
26440         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26441         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26442         FREE(ser);
26443         return tag_ptr(ret_conv, true);
26444 }
26445
26446 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
26447         if (!ptr_is_owned(this_ptr)) return;
26448         void* this_ptr_ptr = untag_ptr(this_ptr);
26449         CHECK_ACCESS(this_ptr_ptr);
26450         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26451         FREE(untag_ptr(this_ptr));
26452         SpendableOutputDescriptor_free(this_ptr_conv);
26453 }
26454
26455 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26456         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26457         *ret_copy = SpendableOutputDescriptor_clone(arg);
26458         uint64_t ret_ref = tag_ptr(ret_copy, true);
26459         return ret_ref;
26460 }
26461 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
26462         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
26463         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
26464         return ret_conv;
26465 }
26466
26467 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
26468         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
26469         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26470         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26471         uint64_t ret_ref = tag_ptr(ret_copy, true);
26472         return ret_ref;
26473 }
26474
26475 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
26476         LDKOutPoint outpoint_conv;
26477         outpoint_conv.inner = untag_ptr(outpoint);
26478         outpoint_conv.is_owned = ptr_is_owned(outpoint);
26479         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26480         outpoint_conv = OutPoint_clone(&outpoint_conv);
26481         void* output_ptr = untag_ptr(output);
26482         CHECK_ACCESS(output_ptr);
26483         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26484         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
26485         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26486         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26487         uint64_t ret_ref = tag_ptr(ret_copy, true);
26488         return ret_ref;
26489 }
26490
26491 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
26492         LDKDelayedPaymentOutputDescriptor a_conv;
26493         a_conv.inner = untag_ptr(a);
26494         a_conv.is_owned = ptr_is_owned(a);
26495         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26496         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26497         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26498         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26499         uint64_t ret_ref = tag_ptr(ret_copy, true);
26500         return ret_ref;
26501 }
26502
26503 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
26504         LDKStaticPaymentOutputDescriptor a_conv;
26505         a_conv.inner = untag_ptr(a);
26506         a_conv.is_owned = ptr_is_owned(a);
26507         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26508         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26509         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26510         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26511         uint64_t ret_ref = tag_ptr(ret_copy, true);
26512         return ret_ref;
26513 }
26514
26515 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
26516         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
26517         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
26518         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
26519         return ret_conv;
26520 }
26521
26522 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
26523         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
26524         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26525         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26526         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26527         CVec_u8Z_free(ret_var);
26528         return ret_arr;
26529 }
26530
26531 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
26532         LDKu8slice ser_ref;
26533         ser_ref.datalen = ser->arr_len;
26534         ser_ref.data = ser->elems;
26535         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26536         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26537         FREE(ser);
26538         return tag_ptr(ret_conv, true);
26539 }
26540
26541 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
26542         if (!ptr_is_owned(this_ptr)) return;
26543         void* this_ptr_ptr = untag_ptr(this_ptr);
26544         CHECK_ACCESS(this_ptr_ptr);
26545         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
26546         FREE(untag_ptr(this_ptr));
26547         ChannelSigner_free(this_ptr_conv);
26548 }
26549
26550 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
26551         if (!ptr_is_owned(this_ptr)) return;
26552         void* this_ptr_ptr = untag_ptr(this_ptr);
26553         CHECK_ACCESS(this_ptr_ptr);
26554         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
26555         FREE(untag_ptr(this_ptr));
26556         EcdsaChannelSigner_free(this_ptr_conv);
26557 }
26558
26559 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
26560         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26561         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
26562         return tag_ptr(ret_ret, true);
26563 }
26564 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
26565         void* arg_ptr = untag_ptr(arg);
26566         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26567         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
26568         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
26569         return ret_conv;
26570 }
26571
26572 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
26573         void* orig_ptr = untag_ptr(orig);
26574         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
26575         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
26576         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26577         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
26578         return tag_ptr(ret_ret, true);
26579 }
26580
26581 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
26582         if (!ptr_is_owned(this_ptr)) return;
26583         void* this_ptr_ptr = untag_ptr(this_ptr);
26584         CHECK_ACCESS(this_ptr_ptr);
26585         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
26586         FREE(untag_ptr(this_ptr));
26587         WriteableEcdsaChannelSigner_free(this_ptr_conv);
26588 }
26589
26590 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
26591         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
26592         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
26593         return ret_conv;
26594 }
26595
26596 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
26597         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
26598         return ret_conv;
26599 }
26600
26601 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
26602         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
26603         return ret_conv;
26604 }
26605
26606 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
26607         if (!ptr_is_owned(this_ptr)) return;
26608         void* this_ptr_ptr = untag_ptr(this_ptr);
26609         CHECK_ACCESS(this_ptr_ptr);
26610         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
26611         FREE(untag_ptr(this_ptr));
26612         EntropySource_free(this_ptr_conv);
26613 }
26614
26615 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
26616         if (!ptr_is_owned(this_ptr)) return;
26617         void* this_ptr_ptr = untag_ptr(this_ptr);
26618         CHECK_ACCESS(this_ptr_ptr);
26619         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
26620         FREE(untag_ptr(this_ptr));
26621         NodeSigner_free(this_ptr_conv);
26622 }
26623
26624 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
26625         if (!ptr_is_owned(this_ptr)) return;
26626         void* this_ptr_ptr = untag_ptr(this_ptr);
26627         CHECK_ACCESS(this_ptr_ptr);
26628         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
26629         FREE(untag_ptr(this_ptr));
26630         SignerProvider_free(this_ptr_conv);
26631 }
26632
26633 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
26634         LDKInMemorySigner this_obj_conv;
26635         this_obj_conv.inner = untag_ptr(this_obj);
26636         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26638         InMemorySigner_free(this_obj_conv);
26639 }
26640
26641 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
26642         LDKInMemorySigner this_ptr_conv;
26643         this_ptr_conv.inner = untag_ptr(this_ptr);
26644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26646         this_ptr_conv.is_owned = false;
26647         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26648         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
26649         return ret_arr;
26650 }
26651
26652 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
26653         LDKInMemorySigner this_ptr_conv;
26654         this_ptr_conv.inner = untag_ptr(this_ptr);
26655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26657         this_ptr_conv.is_owned = false;
26658         LDKSecretKey val_ref;
26659         CHECK(val->arr_len == 32);
26660         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26661         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26662 }
26663
26664 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
26665         LDKInMemorySigner this_ptr_conv;
26666         this_ptr_conv.inner = untag_ptr(this_ptr);
26667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26669         this_ptr_conv.is_owned = false;
26670         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26671         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
26672         return ret_arr;
26673 }
26674
26675 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
26676         LDKInMemorySigner this_ptr_conv;
26677         this_ptr_conv.inner = untag_ptr(this_ptr);
26678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26680         this_ptr_conv.is_owned = false;
26681         LDKSecretKey val_ref;
26682         CHECK(val->arr_len == 32);
26683         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26684         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26685 }
26686
26687 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
26688         LDKInMemorySigner this_ptr_conv;
26689         this_ptr_conv.inner = untag_ptr(this_ptr);
26690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26692         this_ptr_conv.is_owned = false;
26693         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26694         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
26695         return ret_arr;
26696 }
26697
26698 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
26699         LDKInMemorySigner this_ptr_conv;
26700         this_ptr_conv.inner = untag_ptr(this_ptr);
26701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26703         this_ptr_conv.is_owned = false;
26704         LDKSecretKey val_ref;
26705         CHECK(val->arr_len == 32);
26706         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26707         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26708 }
26709
26710 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
26711         LDKInMemorySigner this_ptr_conv;
26712         this_ptr_conv.inner = untag_ptr(this_ptr);
26713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26715         this_ptr_conv.is_owned = false;
26716         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26717         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
26718         return ret_arr;
26719 }
26720
26721 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) {
26722         LDKInMemorySigner this_ptr_conv;
26723         this_ptr_conv.inner = untag_ptr(this_ptr);
26724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26726         this_ptr_conv.is_owned = false;
26727         LDKSecretKey val_ref;
26728         CHECK(val->arr_len == 32);
26729         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26730         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26731 }
26732
26733 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
26734         LDKInMemorySigner this_ptr_conv;
26735         this_ptr_conv.inner = untag_ptr(this_ptr);
26736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26738         this_ptr_conv.is_owned = false;
26739         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26740         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
26741         return ret_arr;
26742 }
26743
26744 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
26745         LDKInMemorySigner this_ptr_conv;
26746         this_ptr_conv.inner = untag_ptr(this_ptr);
26747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26749         this_ptr_conv.is_owned = false;
26750         LDKSecretKey val_ref;
26751         CHECK(val->arr_len == 32);
26752         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26753         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26754 }
26755
26756 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
26757         LDKInMemorySigner this_ptr_conv;
26758         this_ptr_conv.inner = untag_ptr(this_ptr);
26759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26761         this_ptr_conv.is_owned = false;
26762         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26763         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
26764         return ret_arr;
26765 }
26766
26767 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
26768         LDKInMemorySigner this_ptr_conv;
26769         this_ptr_conv.inner = untag_ptr(this_ptr);
26770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26772         this_ptr_conv.is_owned = false;
26773         LDKThirtyTwoBytes val_ref;
26774         CHECK(val->arr_len == 32);
26775         memcpy(val_ref.data, val->elems, 32); FREE(val);
26776         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26777 }
26778
26779 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26780         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26781         uint64_t ret_ref = 0;
26782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26784         return ret_ref;
26785 }
26786 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
26787         LDKInMemorySigner arg_conv;
26788         arg_conv.inner = untag_ptr(arg);
26789         arg_conv.is_owned = ptr_is_owned(arg);
26790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26791         arg_conv.is_owned = false;
26792         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
26793         return ret_conv;
26794 }
26795
26796 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
26797         LDKInMemorySigner orig_conv;
26798         orig_conv.inner = untag_ptr(orig);
26799         orig_conv.is_owned = ptr_is_owned(orig);
26800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26801         orig_conv.is_owned = false;
26802         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26803         uint64_t ret_ref = 0;
26804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26806         return ret_ref;
26807 }
26808
26809 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) {
26810         LDKSecretKey funding_key_ref;
26811         CHECK(funding_key->arr_len == 32);
26812         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
26813         LDKSecretKey revocation_base_key_ref;
26814         CHECK(revocation_base_key->arr_len == 32);
26815         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
26816         LDKSecretKey payment_key_ref;
26817         CHECK(payment_key->arr_len == 32);
26818         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
26819         LDKSecretKey delayed_payment_base_key_ref;
26820         CHECK(delayed_payment_base_key->arr_len == 32);
26821         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
26822         LDKSecretKey htlc_base_key_ref;
26823         CHECK(htlc_base_key->arr_len == 32);
26824         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
26825         LDKThirtyTwoBytes commitment_seed_ref;
26826         CHECK(commitment_seed->arr_len == 32);
26827         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
26828         LDKThirtyTwoBytes channel_keys_id_ref;
26829         CHECK(channel_keys_id->arr_len == 32);
26830         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
26831         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
26832         CHECK(rand_bytes_unique_start->arr_len == 32);
26833         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
26834         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);
26835         uint64_t ret_ref = 0;
26836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26838         return ret_ref;
26839 }
26840
26841 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
26842         LDKInMemorySigner this_arg_conv;
26843         this_arg_conv.inner = untag_ptr(this_arg);
26844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26846         this_arg_conv.is_owned = false;
26847         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
26848         uint64_t ret_ref = 0;
26849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26851         return ret_ref;
26852 }
26853
26854 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
26855         LDKInMemorySigner this_arg_conv;
26856         this_arg_conv.inner = untag_ptr(this_arg);
26857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26859         this_arg_conv.is_owned = false;
26860         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
26861         return ret_conv;
26862 }
26863
26864 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
26865         LDKInMemorySigner this_arg_conv;
26866         this_arg_conv.inner = untag_ptr(this_arg);
26867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26869         this_arg_conv.is_owned = false;
26870         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
26871         return ret_conv;
26872 }
26873
26874 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
26875         LDKInMemorySigner this_arg_conv;
26876         this_arg_conv.inner = untag_ptr(this_arg);
26877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26879         this_arg_conv.is_owned = false;
26880         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
26881         return ret_conv;
26882 }
26883
26884 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
26885         LDKInMemorySigner this_arg_conv;
26886         this_arg_conv.inner = untag_ptr(this_arg);
26887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26889         this_arg_conv.is_owned = false;
26890         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
26891         uint64_t ret_ref = 0;
26892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26894         return ret_ref;
26895 }
26896
26897 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
26898         LDKInMemorySigner this_arg_conv;
26899         this_arg_conv.inner = untag_ptr(this_arg);
26900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26902         this_arg_conv.is_owned = false;
26903         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
26904         uint64_t ret_ref = 0;
26905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26907         return ret_ref;
26908 }
26909
26910 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
26911         LDKInMemorySigner this_arg_conv;
26912         this_arg_conv.inner = untag_ptr(this_arg);
26913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26915         this_arg_conv.is_owned = false;
26916         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
26917         return ret_conv;
26918 }
26919
26920 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) {
26921         LDKInMemorySigner this_arg_conv;
26922         this_arg_conv.inner = untag_ptr(this_arg);
26923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26925         this_arg_conv.is_owned = false;
26926         LDKTransaction spend_tx_ref;
26927         spend_tx_ref.datalen = spend_tx->arr_len;
26928         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26929         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26930         spend_tx_ref.data_is_owned = true;
26931         LDKStaticPaymentOutputDescriptor descriptor_conv;
26932         descriptor_conv.inner = untag_ptr(descriptor);
26933         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26934         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26935         descriptor_conv.is_owned = false;
26936         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26937         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26938         return tag_ptr(ret_conv, true);
26939 }
26940
26941 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) {
26942         LDKInMemorySigner this_arg_conv;
26943         this_arg_conv.inner = untag_ptr(this_arg);
26944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26946         this_arg_conv.is_owned = false;
26947         LDKTransaction spend_tx_ref;
26948         spend_tx_ref.datalen = spend_tx->arr_len;
26949         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26950         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26951         spend_tx_ref.data_is_owned = true;
26952         LDKDelayedPaymentOutputDescriptor descriptor_conv;
26953         descriptor_conv.inner = untag_ptr(descriptor);
26954         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26955         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26956         descriptor_conv.is_owned = false;
26957         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26958         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26959         return tag_ptr(ret_conv, true);
26960 }
26961
26962 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
26963         LDKInMemorySigner this_arg_conv;
26964         this_arg_conv.inner = untag_ptr(this_arg);
26965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26967         this_arg_conv.is_owned = false;
26968         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
26969         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
26970         return tag_ptr(ret_ret, true);
26971 }
26972
26973 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
26974         LDKInMemorySigner this_arg_conv;
26975         this_arg_conv.inner = untag_ptr(this_arg);
26976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26978         this_arg_conv.is_owned = false;
26979         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
26980         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
26981         return tag_ptr(ret_ret, true);
26982 }
26983
26984 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
26985         LDKInMemorySigner this_arg_conv;
26986         this_arg_conv.inner = untag_ptr(this_arg);
26987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26989         this_arg_conv.is_owned = false;
26990         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
26991         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
26992         return tag_ptr(ret_ret, true);
26993 }
26994
26995 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
26996         LDKInMemorySigner this_arg_conv;
26997         this_arg_conv.inner = untag_ptr(this_arg);
26998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27000         this_arg_conv.is_owned = false;
27001         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
27002         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
27003         return tag_ptr(ret_ret, true);
27004 }
27005
27006 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
27007         LDKInMemorySigner obj_conv;
27008         obj_conv.inner = untag_ptr(obj);
27009         obj_conv.is_owned = ptr_is_owned(obj);
27010         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27011         obj_conv.is_owned = false;
27012         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27013         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27014         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27015         CVec_u8Z_free(ret_var);
27016         return ret_arr;
27017 }
27018
27019 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
27020         LDKu8slice ser_ref;
27021         ser_ref.datalen = ser->arr_len;
27022         ser_ref.data = ser->elems;
27023         void* arg_ptr = untag_ptr(arg);
27024         CHECK_ACCESS(arg_ptr);
27025         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
27026         if (arg_conv.free == LDKEntropySource_JCalls_free) {
27027                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27028                 LDKEntropySource_JCalls_cloned(&arg_conv);
27029         }
27030         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27031         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
27032         FREE(ser);
27033         return tag_ptr(ret_conv, true);
27034 }
27035
27036 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
27037         LDKKeysManager this_obj_conv;
27038         this_obj_conv.inner = untag_ptr(this_obj);
27039         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27041         KeysManager_free(this_obj_conv);
27042 }
27043
27044 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
27045         uint8_t seed_arr[32];
27046         CHECK(seed->arr_len == 32);
27047         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27048         uint8_t (*seed_ref)[32] = &seed_arr;
27049         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27050         uint64_t ret_ref = 0;
27051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27053         return ret_ref;
27054 }
27055
27056 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
27057         LDKKeysManager this_arg_conv;
27058         this_arg_conv.inner = untag_ptr(this_arg);
27059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27061         this_arg_conv.is_owned = false;
27062         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27063         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27064         return ret_arr;
27065 }
27066
27067 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) {
27068         LDKKeysManager this_arg_conv;
27069         this_arg_conv.inner = untag_ptr(this_arg);
27070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27072         this_arg_conv.is_owned = false;
27073         uint8_t params_arr[32];
27074         CHECK(params->arr_len == 32);
27075         memcpy(params_arr, params->elems, 32); FREE(params);
27076         uint8_t (*params_ref)[32] = &params_arr;
27077         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27078         uint64_t ret_ref = 0;
27079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27081         return ret_ref;
27082 }
27083
27084 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) {
27085         LDKKeysManager this_arg_conv;
27086         this_arg_conv.inner = untag_ptr(this_arg);
27087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27089         this_arg_conv.is_owned = false;
27090         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27091         descriptors_constr.datalen = descriptors->arr_len;
27092         if (descriptors_constr.datalen > 0)
27093                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27094         else
27095                 descriptors_constr.data = NULL;
27096         uint64_t* descriptors_vals = descriptors->elems;
27097         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27098                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27099                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27100                 CHECK_ACCESS(descriptors_conv_27_ptr);
27101                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27102                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27103                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27104         }
27105         FREE(descriptors);
27106         LDKCVec_TxOutZ outputs_constr;
27107         outputs_constr.datalen = outputs->arr_len;
27108         if (outputs_constr.datalen > 0)
27109                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27110         else
27111                 outputs_constr.data = NULL;
27112         uint64_t* outputs_vals = outputs->elems;
27113         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27114                 uint64_t outputs_conv_7 = outputs_vals[h];
27115                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27116                 CHECK_ACCESS(outputs_conv_7_ptr);
27117                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27118                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27119                 outputs_constr.data[h] = outputs_conv_7_conv;
27120         }
27121         FREE(outputs);
27122         LDKCVec_u8Z change_destination_script_ref;
27123         change_destination_script_ref.datalen = change_destination_script->arr_len;
27124         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27125         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27126         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27127         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27128         return tag_ptr(ret_conv, true);
27129 }
27130
27131 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
27132         LDKKeysManager this_arg_conv;
27133         this_arg_conv.inner = untag_ptr(this_arg);
27134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27136         this_arg_conv.is_owned = false;
27137         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27138         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
27139         return tag_ptr(ret_ret, true);
27140 }
27141
27142 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
27143         LDKKeysManager this_arg_conv;
27144         this_arg_conv.inner = untag_ptr(this_arg);
27145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27147         this_arg_conv.is_owned = false;
27148         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27149         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
27150         return tag_ptr(ret_ret, true);
27151 }
27152
27153 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
27154         LDKKeysManager this_arg_conv;
27155         this_arg_conv.inner = untag_ptr(this_arg);
27156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27158         this_arg_conv.is_owned = false;
27159         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27160         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
27161         return tag_ptr(ret_ret, true);
27162 }
27163
27164 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
27165         LDKPhantomKeysManager this_obj_conv;
27166         this_obj_conv.inner = untag_ptr(this_obj);
27167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27169         PhantomKeysManager_free(this_obj_conv);
27170 }
27171
27172 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
27173         LDKPhantomKeysManager this_arg_conv;
27174         this_arg_conv.inner = untag_ptr(this_arg);
27175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27177         this_arg_conv.is_owned = false;
27178         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27179         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
27180         return tag_ptr(ret_ret, true);
27181 }
27182
27183 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
27184         LDKPhantomKeysManager this_arg_conv;
27185         this_arg_conv.inner = untag_ptr(this_arg);
27186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27188         this_arg_conv.is_owned = false;
27189         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27190         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
27191         return tag_ptr(ret_ret, true);
27192 }
27193
27194 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
27195         LDKPhantomKeysManager this_arg_conv;
27196         this_arg_conv.inner = untag_ptr(this_arg);
27197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27199         this_arg_conv.is_owned = false;
27200         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27201         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
27202         return tag_ptr(ret_ret, true);
27203 }
27204
27205 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) {
27206         uint8_t seed_arr[32];
27207         CHECK(seed->arr_len == 32);
27208         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27209         uint8_t (*seed_ref)[32] = &seed_arr;
27210         uint8_t cross_node_seed_arr[32];
27211         CHECK(cross_node_seed->arr_len == 32);
27212         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
27213         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27214         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27215         uint64_t ret_ref = 0;
27216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27218         return ret_ref;
27219 }
27220
27221 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) {
27222         LDKPhantomKeysManager this_arg_conv;
27223         this_arg_conv.inner = untag_ptr(this_arg);
27224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27226         this_arg_conv.is_owned = false;
27227         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27228         descriptors_constr.datalen = descriptors->arr_len;
27229         if (descriptors_constr.datalen > 0)
27230                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27231         else
27232                 descriptors_constr.data = NULL;
27233         uint64_t* descriptors_vals = descriptors->elems;
27234         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27235                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27236                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27237                 CHECK_ACCESS(descriptors_conv_27_ptr);
27238                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27239                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27240                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27241         }
27242         FREE(descriptors);
27243         LDKCVec_TxOutZ outputs_constr;
27244         outputs_constr.datalen = outputs->arr_len;
27245         if (outputs_constr.datalen > 0)
27246                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27247         else
27248                 outputs_constr.data = NULL;
27249         uint64_t* outputs_vals = outputs->elems;
27250         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27251                 uint64_t outputs_conv_7 = outputs_vals[h];
27252                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27253                 CHECK_ACCESS(outputs_conv_7_ptr);
27254                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27255                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27256                 outputs_constr.data[h] = outputs_conv_7_conv;
27257         }
27258         FREE(outputs);
27259         LDKCVec_u8Z change_destination_script_ref;
27260         change_destination_script_ref.datalen = change_destination_script->arr_len;
27261         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27262         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27263         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27264         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27265         return tag_ptr(ret_conv, true);
27266 }
27267
27268 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) {
27269         LDKPhantomKeysManager this_arg_conv;
27270         this_arg_conv.inner = untag_ptr(this_arg);
27271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27273         this_arg_conv.is_owned = false;
27274         uint8_t params_arr[32];
27275         CHECK(params->arr_len == 32);
27276         memcpy(params_arr, params->elems, 32); FREE(params);
27277         uint8_t (*params_ref)[32] = &params_arr;
27278         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27279         uint64_t ret_ref = 0;
27280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27282         return ret_ref;
27283 }
27284
27285 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
27286         LDKPhantomKeysManager this_arg_conv;
27287         this_arg_conv.inner = untag_ptr(this_arg);
27288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27290         this_arg_conv.is_owned = false;
27291         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27292         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27293         return ret_arr;
27294 }
27295
27296 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
27297         LDKPhantomKeysManager this_arg_conv;
27298         this_arg_conv.inner = untag_ptr(this_arg);
27299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27301         this_arg_conv.is_owned = false;
27302         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27303         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
27304         return ret_arr;
27305 }
27306
27307 uint32_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
27308         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
27309         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_clone(orig_conv));
27310         return ret_conv;
27311 }
27312
27313 uint32_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
27314         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_temporary_node_failure());
27315         return ret_conv;
27316 }
27317
27318 uint32_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
27319         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_required_node_feature_missing());
27320         return ret_conv;
27321 }
27322
27323 uint32_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
27324         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_incorrect_or_unknown_payment_details());
27325         return ret_conv;
27326 }
27327
27328 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
27329         LDKChannelManager this_obj_conv;
27330         this_obj_conv.inner = untag_ptr(this_obj);
27331         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27333         ChannelManager_free(this_obj_conv);
27334 }
27335
27336 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
27337         LDKChainParameters this_obj_conv;
27338         this_obj_conv.inner = untag_ptr(this_obj);
27339         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27341         ChainParameters_free(this_obj_conv);
27342 }
27343
27344 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
27345         LDKChainParameters this_ptr_conv;
27346         this_ptr_conv.inner = untag_ptr(this_ptr);
27347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27349         this_ptr_conv.is_owned = false;
27350         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
27351         return ret_conv;
27352 }
27353
27354 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
27355         LDKChainParameters this_ptr_conv;
27356         this_ptr_conv.inner = untag_ptr(this_ptr);
27357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27359         this_ptr_conv.is_owned = false;
27360         LDKNetwork val_conv = LDKNetwork_from_js(val);
27361         ChainParameters_set_network(&this_ptr_conv, val_conv);
27362 }
27363
27364 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
27365         LDKChainParameters this_ptr_conv;
27366         this_ptr_conv.inner = untag_ptr(this_ptr);
27367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27369         this_ptr_conv.is_owned = false;
27370         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27371         uint64_t ret_ref = 0;
27372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27374         return ret_ref;
27375 }
27376
27377 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
27378         LDKChainParameters this_ptr_conv;
27379         this_ptr_conv.inner = untag_ptr(this_ptr);
27380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27382         this_ptr_conv.is_owned = false;
27383         LDKBestBlock val_conv;
27384         val_conv.inner = untag_ptr(val);
27385         val_conv.is_owned = ptr_is_owned(val);
27386         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27387         val_conv = BestBlock_clone(&val_conv);
27388         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27389 }
27390
27391 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
27392         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
27393         LDKBestBlock best_block_arg_conv;
27394         best_block_arg_conv.inner = untag_ptr(best_block_arg);
27395         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
27396         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27397         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27398         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27399         uint64_t ret_ref = 0;
27400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27402         return ret_ref;
27403 }
27404
27405 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27406         LDKChainParameters ret_var = ChainParameters_clone(arg);
27407         uint64_t ret_ref = 0;
27408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27410         return ret_ref;
27411 }
27412 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
27413         LDKChainParameters arg_conv;
27414         arg_conv.inner = untag_ptr(arg);
27415         arg_conv.is_owned = ptr_is_owned(arg);
27416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27417         arg_conv.is_owned = false;
27418         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
27419         return ret_conv;
27420 }
27421
27422 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
27423         LDKChainParameters orig_conv;
27424         orig_conv.inner = untag_ptr(orig);
27425         orig_conv.is_owned = ptr_is_owned(orig);
27426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27427         orig_conv.is_owned = false;
27428         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27429         uint64_t ret_ref = 0;
27430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27432         return ret_ref;
27433 }
27434
27435 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
27436         LDKCounterpartyForwardingInfo this_obj_conv;
27437         this_obj_conv.inner = untag_ptr(this_obj);
27438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27440         CounterpartyForwardingInfo_free(this_obj_conv);
27441 }
27442
27443 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
27444         LDKCounterpartyForwardingInfo this_ptr_conv;
27445         this_ptr_conv.inner = untag_ptr(this_ptr);
27446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27448         this_ptr_conv.is_owned = false;
27449         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27450         return ret_conv;
27451 }
27452
27453 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
27454         LDKCounterpartyForwardingInfo this_ptr_conv;
27455         this_ptr_conv.inner = untag_ptr(this_ptr);
27456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27458         this_ptr_conv.is_owned = false;
27459         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27460 }
27461
27462 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
27463         LDKCounterpartyForwardingInfo this_ptr_conv;
27464         this_ptr_conv.inner = untag_ptr(this_ptr);
27465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27467         this_ptr_conv.is_owned = false;
27468         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27469         return ret_conv;
27470 }
27471
27472 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
27473         LDKCounterpartyForwardingInfo this_ptr_conv;
27474         this_ptr_conv.inner = untag_ptr(this_ptr);
27475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27477         this_ptr_conv.is_owned = false;
27478         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27479 }
27480
27481 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
27482         LDKCounterpartyForwardingInfo this_ptr_conv;
27483         this_ptr_conv.inner = untag_ptr(this_ptr);
27484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27486         this_ptr_conv.is_owned = false;
27487         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27488         return ret_conv;
27489 }
27490
27491 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
27492         LDKCounterpartyForwardingInfo this_ptr_conv;
27493         this_ptr_conv.inner = untag_ptr(this_ptr);
27494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27496         this_ptr_conv.is_owned = false;
27497         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27498 }
27499
27500 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) {
27501         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27502         uint64_t ret_ref = 0;
27503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27505         return ret_ref;
27506 }
27507
27508 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27509         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27510         uint64_t ret_ref = 0;
27511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27513         return ret_ref;
27514 }
27515 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
27516         LDKCounterpartyForwardingInfo arg_conv;
27517         arg_conv.inner = untag_ptr(arg);
27518         arg_conv.is_owned = ptr_is_owned(arg);
27519         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27520         arg_conv.is_owned = false;
27521         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27522         return ret_conv;
27523 }
27524
27525 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
27526         LDKCounterpartyForwardingInfo orig_conv;
27527         orig_conv.inner = untag_ptr(orig);
27528         orig_conv.is_owned = ptr_is_owned(orig);
27529         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27530         orig_conv.is_owned = false;
27531         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27532         uint64_t ret_ref = 0;
27533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27535         return ret_ref;
27536 }
27537
27538 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
27539         LDKChannelCounterparty this_obj_conv;
27540         this_obj_conv.inner = untag_ptr(this_obj);
27541         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27543         ChannelCounterparty_free(this_obj_conv);
27544 }
27545
27546 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
27547         LDKChannelCounterparty this_ptr_conv;
27548         this_ptr_conv.inner = untag_ptr(this_ptr);
27549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27551         this_ptr_conv.is_owned = false;
27552         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27553         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
27554         return ret_arr;
27555 }
27556
27557 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
27558         LDKChannelCounterparty this_ptr_conv;
27559         this_ptr_conv.inner = untag_ptr(this_ptr);
27560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27562         this_ptr_conv.is_owned = false;
27563         LDKPublicKey val_ref;
27564         CHECK(val->arr_len == 33);
27565         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27566         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27567 }
27568
27569 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
27570         LDKChannelCounterparty this_ptr_conv;
27571         this_ptr_conv.inner = untag_ptr(this_ptr);
27572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27574         this_ptr_conv.is_owned = false;
27575         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27576         uint64_t ret_ref = 0;
27577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27579         return ret_ref;
27580 }
27581
27582 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
27583         LDKChannelCounterparty this_ptr_conv;
27584         this_ptr_conv.inner = untag_ptr(this_ptr);
27585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27587         this_ptr_conv.is_owned = false;
27588         LDKInitFeatures val_conv;
27589         val_conv.inner = untag_ptr(val);
27590         val_conv.is_owned = ptr_is_owned(val);
27591         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27592         val_conv = InitFeatures_clone(&val_conv);
27593         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27594 }
27595
27596 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27597         LDKChannelCounterparty this_ptr_conv;
27598         this_ptr_conv.inner = untag_ptr(this_ptr);
27599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27601         this_ptr_conv.is_owned = false;
27602         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27603         return ret_conv;
27604 }
27605
27606 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
27607         LDKChannelCounterparty this_ptr_conv;
27608         this_ptr_conv.inner = untag_ptr(this_ptr);
27609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27611         this_ptr_conv.is_owned = false;
27612         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27613 }
27614
27615 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
27616         LDKChannelCounterparty this_ptr_conv;
27617         this_ptr_conv.inner = untag_ptr(this_ptr);
27618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27620         this_ptr_conv.is_owned = false;
27621         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27622         uint64_t ret_ref = 0;
27623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27625         return ret_ref;
27626 }
27627
27628 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
27629         LDKChannelCounterparty this_ptr_conv;
27630         this_ptr_conv.inner = untag_ptr(this_ptr);
27631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27633         this_ptr_conv.is_owned = false;
27634         LDKCounterpartyForwardingInfo val_conv;
27635         val_conv.inner = untag_ptr(val);
27636         val_conv.is_owned = ptr_is_owned(val);
27637         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27638         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27639         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27640 }
27641
27642 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
27643         LDKChannelCounterparty this_ptr_conv;
27644         this_ptr_conv.inner = untag_ptr(this_ptr);
27645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27647         this_ptr_conv.is_owned = false;
27648         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27649         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
27650         uint64_t ret_ref = tag_ptr(ret_copy, true);
27651         return ret_ref;
27652 }
27653
27654 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) {
27655         LDKChannelCounterparty this_ptr_conv;
27656         this_ptr_conv.inner = untag_ptr(this_ptr);
27657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27659         this_ptr_conv.is_owned = false;
27660         void* val_ptr = untag_ptr(val);
27661         CHECK_ACCESS(val_ptr);
27662         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27663         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27664         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27665 }
27666
27667 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
27668         LDKChannelCounterparty this_ptr_conv;
27669         this_ptr_conv.inner = untag_ptr(this_ptr);
27670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27672         this_ptr_conv.is_owned = false;
27673         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27674         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
27675         uint64_t ret_ref = tag_ptr(ret_copy, true);
27676         return ret_ref;
27677 }
27678
27679 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) {
27680         LDKChannelCounterparty this_ptr_conv;
27681         this_ptr_conv.inner = untag_ptr(this_ptr);
27682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27684         this_ptr_conv.is_owned = false;
27685         void* val_ptr = untag_ptr(val);
27686         CHECK_ACCESS(val_ptr);
27687         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27688         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27689         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27690 }
27691
27692 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) {
27693         LDKPublicKey node_id_arg_ref;
27694         CHECK(node_id_arg->arr_len == 33);
27695         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
27696         LDKInitFeatures features_arg_conv;
27697         features_arg_conv.inner = untag_ptr(features_arg);
27698         features_arg_conv.is_owned = ptr_is_owned(features_arg);
27699         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27700         features_arg_conv = InitFeatures_clone(&features_arg_conv);
27701         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27702         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
27703         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
27704         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27705         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27706         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
27707         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
27708         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
27709         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
27710         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
27711         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
27712         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
27713         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
27714         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);
27715         uint64_t ret_ref = 0;
27716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27718         return ret_ref;
27719 }
27720
27721 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27722         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
27723         uint64_t ret_ref = 0;
27724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27726         return ret_ref;
27727 }
27728 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
27729         LDKChannelCounterparty arg_conv;
27730         arg_conv.inner = untag_ptr(arg);
27731         arg_conv.is_owned = ptr_is_owned(arg);
27732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27733         arg_conv.is_owned = false;
27734         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
27735         return ret_conv;
27736 }
27737
27738 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
27739         LDKChannelCounterparty orig_conv;
27740         orig_conv.inner = untag_ptr(orig);
27741         orig_conv.is_owned = ptr_is_owned(orig);
27742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27743         orig_conv.is_owned = false;
27744         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27745         uint64_t ret_ref = 0;
27746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27748         return ret_ref;
27749 }
27750
27751 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
27752         LDKChannelDetails this_obj_conv;
27753         this_obj_conv.inner = untag_ptr(this_obj);
27754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27756         ChannelDetails_free(this_obj_conv);
27757 }
27758
27759 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
27760         LDKChannelDetails this_ptr_conv;
27761         this_ptr_conv.inner = untag_ptr(this_ptr);
27762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27764         this_ptr_conv.is_owned = false;
27765         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27766         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
27767         return ret_arr;
27768 }
27769
27770 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27771         LDKChannelDetails this_ptr_conv;
27772         this_ptr_conv.inner = untag_ptr(this_ptr);
27773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27775         this_ptr_conv.is_owned = false;
27776         LDKThirtyTwoBytes val_ref;
27777         CHECK(val->arr_len == 32);
27778         memcpy(val_ref.data, val->elems, 32); FREE(val);
27779         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27780 }
27781
27782 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
27783         LDKChannelDetails this_ptr_conv;
27784         this_ptr_conv.inner = untag_ptr(this_ptr);
27785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27787         this_ptr_conv.is_owned = false;
27788         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27789         uint64_t ret_ref = 0;
27790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27792         return ret_ref;
27793 }
27794
27795 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
27796         LDKChannelDetails this_ptr_conv;
27797         this_ptr_conv.inner = untag_ptr(this_ptr);
27798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27800         this_ptr_conv.is_owned = false;
27801         LDKChannelCounterparty val_conv;
27802         val_conv.inner = untag_ptr(val);
27803         val_conv.is_owned = ptr_is_owned(val);
27804         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27805         val_conv = ChannelCounterparty_clone(&val_conv);
27806         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27807 }
27808
27809 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
27810         LDKChannelDetails this_ptr_conv;
27811         this_ptr_conv.inner = untag_ptr(this_ptr);
27812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27814         this_ptr_conv.is_owned = false;
27815         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27816         uint64_t ret_ref = 0;
27817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27819         return ret_ref;
27820 }
27821
27822 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
27823         LDKChannelDetails this_ptr_conv;
27824         this_ptr_conv.inner = untag_ptr(this_ptr);
27825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27827         this_ptr_conv.is_owned = false;
27828         LDKOutPoint val_conv;
27829         val_conv.inner = untag_ptr(val);
27830         val_conv.is_owned = ptr_is_owned(val);
27831         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27832         val_conv = OutPoint_clone(&val_conv);
27833         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27834 }
27835
27836 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
27837         LDKChannelDetails this_ptr_conv;
27838         this_ptr_conv.inner = untag_ptr(this_ptr);
27839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27841         this_ptr_conv.is_owned = false;
27842         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
27843         uint64_t ret_ref = 0;
27844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27846         return ret_ref;
27847 }
27848
27849 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
27850         LDKChannelDetails this_ptr_conv;
27851         this_ptr_conv.inner = untag_ptr(this_ptr);
27852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27854         this_ptr_conv.is_owned = false;
27855         LDKChannelTypeFeatures val_conv;
27856         val_conv.inner = untag_ptr(val);
27857         val_conv.is_owned = ptr_is_owned(val);
27858         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27859         val_conv = ChannelTypeFeatures_clone(&val_conv);
27860         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
27861 }
27862
27863 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
27864         LDKChannelDetails this_ptr_conv;
27865         this_ptr_conv.inner = untag_ptr(this_ptr);
27866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27868         this_ptr_conv.is_owned = false;
27869         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27870         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
27871         uint64_t ret_ref = tag_ptr(ret_copy, true);
27872         return ret_ref;
27873 }
27874
27875 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
27876         LDKChannelDetails this_ptr_conv;
27877         this_ptr_conv.inner = untag_ptr(this_ptr);
27878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27880         this_ptr_conv.is_owned = false;
27881         void* val_ptr = untag_ptr(val);
27882         CHECK_ACCESS(val_ptr);
27883         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27884         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27885         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
27886 }
27887
27888 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
27889         LDKChannelDetails this_ptr_conv;
27890         this_ptr_conv.inner = untag_ptr(this_ptr);
27891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27893         this_ptr_conv.is_owned = false;
27894         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27895         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
27896         uint64_t ret_ref = tag_ptr(ret_copy, true);
27897         return ret_ref;
27898 }
27899
27900 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27901         LDKChannelDetails this_ptr_conv;
27902         this_ptr_conv.inner = untag_ptr(this_ptr);
27903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27905         this_ptr_conv.is_owned = false;
27906         void* val_ptr = untag_ptr(val);
27907         CHECK_ACCESS(val_ptr);
27908         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27909         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27910         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
27911 }
27912
27913 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
27914         LDKChannelDetails this_ptr_conv;
27915         this_ptr_conv.inner = untag_ptr(this_ptr);
27916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27918         this_ptr_conv.is_owned = false;
27919         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27920         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
27921         uint64_t ret_ref = tag_ptr(ret_copy, true);
27922         return ret_ref;
27923 }
27924
27925 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27926         LDKChannelDetails this_ptr_conv;
27927         this_ptr_conv.inner = untag_ptr(this_ptr);
27928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27930         this_ptr_conv.is_owned = false;
27931         void* val_ptr = untag_ptr(val);
27932         CHECK_ACCESS(val_ptr);
27933         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27934         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27935         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
27936 }
27937
27938 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
27939         LDKChannelDetails this_ptr_conv;
27940         this_ptr_conv.inner = untag_ptr(this_ptr);
27941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27943         this_ptr_conv.is_owned = false;
27944         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
27945         return ret_conv;
27946 }
27947
27948 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
27949         LDKChannelDetails this_ptr_conv;
27950         this_ptr_conv.inner = untag_ptr(this_ptr);
27951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27953         this_ptr_conv.is_owned = false;
27954         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
27955 }
27956
27957 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27958         LDKChannelDetails this_ptr_conv;
27959         this_ptr_conv.inner = untag_ptr(this_ptr);
27960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27962         this_ptr_conv.is_owned = false;
27963         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27964         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
27965         uint64_t ret_ref = tag_ptr(ret_copy, true);
27966         return ret_ref;
27967 }
27968
27969 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
27970         LDKChannelDetails this_ptr_conv;
27971         this_ptr_conv.inner = untag_ptr(this_ptr);
27972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27974         this_ptr_conv.is_owned = false;
27975         void* val_ptr = untag_ptr(val);
27976         CHECK_ACCESS(val_ptr);
27977         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27978         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27979         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
27980 }
27981
27982 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
27983         LDKChannelDetails this_ptr_conv;
27984         this_ptr_conv.inner = untag_ptr(this_ptr);
27985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27987         this_ptr_conv.is_owned = false;
27988         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
27989         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
27990         return ret_arr;
27991 }
27992
27993 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
27994         LDKChannelDetails this_ptr_conv;
27995         this_ptr_conv.inner = untag_ptr(this_ptr);
27996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27998         this_ptr_conv.is_owned = false;
27999         LDKU128 val_ref;
28000         CHECK(val->arr_len == 16);
28001         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
28002         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
28003 }
28004
28005 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) {
28006         LDKChannelDetails this_ptr_conv;
28007         this_ptr_conv.inner = untag_ptr(this_ptr);
28008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28010         this_ptr_conv.is_owned = false;
28011         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28012         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
28013         uint64_t ret_ref = tag_ptr(ret_copy, true);
28014         return ret_ref;
28015 }
28016
28017 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) {
28018         LDKChannelDetails this_ptr_conv;
28019         this_ptr_conv.inner = untag_ptr(this_ptr);
28020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28022         this_ptr_conv.is_owned = false;
28023         void* val_ptr = untag_ptr(val);
28024         CHECK_ACCESS(val_ptr);
28025         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28026         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28027         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
28028 }
28029
28030 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
28031         LDKChannelDetails this_ptr_conv;
28032         this_ptr_conv.inner = untag_ptr(this_ptr);
28033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28035         this_ptr_conv.is_owned = false;
28036         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28037         return ret_conv;
28038 }
28039
28040 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
28041         LDKChannelDetails this_ptr_conv;
28042         this_ptr_conv.inner = untag_ptr(this_ptr);
28043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28045         this_ptr_conv.is_owned = false;
28046         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28047 }
28048
28049 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
28050         LDKChannelDetails this_ptr_conv;
28051         this_ptr_conv.inner = untag_ptr(this_ptr);
28052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28054         this_ptr_conv.is_owned = false;
28055         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28056         return ret_conv;
28057 }
28058
28059 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28060         LDKChannelDetails this_ptr_conv;
28061         this_ptr_conv.inner = untag_ptr(this_ptr);
28062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28064         this_ptr_conv.is_owned = false;
28065         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28066 }
28067
28068 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) {
28069         LDKChannelDetails this_ptr_conv;
28070         this_ptr_conv.inner = untag_ptr(this_ptr);
28071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28073         this_ptr_conv.is_owned = false;
28074         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
28075         return ret_conv;
28076 }
28077
28078 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) {
28079         LDKChannelDetails this_ptr_conv;
28080         this_ptr_conv.inner = untag_ptr(this_ptr);
28081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28083         this_ptr_conv.is_owned = false;
28084         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
28085 }
28086
28087 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
28088         LDKChannelDetails this_ptr_conv;
28089         this_ptr_conv.inner = untag_ptr(this_ptr);
28090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28092         this_ptr_conv.is_owned = false;
28093         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28094         return ret_conv;
28095 }
28096
28097 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28098         LDKChannelDetails this_ptr_conv;
28099         this_ptr_conv.inner = untag_ptr(this_ptr);
28100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28102         this_ptr_conv.is_owned = false;
28103         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28104 }
28105
28106 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
28107         LDKChannelDetails this_ptr_conv;
28108         this_ptr_conv.inner = untag_ptr(this_ptr);
28109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28111         this_ptr_conv.is_owned = false;
28112         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28113         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28114         uint64_t ret_ref = tag_ptr(ret_copy, true);
28115         return ret_ref;
28116 }
28117
28118 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
28119         LDKChannelDetails this_ptr_conv;
28120         this_ptr_conv.inner = untag_ptr(this_ptr);
28121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28123         this_ptr_conv.is_owned = false;
28124         void* val_ptr = untag_ptr(val);
28125         CHECK_ACCESS(val_ptr);
28126         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28127         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28128         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28129 }
28130
28131 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
28132         LDKChannelDetails this_ptr_conv;
28133         this_ptr_conv.inner = untag_ptr(this_ptr);
28134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28136         this_ptr_conv.is_owned = false;
28137         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28138         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
28139         uint64_t ret_ref = tag_ptr(ret_copy, true);
28140         return ret_ref;
28141 }
28142
28143 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
28144         LDKChannelDetails this_ptr_conv;
28145         this_ptr_conv.inner = untag_ptr(this_ptr);
28146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28148         this_ptr_conv.is_owned = false;
28149         void* val_ptr = untag_ptr(val);
28150         CHECK_ACCESS(val_ptr);
28151         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28152         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28153         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
28154 }
28155
28156 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
28157         LDKChannelDetails this_ptr_conv;
28158         this_ptr_conv.inner = untag_ptr(this_ptr);
28159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28161         this_ptr_conv.is_owned = false;
28162         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28163         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28164         uint64_t ret_ref = tag_ptr(ret_copy, true);
28165         return ret_ref;
28166 }
28167
28168 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) {
28169         LDKChannelDetails this_ptr_conv;
28170         this_ptr_conv.inner = untag_ptr(this_ptr);
28171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28173         this_ptr_conv.is_owned = false;
28174         void* val_ptr = untag_ptr(val);
28175         CHECK_ACCESS(val_ptr);
28176         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28177         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
28178         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28179 }
28180
28181 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
28182         LDKChannelDetails this_ptr_conv;
28183         this_ptr_conv.inner = untag_ptr(this_ptr);
28184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28186         this_ptr_conv.is_owned = false;
28187         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28188         return ret_conv;
28189 }
28190
28191 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
28192         LDKChannelDetails this_ptr_conv;
28193         this_ptr_conv.inner = untag_ptr(this_ptr);
28194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28196         this_ptr_conv.is_owned = false;
28197         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28198 }
28199
28200 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
28201         LDKChannelDetails this_ptr_conv;
28202         this_ptr_conv.inner = untag_ptr(this_ptr);
28203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28205         this_ptr_conv.is_owned = false;
28206         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
28207         return ret_conv;
28208 }
28209
28210 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
28211         LDKChannelDetails this_ptr_conv;
28212         this_ptr_conv.inner = untag_ptr(this_ptr);
28213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28215         this_ptr_conv.is_owned = false;
28216         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
28217 }
28218
28219 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
28220         LDKChannelDetails this_ptr_conv;
28221         this_ptr_conv.inner = untag_ptr(this_ptr);
28222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28224         this_ptr_conv.is_owned = false;
28225         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28226         return ret_conv;
28227 }
28228
28229 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
28230         LDKChannelDetails this_ptr_conv;
28231         this_ptr_conv.inner = untag_ptr(this_ptr);
28232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28234         this_ptr_conv.is_owned = false;
28235         ChannelDetails_set_is_usable(&this_ptr_conv, val);
28236 }
28237
28238 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
28239         LDKChannelDetails this_ptr_conv;
28240         this_ptr_conv.inner = untag_ptr(this_ptr);
28241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28243         this_ptr_conv.is_owned = false;
28244         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
28245         return ret_conv;
28246 }
28247
28248 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
28249         LDKChannelDetails this_ptr_conv;
28250         this_ptr_conv.inner = untag_ptr(this_ptr);
28251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28253         this_ptr_conv.is_owned = false;
28254         ChannelDetails_set_is_public(&this_ptr_conv, val);
28255 }
28256
28257 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
28258         LDKChannelDetails this_ptr_conv;
28259         this_ptr_conv.inner = untag_ptr(this_ptr);
28260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28262         this_ptr_conv.is_owned = false;
28263         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28264         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
28265         uint64_t ret_ref = tag_ptr(ret_copy, true);
28266         return ret_ref;
28267 }
28268
28269 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) {
28270         LDKChannelDetails this_ptr_conv;
28271         this_ptr_conv.inner = untag_ptr(this_ptr);
28272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28274         this_ptr_conv.is_owned = false;
28275         void* val_ptr = untag_ptr(val);
28276         CHECK_ACCESS(val_ptr);
28277         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28278         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28279         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28280 }
28281
28282 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
28283         LDKChannelDetails this_ptr_conv;
28284         this_ptr_conv.inner = untag_ptr(this_ptr);
28285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28287         this_ptr_conv.is_owned = false;
28288         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28289         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
28290         uint64_t ret_ref = tag_ptr(ret_copy, true);
28291         return ret_ref;
28292 }
28293
28294 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) {
28295         LDKChannelDetails this_ptr_conv;
28296         this_ptr_conv.inner = untag_ptr(this_ptr);
28297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28299         this_ptr_conv.is_owned = false;
28300         void* val_ptr = untag_ptr(val);
28301         CHECK_ACCESS(val_ptr);
28302         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28303         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28304         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28305 }
28306
28307 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
28308         LDKChannelDetails this_ptr_conv;
28309         this_ptr_conv.inner = untag_ptr(this_ptr);
28310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28312         this_ptr_conv.is_owned = false;
28313         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
28314         uint64_t ret_ref = 0;
28315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28317         return ret_ref;
28318 }
28319
28320 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
28321         LDKChannelDetails this_ptr_conv;
28322         this_ptr_conv.inner = untag_ptr(this_ptr);
28323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28325         this_ptr_conv.is_owned = false;
28326         LDKChannelConfig val_conv;
28327         val_conv.inner = untag_ptr(val);
28328         val_conv.is_owned = ptr_is_owned(val);
28329         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28330         val_conv = ChannelConfig_clone(&val_conv);
28331         ChannelDetails_set_config(&this_ptr_conv, val_conv);
28332 }
28333
28334 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) {
28335         LDKThirtyTwoBytes channel_id_arg_ref;
28336         CHECK(channel_id_arg->arr_len == 32);
28337         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28338         LDKChannelCounterparty counterparty_arg_conv;
28339         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
28340         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
28341         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28342         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28343         LDKOutPoint funding_txo_arg_conv;
28344         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
28345         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
28346         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28347         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28348         LDKChannelTypeFeatures channel_type_arg_conv;
28349         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
28350         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
28351         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
28352         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
28353         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
28354         CHECK_ACCESS(short_channel_id_arg_ptr);
28355         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28356         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
28357         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
28358         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
28359         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
28360         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
28361         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
28362         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
28363         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
28364         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
28365         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
28366         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28367         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28368         LDKU128 user_channel_id_arg_ref;
28369         CHECK(user_channel_id_arg->arr_len == 16);
28370         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
28371         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
28372         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
28373         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
28374         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
28375         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
28376         CHECK_ACCESS(confirmations_required_arg_ptr);
28377         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28378         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
28379         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
28380         CHECK_ACCESS(confirmations_arg_ptr);
28381         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
28382         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
28383         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
28384         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28385         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28386         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
28387         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
28388         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
28389         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
28390         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
28391         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
28392         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
28393         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
28394         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
28395         LDKChannelConfig config_arg_conv;
28396         config_arg_conv.inner = untag_ptr(config_arg);
28397         config_arg_conv.is_owned = ptr_is_owned(config_arg);
28398         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
28399         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
28400         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);
28401         uint64_t ret_ref = 0;
28402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28404         return ret_ref;
28405 }
28406
28407 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28408         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28409         uint64_t ret_ref = 0;
28410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28412         return ret_ref;
28413 }
28414 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
28415         LDKChannelDetails arg_conv;
28416         arg_conv.inner = untag_ptr(arg);
28417         arg_conv.is_owned = ptr_is_owned(arg);
28418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28419         arg_conv.is_owned = false;
28420         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28421         return ret_conv;
28422 }
28423
28424 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
28425         LDKChannelDetails orig_conv;
28426         orig_conv.inner = untag_ptr(orig);
28427         orig_conv.is_owned = ptr_is_owned(orig);
28428         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28429         orig_conv.is_owned = false;
28430         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28431         uint64_t ret_ref = 0;
28432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28434         return ret_ref;
28435 }
28436
28437 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
28438         LDKChannelDetails this_arg_conv;
28439         this_arg_conv.inner = untag_ptr(this_arg);
28440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28442         this_arg_conv.is_owned = false;
28443         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28444         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28445         uint64_t ret_ref = tag_ptr(ret_copy, true);
28446         return ret_ref;
28447 }
28448
28449 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
28450         LDKChannelDetails this_arg_conv;
28451         this_arg_conv.inner = untag_ptr(this_arg);
28452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28454         this_arg_conv.is_owned = false;
28455         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28456         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
28457         uint64_t ret_ref = tag_ptr(ret_copy, true);
28458         return ret_ref;
28459 }
28460
28461 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
28462         if (!ptr_is_owned(this_ptr)) return;
28463         void* this_ptr_ptr = untag_ptr(this_ptr);
28464         CHECK_ACCESS(this_ptr_ptr);
28465         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
28466         FREE(untag_ptr(this_ptr));
28467         RecentPaymentDetails_free(this_ptr_conv);
28468 }
28469
28470 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
28471         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28472         *ret_copy = RecentPaymentDetails_clone(arg);
28473         uint64_t ret_ref = tag_ptr(ret_copy, true);
28474         return ret_ref;
28475 }
28476 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
28477         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
28478         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
28479         return ret_conv;
28480 }
28481
28482 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
28483         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
28484         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28485         *ret_copy = RecentPaymentDetails_clone(orig_conv);
28486         uint64_t ret_ref = tag_ptr(ret_copy, true);
28487         return ret_ref;
28488 }
28489
28490 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_hash, int64_t total_msat) {
28491         LDKThirtyTwoBytes payment_hash_ref;
28492         CHECK(payment_hash->arr_len == 32);
28493         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28494         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28495         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
28496         uint64_t ret_ref = tag_ptr(ret_copy, true);
28497         return ret_ref;
28498 }
28499
28500 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_hash) {
28501         LDKThirtyTwoBytes payment_hash_ref;
28502         CHECK(payment_hash->arr_len == 32);
28503         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28504         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28505         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref);
28506         uint64_t ret_ref = tag_ptr(ret_copy, true);
28507         return ret_ref;
28508 }
28509
28510 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_hash) {
28511         LDKThirtyTwoBytes payment_hash_ref;
28512         CHECK(payment_hash->arr_len == 32);
28513         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28514         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28515         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
28516         uint64_t ret_ref = tag_ptr(ret_copy, true);
28517         return ret_ref;
28518 }
28519
28520 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
28521         LDKPhantomRouteHints this_obj_conv;
28522         this_obj_conv.inner = untag_ptr(this_obj);
28523         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28525         PhantomRouteHints_free(this_obj_conv);
28526 }
28527
28528 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
28529         LDKPhantomRouteHints this_ptr_conv;
28530         this_ptr_conv.inner = untag_ptr(this_ptr);
28531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28533         this_ptr_conv.is_owned = false;
28534         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28535         uint64_tArray ret_arr = NULL;
28536         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28537         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28538         for (size_t q = 0; q < ret_var.datalen; q++) {
28539                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28540                 uint64_t ret_conv_16_ref = 0;
28541                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28542                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28543                 ret_arr_ptr[q] = ret_conv_16_ref;
28544         }
28545         
28546         FREE(ret_var.data);
28547         return ret_arr;
28548 }
28549
28550 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
28551         LDKPhantomRouteHints this_ptr_conv;
28552         this_ptr_conv.inner = untag_ptr(this_ptr);
28553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28555         this_ptr_conv.is_owned = false;
28556         LDKCVec_ChannelDetailsZ val_constr;
28557         val_constr.datalen = val->arr_len;
28558         if (val_constr.datalen > 0)
28559                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28560         else
28561                 val_constr.data = NULL;
28562         uint64_t* val_vals = val->elems;
28563         for (size_t q = 0; q < val_constr.datalen; q++) {
28564                 uint64_t val_conv_16 = val_vals[q];
28565                 LDKChannelDetails val_conv_16_conv;
28566                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
28567                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
28568                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28569                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28570                 val_constr.data[q] = val_conv_16_conv;
28571         }
28572         FREE(val);
28573         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28574 }
28575
28576 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
28577         LDKPhantomRouteHints this_ptr_conv;
28578         this_ptr_conv.inner = untag_ptr(this_ptr);
28579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28581         this_ptr_conv.is_owned = false;
28582         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28583         return ret_conv;
28584 }
28585
28586 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
28587         LDKPhantomRouteHints this_ptr_conv;
28588         this_ptr_conv.inner = untag_ptr(this_ptr);
28589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28591         this_ptr_conv.is_owned = false;
28592         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28593 }
28594
28595 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
28596         LDKPhantomRouteHints this_ptr_conv;
28597         this_ptr_conv.inner = untag_ptr(this_ptr);
28598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28600         this_ptr_conv.is_owned = false;
28601         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28602         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
28603         return ret_arr;
28604 }
28605
28606 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
28607         LDKPhantomRouteHints this_ptr_conv;
28608         this_ptr_conv.inner = untag_ptr(this_ptr);
28609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28611         this_ptr_conv.is_owned = false;
28612         LDKPublicKey val_ref;
28613         CHECK(val->arr_len == 33);
28614         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28615         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28616 }
28617
28618 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) {
28619         LDKCVec_ChannelDetailsZ channels_arg_constr;
28620         channels_arg_constr.datalen = channels_arg->arr_len;
28621         if (channels_arg_constr.datalen > 0)
28622                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28623         else
28624                 channels_arg_constr.data = NULL;
28625         uint64_t* channels_arg_vals = channels_arg->elems;
28626         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28627                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
28628                 LDKChannelDetails channels_arg_conv_16_conv;
28629                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
28630                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
28631                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28632                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28633                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28634         }
28635         FREE(channels_arg);
28636         LDKPublicKey real_node_pubkey_arg_ref;
28637         CHECK(real_node_pubkey_arg->arr_len == 33);
28638         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
28639         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28640         uint64_t ret_ref = 0;
28641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28643         return ret_ref;
28644 }
28645
28646 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28647         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28648         uint64_t ret_ref = 0;
28649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28651         return ret_ref;
28652 }
28653 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
28654         LDKPhantomRouteHints arg_conv;
28655         arg_conv.inner = untag_ptr(arg);
28656         arg_conv.is_owned = ptr_is_owned(arg);
28657         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28658         arg_conv.is_owned = false;
28659         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
28660         return ret_conv;
28661 }
28662
28663 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
28664         LDKPhantomRouteHints orig_conv;
28665         orig_conv.inner = untag_ptr(orig);
28666         orig_conv.is_owned = ptr_is_owned(orig);
28667         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28668         orig_conv.is_owned = false;
28669         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28670         uint64_t ret_ref = 0;
28671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28673         return ret_ref;
28674 }
28675
28676 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) {
28677         void* fee_est_ptr = untag_ptr(fee_est);
28678         CHECK_ACCESS(fee_est_ptr);
28679         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28680         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28681                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28682                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28683         }
28684         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28685         CHECK_ACCESS(chain_monitor_ptr);
28686         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28687         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28688                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28689                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28690         }
28691         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28692         CHECK_ACCESS(tx_broadcaster_ptr);
28693         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28694         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28695                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28696                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28697         }
28698         void* router_ptr = untag_ptr(router);
28699         CHECK_ACCESS(router_ptr);
28700         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
28701         if (router_conv.free == LDKRouter_JCalls_free) {
28702                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28703                 LDKRouter_JCalls_cloned(&router_conv);
28704         }
28705         void* logger_ptr = untag_ptr(logger);
28706         CHECK_ACCESS(logger_ptr);
28707         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28708         if (logger_conv.free == LDKLogger_JCalls_free) {
28709                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28710                 LDKLogger_JCalls_cloned(&logger_conv);
28711         }
28712         void* entropy_source_ptr = untag_ptr(entropy_source);
28713         CHECK_ACCESS(entropy_source_ptr);
28714         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
28715         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
28716                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28717                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
28718         }
28719         void* node_signer_ptr = untag_ptr(node_signer);
28720         CHECK_ACCESS(node_signer_ptr);
28721         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
28722         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
28723                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28724                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
28725         }
28726         void* signer_provider_ptr = untag_ptr(signer_provider);
28727         CHECK_ACCESS(signer_provider_ptr);
28728         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
28729         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
28730                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28731                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
28732         }
28733         LDKUserConfig config_conv;
28734         config_conv.inner = untag_ptr(config);
28735         config_conv.is_owned = ptr_is_owned(config);
28736         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28737         config_conv = UserConfig_clone(&config_conv);
28738         LDKChainParameters params_conv;
28739         params_conv.inner = untag_ptr(params);
28740         params_conv.is_owned = ptr_is_owned(params);
28741         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28742         params_conv = ChainParameters_clone(&params_conv);
28743         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);
28744         uint64_t ret_ref = 0;
28745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28747         return ret_ref;
28748 }
28749
28750 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
28751         LDKChannelManager this_arg_conv;
28752         this_arg_conv.inner = untag_ptr(this_arg);
28753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28755         this_arg_conv.is_owned = false;
28756         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28757         uint64_t ret_ref = 0;
28758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28760         return ret_ref;
28761 }
28762
28763 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) {
28764         LDKChannelManager this_arg_conv;
28765         this_arg_conv.inner = untag_ptr(this_arg);
28766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28768         this_arg_conv.is_owned = false;
28769         LDKPublicKey their_network_key_ref;
28770         CHECK(their_network_key->arr_len == 33);
28771         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
28772         LDKU128 user_channel_id_ref;
28773         CHECK(user_channel_id->arr_len == 16);
28774         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28775         LDKUserConfig override_config_conv;
28776         override_config_conv.inner = untag_ptr(override_config);
28777         override_config_conv.is_owned = ptr_is_owned(override_config);
28778         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28779         override_config_conv = UserConfig_clone(&override_config_conv);
28780         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28781         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
28782         return tag_ptr(ret_conv, true);
28783 }
28784
28785 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
28786         LDKChannelManager this_arg_conv;
28787         this_arg_conv.inner = untag_ptr(this_arg);
28788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28790         this_arg_conv.is_owned = false;
28791         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28792         uint64_tArray ret_arr = NULL;
28793         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28794         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28795         for (size_t q = 0; q < ret_var.datalen; q++) {
28796                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28797                 uint64_t ret_conv_16_ref = 0;
28798                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28799                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28800                 ret_arr_ptr[q] = ret_conv_16_ref;
28801         }
28802         
28803         FREE(ret_var.data);
28804         return ret_arr;
28805 }
28806
28807 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
28808         LDKChannelManager this_arg_conv;
28809         this_arg_conv.inner = untag_ptr(this_arg);
28810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28812         this_arg_conv.is_owned = false;
28813         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28814         uint64_tArray ret_arr = NULL;
28815         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28816         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28817         for (size_t q = 0; q < ret_var.datalen; q++) {
28818                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28819                 uint64_t ret_conv_16_ref = 0;
28820                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28821                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28822                 ret_arr_ptr[q] = ret_conv_16_ref;
28823         }
28824         
28825         FREE(ret_var.data);
28826         return ret_arr;
28827 }
28828
28829 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) {
28830         LDKChannelManager this_arg_conv;
28831         this_arg_conv.inner = untag_ptr(this_arg);
28832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28834         this_arg_conv.is_owned = false;
28835         LDKPublicKey counterparty_node_id_ref;
28836         CHECK(counterparty_node_id->arr_len == 33);
28837         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28838         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
28839         uint64_tArray ret_arr = NULL;
28840         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28841         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28842         for (size_t q = 0; q < ret_var.datalen; q++) {
28843                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28844                 uint64_t ret_conv_16_ref = 0;
28845                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28846                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28847                 ret_arr_ptr[q] = ret_conv_16_ref;
28848         }
28849         
28850         FREE(ret_var.data);
28851         return ret_arr;
28852 }
28853
28854 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
28855         LDKChannelManager this_arg_conv;
28856         this_arg_conv.inner = untag_ptr(this_arg);
28857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28859         this_arg_conv.is_owned = false;
28860         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
28861         uint64_tArray ret_arr = NULL;
28862         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28863         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28864         for (size_t w = 0; w < ret_var.datalen; w++) {
28865                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28866                 *ret_conv_22_copy = ret_var.data[w];
28867                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
28868                 ret_arr_ptr[w] = ret_conv_22_ref;
28869         }
28870         
28871         FREE(ret_var.data);
28872         return ret_arr;
28873 }
28874
28875 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) {
28876         LDKChannelManager this_arg_conv;
28877         this_arg_conv.inner = untag_ptr(this_arg);
28878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28880         this_arg_conv.is_owned = false;
28881         uint8_t channel_id_arr[32];
28882         CHECK(channel_id->arr_len == 32);
28883         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28884         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28885         LDKPublicKey counterparty_node_id_ref;
28886         CHECK(counterparty_node_id->arr_len == 33);
28887         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28888         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28889         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28890         return tag_ptr(ret_conv, true);
28891 }
28892
28893 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) {
28894         LDKChannelManager this_arg_conv;
28895         this_arg_conv.inner = untag_ptr(this_arg);
28896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28898         this_arg_conv.is_owned = false;
28899         uint8_t channel_id_arr[32];
28900         CHECK(channel_id->arr_len == 32);
28901         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28902         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28903         LDKPublicKey counterparty_node_id_ref;
28904         CHECK(counterparty_node_id->arr_len == 33);
28905         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28906         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28907         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
28908         return tag_ptr(ret_conv, true);
28909 }
28910
28911 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) {
28912         LDKChannelManager this_arg_conv;
28913         this_arg_conv.inner = untag_ptr(this_arg);
28914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28916         this_arg_conv.is_owned = false;
28917         uint8_t channel_id_arr[32];
28918         CHECK(channel_id->arr_len == 32);
28919         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28920         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28921         LDKPublicKey counterparty_node_id_ref;
28922         CHECK(counterparty_node_id->arr_len == 33);
28923         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28924         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28925         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28926         return tag_ptr(ret_conv, true);
28927 }
28928
28929 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) {
28930         LDKChannelManager this_arg_conv;
28931         this_arg_conv.inner = untag_ptr(this_arg);
28932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28934         this_arg_conv.is_owned = false;
28935         uint8_t channel_id_arr[32];
28936         CHECK(channel_id->arr_len == 32);
28937         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28938         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28939         LDKPublicKey counterparty_node_id_ref;
28940         CHECK(counterparty_node_id->arr_len == 33);
28941         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28942         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28943         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28944         return tag_ptr(ret_conv, true);
28945 }
28946
28947 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) {
28948         LDKChannelManager this_arg_conv;
28949         this_arg_conv.inner = untag_ptr(this_arg);
28950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28952         this_arg_conv.is_owned = false;
28953         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
28954 }
28955
28956 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) {
28957         LDKChannelManager this_arg_conv;
28958         this_arg_conv.inner = untag_ptr(this_arg);
28959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28961         this_arg_conv.is_owned = false;
28962         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
28963 }
28964
28965 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) {
28966         LDKChannelManager this_arg_conv;
28967         this_arg_conv.inner = untag_ptr(this_arg);
28968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28970         this_arg_conv.is_owned = false;
28971         LDKRoute route_conv;
28972         route_conv.inner = untag_ptr(route);
28973         route_conv.is_owned = ptr_is_owned(route);
28974         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28975         route_conv.is_owned = false;
28976         LDKThirtyTwoBytes payment_hash_ref;
28977         CHECK(payment_hash->arr_len == 32);
28978         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28979         LDKRecipientOnionFields recipient_onion_conv;
28980         recipient_onion_conv.inner = untag_ptr(recipient_onion);
28981         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
28982         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
28983         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
28984         LDKThirtyTwoBytes payment_id_ref;
28985         CHECK(payment_id->arr_len == 32);
28986         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28987         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
28988         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
28989         return tag_ptr(ret_conv, true);
28990 }
28991
28992 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) {
28993         LDKChannelManager this_arg_conv;
28994         this_arg_conv.inner = untag_ptr(this_arg);
28995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28997         this_arg_conv.is_owned = false;
28998         LDKThirtyTwoBytes payment_hash_ref;
28999         CHECK(payment_hash->arr_len == 32);
29000         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29001         LDKRecipientOnionFields recipient_onion_conv;
29002         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29003         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29004         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29005         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29006         LDKThirtyTwoBytes payment_id_ref;
29007         CHECK(payment_id->arr_len == 32);
29008         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29009         LDKRouteParameters route_params_conv;
29010         route_params_conv.inner = untag_ptr(route_params);
29011         route_params_conv.is_owned = ptr_is_owned(route_params);
29012         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29013         route_params_conv = RouteParameters_clone(&route_params_conv);
29014         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29015         CHECK_ACCESS(retry_strategy_ptr);
29016         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29017         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29018         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29019         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
29020         return tag_ptr(ret_conv, true);
29021 }
29022
29023 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
29024         LDKChannelManager this_arg_conv;
29025         this_arg_conv.inner = untag_ptr(this_arg);
29026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29028         this_arg_conv.is_owned = false;
29029         LDKThirtyTwoBytes payment_id_ref;
29030         CHECK(payment_id->arr_len == 32);
29031         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29032         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29033 }
29034
29035 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) {
29036         LDKChannelManager this_arg_conv;
29037         this_arg_conv.inner = untag_ptr(this_arg);
29038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29040         this_arg_conv.is_owned = false;
29041         LDKRoute route_conv;
29042         route_conv.inner = untag_ptr(route);
29043         route_conv.is_owned = ptr_is_owned(route);
29044         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29045         route_conv.is_owned = false;
29046         LDKThirtyTwoBytes payment_preimage_ref;
29047         CHECK(payment_preimage->arr_len == 32);
29048         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29049         LDKRecipientOnionFields recipient_onion_conv;
29050         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29051         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29052         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29053         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29054         LDKThirtyTwoBytes payment_id_ref;
29055         CHECK(payment_id->arr_len == 32);
29056         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29057         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
29058         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, recipient_onion_conv, payment_id_ref);
29059         return tag_ptr(ret_conv, true);
29060 }
29061
29062 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) {
29063         LDKChannelManager this_arg_conv;
29064         this_arg_conv.inner = untag_ptr(this_arg);
29065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29067         this_arg_conv.is_owned = false;
29068         LDKThirtyTwoBytes payment_preimage_ref;
29069         CHECK(payment_preimage->arr_len == 32);
29070         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29071         LDKRecipientOnionFields recipient_onion_conv;
29072         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29073         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29074         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29075         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29076         LDKThirtyTwoBytes payment_id_ref;
29077         CHECK(payment_id->arr_len == 32);
29078         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29079         LDKRouteParameters route_params_conv;
29080         route_params_conv.inner = untag_ptr(route_params);
29081         route_params_conv.is_owned = ptr_is_owned(route_params);
29082         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29083         route_params_conv = RouteParameters_clone(&route_params_conv);
29084         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29085         CHECK_ACCESS(retry_strategy_ptr);
29086         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29087         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29088         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
29089         *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);
29090         return tag_ptr(ret_conv, true);
29091 }
29092
29093 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
29094         LDKChannelManager this_arg_conv;
29095         this_arg_conv.inner = untag_ptr(this_arg);
29096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29098         this_arg_conv.is_owned = false;
29099         LDKPath path_conv;
29100         path_conv.inner = untag_ptr(path);
29101         path_conv.is_owned = ptr_is_owned(path);
29102         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
29103         path_conv = Path_clone(&path_conv);
29104         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29105         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
29106         return tag_ptr(ret_conv, true);
29107 }
29108
29109 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) {
29110         LDKChannelManager this_arg_conv;
29111         this_arg_conv.inner = untag_ptr(this_arg);
29112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29114         this_arg_conv.is_owned = false;
29115         uint8_t temporary_channel_id_arr[32];
29116         CHECK(temporary_channel_id->arr_len == 32);
29117         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29118         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29119         LDKPublicKey counterparty_node_id_ref;
29120         CHECK(counterparty_node_id->arr_len == 33);
29121         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29122         LDKTransaction funding_transaction_ref;
29123         funding_transaction_ref.datalen = funding_transaction->arr_len;
29124         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29125         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
29126         funding_transaction_ref.data_is_owned = true;
29127         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29128         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
29129         return tag_ptr(ret_conv, true);
29130 }
29131
29132 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) {
29133         LDKChannelManager this_arg_conv;
29134         this_arg_conv.inner = untag_ptr(this_arg);
29135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29137         this_arg_conv.is_owned = false;
29138         LDKPublicKey counterparty_node_id_ref;
29139         CHECK(counterparty_node_id->arr_len == 33);
29140         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29141         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
29142         channel_ids_constr.datalen = channel_ids->arr_len;
29143         if (channel_ids_constr.datalen > 0)
29144                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
29145         else
29146                 channel_ids_constr.data = NULL;
29147         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
29148         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
29149                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
29150                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
29151                 CHECK(channel_ids_conv_12->arr_len == 32);
29152                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
29153                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
29154         }
29155         FREE(channel_ids);
29156         LDKChannelConfig config_conv;
29157         config_conv.inner = untag_ptr(config);
29158         config_conv.is_owned = ptr_is_owned(config);
29159         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29160         config_conv.is_owned = false;
29161         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29162         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
29163         return tag_ptr(ret_conv, true);
29164 }
29165
29166 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) {
29167         LDKChannelManager this_arg_conv;
29168         this_arg_conv.inner = untag_ptr(this_arg);
29169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29171         this_arg_conv.is_owned = false;
29172         LDKThirtyTwoBytes intercept_id_ref;
29173         CHECK(intercept_id->arr_len == 32);
29174         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29175         uint8_t next_hop_channel_id_arr[32];
29176         CHECK(next_hop_channel_id->arr_len == 32);
29177         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
29178         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
29179         LDKPublicKey next_node_id_ref;
29180         CHECK(next_node_id->arr_len == 33);
29181         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
29182         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29183         *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);
29184         return tag_ptr(ret_conv, true);
29185 }
29186
29187 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
29188         LDKChannelManager this_arg_conv;
29189         this_arg_conv.inner = untag_ptr(this_arg);
29190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29192         this_arg_conv.is_owned = false;
29193         LDKThirtyTwoBytes intercept_id_ref;
29194         CHECK(intercept_id->arr_len == 32);
29195         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29196         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29197         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
29198         return tag_ptr(ret_conv, true);
29199 }
29200
29201 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
29202         LDKChannelManager this_arg_conv;
29203         this_arg_conv.inner = untag_ptr(this_arg);
29204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29206         this_arg_conv.is_owned = false;
29207         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29208 }
29209
29210 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
29211         LDKChannelManager this_arg_conv;
29212         this_arg_conv.inner = untag_ptr(this_arg);
29213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29215         this_arg_conv.is_owned = false;
29216         ChannelManager_timer_tick_occurred(&this_arg_conv);
29217 }
29218
29219 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
29220         LDKChannelManager this_arg_conv;
29221         this_arg_conv.inner = untag_ptr(this_arg);
29222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29224         this_arg_conv.is_owned = false;
29225         uint8_t payment_hash_arr[32];
29226         CHECK(payment_hash->arr_len == 32);
29227         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29228         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29229         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29230 }
29231
29232 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) {
29233         LDKChannelManager this_arg_conv;
29234         this_arg_conv.inner = untag_ptr(this_arg);
29235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29237         this_arg_conv.is_owned = false;
29238         uint8_t payment_hash_arr[32];
29239         CHECK(payment_hash->arr_len == 32);
29240         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29241         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29242         LDKFailureCode failure_code_conv = LDKFailureCode_from_js(failure_code);
29243         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
29244 }
29245
29246 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
29247         LDKChannelManager this_arg_conv;
29248         this_arg_conv.inner = untag_ptr(this_arg);
29249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29251         this_arg_conv.is_owned = false;
29252         LDKThirtyTwoBytes payment_preimage_ref;
29253         CHECK(payment_preimage->arr_len == 32);
29254         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29255         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29256 }
29257
29258 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
29259         LDKChannelManager this_arg_conv;
29260         this_arg_conv.inner = untag_ptr(this_arg);
29261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29263         this_arg_conv.is_owned = false;
29264         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29265         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
29266         return ret_arr;
29267 }
29268
29269 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) {
29270         LDKChannelManager this_arg_conv;
29271         this_arg_conv.inner = untag_ptr(this_arg);
29272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29274         this_arg_conv.is_owned = false;
29275         uint8_t temporary_channel_id_arr[32];
29276         CHECK(temporary_channel_id->arr_len == 32);
29277         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29278         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29279         LDKPublicKey counterparty_node_id_ref;
29280         CHECK(counterparty_node_id->arr_len == 33);
29281         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29282         LDKU128 user_channel_id_ref;
29283         CHECK(user_channel_id->arr_len == 16);
29284         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29285         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29286         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
29287         return tag_ptr(ret_conv, true);
29288 }
29289
29290 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) {
29291         LDKChannelManager this_arg_conv;
29292         this_arg_conv.inner = untag_ptr(this_arg);
29293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29295         this_arg_conv.is_owned = false;
29296         uint8_t temporary_channel_id_arr[32];
29297         CHECK(temporary_channel_id->arr_len == 32);
29298         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29299         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29300         LDKPublicKey counterparty_node_id_ref;
29301         CHECK(counterparty_node_id->arr_len == 33);
29302         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29303         LDKU128 user_channel_id_ref;
29304         CHECK(user_channel_id->arr_len == 16);
29305         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29306         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29307         *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);
29308         return tag_ptr(ret_conv, true);
29309 }
29310
29311 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) {
29312         LDKChannelManager this_arg_conv;
29313         this_arg_conv.inner = untag_ptr(this_arg);
29314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29316         this_arg_conv.is_owned = false;
29317         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29318         CHECK_ACCESS(min_value_msat_ptr);
29319         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29320         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29321         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
29322         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
29323         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
29324         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
29325         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29326         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
29327         return tag_ptr(ret_conv, true);
29328 }
29329
29330 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) {
29331         LDKChannelManager this_arg_conv;
29332         this_arg_conv.inner = untag_ptr(this_arg);
29333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29335         this_arg_conv.is_owned = false;
29336         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29337         CHECK_ACCESS(min_value_msat_ptr);
29338         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29339         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29340         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
29341         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29342         return tag_ptr(ret_conv, true);
29343 }
29344
29345 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) {
29346         LDKChannelManager this_arg_conv;
29347         this_arg_conv.inner = untag_ptr(this_arg);
29348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29350         this_arg_conv.is_owned = false;
29351         LDKThirtyTwoBytes payment_hash_ref;
29352         CHECK(payment_hash->arr_len == 32);
29353         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29354         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29355         CHECK_ACCESS(min_value_msat_ptr);
29356         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29357         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29358         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
29359         CHECK_ACCESS(min_final_cltv_expiry_ptr);
29360         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
29361         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
29362         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29363         *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);
29364         return tag_ptr(ret_conv, true);
29365 }
29366
29367 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) {
29368         LDKChannelManager this_arg_conv;
29369         this_arg_conv.inner = untag_ptr(this_arg);
29370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29372         this_arg_conv.is_owned = false;
29373         LDKThirtyTwoBytes payment_hash_ref;
29374         CHECK(payment_hash->arr_len == 32);
29375         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29376         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29377         CHECK_ACCESS(min_value_msat_ptr);
29378         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29379         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29380         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
29381         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29382         return tag_ptr(ret_conv, true);
29383 }
29384
29385 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) {
29386         LDKChannelManager this_arg_conv;
29387         this_arg_conv.inner = untag_ptr(this_arg);
29388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29390         this_arg_conv.is_owned = false;
29391         LDKThirtyTwoBytes payment_hash_ref;
29392         CHECK(payment_hash->arr_len == 32);
29393         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29394         LDKThirtyTwoBytes payment_secret_ref;
29395         CHECK(payment_secret->arr_len == 32);
29396         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29397         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
29398         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
29399         return tag_ptr(ret_conv, true);
29400 }
29401
29402 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
29403         LDKChannelManager this_arg_conv;
29404         this_arg_conv.inner = untag_ptr(this_arg);
29405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29407         this_arg_conv.is_owned = false;
29408         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
29409         return ret_conv;
29410 }
29411
29412 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
29413         LDKChannelManager this_arg_conv;
29414         this_arg_conv.inner = untag_ptr(this_arg);
29415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29417         this_arg_conv.is_owned = false;
29418         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
29419         uint64_t ret_ref = 0;
29420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29422         return ret_ref;
29423 }
29424
29425 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
29426         LDKChannelManager this_arg_conv;
29427         this_arg_conv.inner = untag_ptr(this_arg);
29428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29430         this_arg_conv.is_owned = false;
29431         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
29432         return ret_conv;
29433 }
29434
29435 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
29436         LDKChannelManager this_arg_conv;
29437         this_arg_conv.inner = untag_ptr(this_arg);
29438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29440         this_arg_conv.is_owned = false;
29441         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
29442         uint64_t ret_ref = 0;
29443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29445         return ret_ref;
29446 }
29447
29448 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
29449         LDKChannelManager this_arg_conv;
29450         this_arg_conv.inner = untag_ptr(this_arg);
29451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29453         this_arg_conv.is_owned = false;
29454         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29455         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
29456         return tag_ptr(ret_ret, true);
29457 }
29458
29459 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
29460         LDKChannelManager this_arg_conv;
29461         this_arg_conv.inner = untag_ptr(this_arg);
29462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29464         this_arg_conv.is_owned = false;
29465         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29466         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
29467         return tag_ptr(ret_ret, true);
29468 }
29469
29470 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
29471         LDKChannelManager this_arg_conv;
29472         this_arg_conv.inner = untag_ptr(this_arg);
29473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29475         this_arg_conv.is_owned = false;
29476         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29477         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29478         return tag_ptr(ret_ret, true);
29479 }
29480
29481 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
29482         LDKChannelManager this_arg_conv;
29483         this_arg_conv.inner = untag_ptr(this_arg);
29484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29486         this_arg_conv.is_owned = false;
29487         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29488         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29489         return tag_ptr(ret_ret, true);
29490 }
29491
29492 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
29493         LDKChannelManager this_arg_conv;
29494         this_arg_conv.inner = untag_ptr(this_arg);
29495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29497         this_arg_conv.is_owned = false;
29498         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
29499         uint64_t ret_ref = 0;
29500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29502         return ret_ref;
29503 }
29504
29505 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
29506         LDKChannelManager this_arg_conv;
29507         this_arg_conv.inner = untag_ptr(this_arg);
29508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29510         this_arg_conv.is_owned = false;
29511         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29512         uint64_t ret_ref = 0;
29513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29515         return ret_ref;
29516 }
29517
29518 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
29519         LDKChannelManager this_arg_conv;
29520         this_arg_conv.inner = untag_ptr(this_arg);
29521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29523         this_arg_conv.is_owned = false;
29524         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
29525         uint64_t ret_ref = 0;
29526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29528         return ret_ref;
29529 }
29530
29531 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
29532         LDKChannelManager this_arg_conv;
29533         this_arg_conv.inner = untag_ptr(this_arg);
29534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29536         this_arg_conv.is_owned = false;
29537         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
29538         uint64_t ret_ref = 0;
29539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29541         return ret_ref;
29542 }
29543
29544 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
29545         LDKChannelManager this_arg_conv;
29546         this_arg_conv.inner = untag_ptr(this_arg);
29547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29549         this_arg_conv.is_owned = false;
29550         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
29551         uint64_t ret_ref = 0;
29552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29554         return ret_ref;
29555 }
29556
29557 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
29558         LDKChannelManager this_arg_conv;
29559         this_arg_conv.inner = untag_ptr(this_arg);
29560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29562         this_arg_conv.is_owned = false;
29563         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
29564         uint64_t ret_ref = 0;
29565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29567         return ret_ref;
29568 }
29569
29570 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
29571         LDKChannelManager this_arg_conv;
29572         this_arg_conv.inner = untag_ptr(this_arg);
29573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29575         this_arg_conv.is_owned = false;
29576         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29577         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29578         return tag_ptr(ret_ret, true);
29579 }
29580
29581 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t _config) {
29582         LDKUserConfig _config_conv;
29583         _config_conv.inner = untag_ptr(_config);
29584         _config_conv.is_owned = ptr_is_owned(_config);
29585         CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv);
29586         _config_conv.is_owned = false;
29587         LDKInitFeatures ret_var = provided_init_features(&_config_conv);
29588         uint64_t ret_ref = 0;
29589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29591         return ret_ref;
29592 }
29593
29594 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
29595         LDKCounterpartyForwardingInfo obj_conv;
29596         obj_conv.inner = untag_ptr(obj);
29597         obj_conv.is_owned = ptr_is_owned(obj);
29598         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29599         obj_conv.is_owned = false;
29600         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29601         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29602         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29603         CVec_u8Z_free(ret_var);
29604         return ret_arr;
29605 }
29606
29607 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
29608         LDKu8slice ser_ref;
29609         ser_ref.datalen = ser->arr_len;
29610         ser_ref.data = ser->elems;
29611         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29612         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29613         FREE(ser);
29614         return tag_ptr(ret_conv, true);
29615 }
29616
29617 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
29618         LDKChannelCounterparty obj_conv;
29619         obj_conv.inner = untag_ptr(obj);
29620         obj_conv.is_owned = ptr_is_owned(obj);
29621         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29622         obj_conv.is_owned = false;
29623         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29624         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29625         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29626         CVec_u8Z_free(ret_var);
29627         return ret_arr;
29628 }
29629
29630 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
29631         LDKu8slice ser_ref;
29632         ser_ref.datalen = ser->arr_len;
29633         ser_ref.data = ser->elems;
29634         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29635         *ret_conv = ChannelCounterparty_read(ser_ref);
29636         FREE(ser);
29637         return tag_ptr(ret_conv, true);
29638 }
29639
29640 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
29641         LDKChannelDetails obj_conv;
29642         obj_conv.inner = untag_ptr(obj);
29643         obj_conv.is_owned = ptr_is_owned(obj);
29644         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29645         obj_conv.is_owned = false;
29646         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29649         CVec_u8Z_free(ret_var);
29650         return ret_arr;
29651 }
29652
29653 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
29654         LDKu8slice ser_ref;
29655         ser_ref.datalen = ser->arr_len;
29656         ser_ref.data = ser->elems;
29657         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29658         *ret_conv = ChannelDetails_read(ser_ref);
29659         FREE(ser);
29660         return tag_ptr(ret_conv, true);
29661 }
29662
29663 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
29664         LDKPhantomRouteHints obj_conv;
29665         obj_conv.inner = untag_ptr(obj);
29666         obj_conv.is_owned = ptr_is_owned(obj);
29667         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29668         obj_conv.is_owned = false;
29669         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29670         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29671         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29672         CVec_u8Z_free(ret_var);
29673         return ret_arr;
29674 }
29675
29676 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
29677         LDKu8slice ser_ref;
29678         ser_ref.datalen = ser->arr_len;
29679         ser_ref.data = ser->elems;
29680         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29681         *ret_conv = PhantomRouteHints_read(ser_ref);
29682         FREE(ser);
29683         return tag_ptr(ret_conv, true);
29684 }
29685
29686 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
29687         LDKChannelManager obj_conv;
29688         obj_conv.inner = untag_ptr(obj);
29689         obj_conv.is_owned = ptr_is_owned(obj);
29690         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29691         obj_conv.is_owned = false;
29692         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29693         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29694         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29695         CVec_u8Z_free(ret_var);
29696         return ret_arr;
29697 }
29698
29699 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
29700         LDKChannelManagerReadArgs this_obj_conv;
29701         this_obj_conv.inner = untag_ptr(this_obj);
29702         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29704         ChannelManagerReadArgs_free(this_obj_conv);
29705 }
29706
29707 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
29708         LDKChannelManagerReadArgs this_ptr_conv;
29709         this_ptr_conv.inner = untag_ptr(this_ptr);
29710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29712         this_ptr_conv.is_owned = false;
29713         // WARNING: This object doesn't live past this scope, needs clone!
29714         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
29715         return ret_ret;
29716 }
29717
29718 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
29719         LDKChannelManagerReadArgs this_ptr_conv;
29720         this_ptr_conv.inner = untag_ptr(this_ptr);
29721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29723         this_ptr_conv.is_owned = false;
29724         void* val_ptr = untag_ptr(val);
29725         CHECK_ACCESS(val_ptr);
29726         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
29727         if (val_conv.free == LDKEntropySource_JCalls_free) {
29728                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29729                 LDKEntropySource_JCalls_cloned(&val_conv);
29730         }
29731         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
29732 }
29733
29734 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
29735         LDKChannelManagerReadArgs this_ptr_conv;
29736         this_ptr_conv.inner = untag_ptr(this_ptr);
29737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29739         this_ptr_conv.is_owned = false;
29740         // WARNING: This object doesn't live past this scope, needs clone!
29741         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
29742         return ret_ret;
29743 }
29744
29745 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
29746         LDKChannelManagerReadArgs this_ptr_conv;
29747         this_ptr_conv.inner = untag_ptr(this_ptr);
29748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29750         this_ptr_conv.is_owned = false;
29751         void* val_ptr = untag_ptr(val);
29752         CHECK_ACCESS(val_ptr);
29753         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
29754         if (val_conv.free == LDKNodeSigner_JCalls_free) {
29755                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29756                 LDKNodeSigner_JCalls_cloned(&val_conv);
29757         }
29758         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
29759 }
29760
29761 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
29762         LDKChannelManagerReadArgs this_ptr_conv;
29763         this_ptr_conv.inner = untag_ptr(this_ptr);
29764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29766         this_ptr_conv.is_owned = false;
29767         // WARNING: This object doesn't live past this scope, needs clone!
29768         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
29769         return ret_ret;
29770 }
29771
29772 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
29773         LDKChannelManagerReadArgs this_ptr_conv;
29774         this_ptr_conv.inner = untag_ptr(this_ptr);
29775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29777         this_ptr_conv.is_owned = false;
29778         void* val_ptr = untag_ptr(val);
29779         CHECK_ACCESS(val_ptr);
29780         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
29781         if (val_conv.free == LDKSignerProvider_JCalls_free) {
29782                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29783                 LDKSignerProvider_JCalls_cloned(&val_conv);
29784         }
29785         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
29786 }
29787
29788 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
29789         LDKChannelManagerReadArgs this_ptr_conv;
29790         this_ptr_conv.inner = untag_ptr(this_ptr);
29791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29793         this_ptr_conv.is_owned = false;
29794         // WARNING: This object doesn't live past this scope, needs clone!
29795         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
29796         return ret_ret;
29797 }
29798
29799 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
29800         LDKChannelManagerReadArgs this_ptr_conv;
29801         this_ptr_conv.inner = untag_ptr(this_ptr);
29802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29804         this_ptr_conv.is_owned = false;
29805         void* val_ptr = untag_ptr(val);
29806         CHECK_ACCESS(val_ptr);
29807         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29808         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29809                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29810                 LDKFeeEstimator_JCalls_cloned(&val_conv);
29811         }
29812         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29813 }
29814
29815 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
29816         LDKChannelManagerReadArgs this_ptr_conv;
29817         this_ptr_conv.inner = untag_ptr(this_ptr);
29818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29820         this_ptr_conv.is_owned = false;
29821         // WARNING: This object doesn't live past this scope, needs clone!
29822         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
29823         return ret_ret;
29824 }
29825
29826 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
29827         LDKChannelManagerReadArgs this_ptr_conv;
29828         this_ptr_conv.inner = untag_ptr(this_ptr);
29829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29831         this_ptr_conv.is_owned = false;
29832         void* val_ptr = untag_ptr(val);
29833         CHECK_ACCESS(val_ptr);
29834         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29835         if (val_conv.free == LDKWatch_JCalls_free) {
29836                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29837                 LDKWatch_JCalls_cloned(&val_conv);
29838         }
29839         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29840 }
29841
29842 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
29843         LDKChannelManagerReadArgs this_ptr_conv;
29844         this_ptr_conv.inner = untag_ptr(this_ptr);
29845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29847         this_ptr_conv.is_owned = false;
29848         // WARNING: This object doesn't live past this scope, needs clone!
29849         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
29850         return ret_ret;
29851 }
29852
29853 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
29854         LDKChannelManagerReadArgs this_ptr_conv;
29855         this_ptr_conv.inner = untag_ptr(this_ptr);
29856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29858         this_ptr_conv.is_owned = false;
29859         void* val_ptr = untag_ptr(val);
29860         CHECK_ACCESS(val_ptr);
29861         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29862         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29863                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29864                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29865         }
29866         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29867 }
29868
29869 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
29870         LDKChannelManagerReadArgs this_ptr_conv;
29871         this_ptr_conv.inner = untag_ptr(this_ptr);
29872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29874         this_ptr_conv.is_owned = false;
29875         // WARNING: This object doesn't live past this scope, needs clone!
29876         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
29877         return ret_ret;
29878 }
29879
29880 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
29881         LDKChannelManagerReadArgs this_ptr_conv;
29882         this_ptr_conv.inner = untag_ptr(this_ptr);
29883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29885         this_ptr_conv.is_owned = false;
29886         void* val_ptr = untag_ptr(val);
29887         CHECK_ACCESS(val_ptr);
29888         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
29889         if (val_conv.free == LDKRouter_JCalls_free) {
29890                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29891                 LDKRouter_JCalls_cloned(&val_conv);
29892         }
29893         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
29894 }
29895
29896 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
29897         LDKChannelManagerReadArgs this_ptr_conv;
29898         this_ptr_conv.inner = untag_ptr(this_ptr);
29899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29901         this_ptr_conv.is_owned = false;
29902         // WARNING: This object doesn't live past this scope, needs clone!
29903         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
29904         return ret_ret;
29905 }
29906
29907 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
29908         LDKChannelManagerReadArgs this_ptr_conv;
29909         this_ptr_conv.inner = untag_ptr(this_ptr);
29910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29912         this_ptr_conv.is_owned = false;
29913         void* val_ptr = untag_ptr(val);
29914         CHECK_ACCESS(val_ptr);
29915         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29916         if (val_conv.free == LDKLogger_JCalls_free) {
29917                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29918                 LDKLogger_JCalls_cloned(&val_conv);
29919         }
29920         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29921 }
29922
29923 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
29924         LDKChannelManagerReadArgs this_ptr_conv;
29925         this_ptr_conv.inner = untag_ptr(this_ptr);
29926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29928         this_ptr_conv.is_owned = false;
29929         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29930         uint64_t ret_ref = 0;
29931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29933         return ret_ref;
29934 }
29935
29936 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
29937         LDKChannelManagerReadArgs this_ptr_conv;
29938         this_ptr_conv.inner = untag_ptr(this_ptr);
29939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29941         this_ptr_conv.is_owned = false;
29942         LDKUserConfig val_conv;
29943         val_conv.inner = untag_ptr(val);
29944         val_conv.is_owned = ptr_is_owned(val);
29945         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29946         val_conv = UserConfig_clone(&val_conv);
29947         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29948 }
29949
29950 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) {
29951         void* entropy_source_ptr = untag_ptr(entropy_source);
29952         CHECK_ACCESS(entropy_source_ptr);
29953         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
29954         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
29955                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29956                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
29957         }
29958         void* node_signer_ptr = untag_ptr(node_signer);
29959         CHECK_ACCESS(node_signer_ptr);
29960         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
29961         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
29962                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29963                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
29964         }
29965         void* signer_provider_ptr = untag_ptr(signer_provider);
29966         CHECK_ACCESS(signer_provider_ptr);
29967         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
29968         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
29969                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29970                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
29971         }
29972         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29973         CHECK_ACCESS(fee_estimator_ptr);
29974         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29975         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29976                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29977                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29978         }
29979         void* chain_monitor_ptr = untag_ptr(chain_monitor);
29980         CHECK_ACCESS(chain_monitor_ptr);
29981         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29982         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29983                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29984                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29985         }
29986         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
29987         CHECK_ACCESS(tx_broadcaster_ptr);
29988         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29989         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29990                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29991                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29992         }
29993         void* router_ptr = untag_ptr(router);
29994         CHECK_ACCESS(router_ptr);
29995         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
29996         if (router_conv.free == LDKRouter_JCalls_free) {
29997                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29998                 LDKRouter_JCalls_cloned(&router_conv);
29999         }
30000         void* logger_ptr = untag_ptr(logger);
30001         CHECK_ACCESS(logger_ptr);
30002         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30003         if (logger_conv.free == LDKLogger_JCalls_free) {
30004                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30005                 LDKLogger_JCalls_cloned(&logger_conv);
30006         }
30007         LDKUserConfig default_config_conv;
30008         default_config_conv.inner = untag_ptr(default_config);
30009         default_config_conv.is_owned = ptr_is_owned(default_config);
30010         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30011         default_config_conv = UserConfig_clone(&default_config_conv);
30012         LDKCVec_ChannelMonitorZ channel_monitors_constr;
30013         channel_monitors_constr.datalen = channel_monitors->arr_len;
30014         if (channel_monitors_constr.datalen > 0)
30015                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30016         else
30017                 channel_monitors_constr.data = NULL;
30018         uint64_t* channel_monitors_vals = channel_monitors->elems;
30019         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30020                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30021                 LDKChannelMonitor channel_monitors_conv_16_conv;
30022                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
30023                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
30024                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30025                 channel_monitors_conv_16_conv.is_owned = false;
30026                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30027         }
30028         FREE(channel_monitors);
30029         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);
30030         uint64_t ret_ref = 0;
30031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30033         return ret_ref;
30034 }
30035
30036 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
30037         LDKu8slice ser_ref;
30038         ser_ref.datalen = ser->arr_len;
30039         ser_ref.data = ser->elems;
30040         LDKChannelManagerReadArgs arg_conv;
30041         arg_conv.inner = untag_ptr(arg);
30042         arg_conv.is_owned = ptr_is_owned(arg);
30043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30044         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30045         
30046         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30047         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30048         FREE(ser);
30049         return tag_ptr(ret_conv, true);
30050 }
30051
30052 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
30053         LDKExpandedKey this_obj_conv;
30054         this_obj_conv.inner = untag_ptr(this_obj);
30055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30057         ExpandedKey_free(this_obj_conv);
30058 }
30059
30060 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
30061         uint8_t key_material_arr[32];
30062         CHECK(key_material->arr_len == 32);
30063         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
30064         uint8_t (*key_material_ref)[32] = &key_material_arr;
30065         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30066         uint64_t ret_ref = 0;
30067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30069         return ret_ref;
30070 }
30071
30072 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) {
30073         LDKExpandedKey keys_conv;
30074         keys_conv.inner = untag_ptr(keys);
30075         keys_conv.is_owned = ptr_is_owned(keys);
30076         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30077         keys_conv.is_owned = false;
30078         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30079         CHECK_ACCESS(min_value_msat_ptr);
30080         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30081         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30082         void* entropy_source_ptr = untag_ptr(entropy_source);
30083         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
30084         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
30085         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30086         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30087         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30088         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30089         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30090         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
30091         return tag_ptr(ret_conv, true);
30092 }
30093
30094 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) {
30095         LDKExpandedKey keys_conv;
30096         keys_conv.inner = untag_ptr(keys);
30097         keys_conv.is_owned = ptr_is_owned(keys);
30098         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30099         keys_conv.is_owned = false;
30100         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30101         CHECK_ACCESS(min_value_msat_ptr);
30102         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30103         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30104         LDKThirtyTwoBytes payment_hash_ref;
30105         CHECK(payment_hash->arr_len == 32);
30106         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30107         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30108         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30109         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30110         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30111         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30112         *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);
30113         return tag_ptr(ret_conv, true);
30114 }
30115
30116 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
30117         if (!ptr_is_owned(this_ptr)) return;
30118         void* this_ptr_ptr = untag_ptr(this_ptr);
30119         CHECK_ACCESS(this_ptr_ptr);
30120         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
30121         FREE(untag_ptr(this_ptr));
30122         DecodeError_free(this_ptr_conv);
30123 }
30124
30125 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30126         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30127         *ret_copy = DecodeError_clone(arg);
30128         uint64_t ret_ref = tag_ptr(ret_copy, true);
30129         return ret_ref;
30130 }
30131 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
30132         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
30133         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
30134         return ret_conv;
30135 }
30136
30137 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
30138         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
30139         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30140         *ret_copy = DecodeError_clone(orig_conv);
30141         uint64_t ret_ref = tag_ptr(ret_copy, true);
30142         return ret_ref;
30143 }
30144
30145 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
30146         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30147         *ret_copy = DecodeError_unknown_version();
30148         uint64_t ret_ref = tag_ptr(ret_copy, true);
30149         return ret_ref;
30150 }
30151
30152 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
30153         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30154         *ret_copy = DecodeError_unknown_required_feature();
30155         uint64_t ret_ref = tag_ptr(ret_copy, true);
30156         return ret_ref;
30157 }
30158
30159 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
30160         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30161         *ret_copy = DecodeError_invalid_value();
30162         uint64_t ret_ref = tag_ptr(ret_copy, true);
30163         return ret_ref;
30164 }
30165
30166 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
30167         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30168         *ret_copy = DecodeError_short_read();
30169         uint64_t ret_ref = tag_ptr(ret_copy, true);
30170         return ret_ref;
30171 }
30172
30173 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
30174         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30175         *ret_copy = DecodeError_bad_length_descriptor();
30176         uint64_t ret_ref = tag_ptr(ret_copy, true);
30177         return ret_ref;
30178 }
30179
30180 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
30181         LDKIOError a_conv = LDKIOError_from_js(a);
30182         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30183         *ret_copy = DecodeError_io(a_conv);
30184         uint64_t ret_ref = tag_ptr(ret_copy, true);
30185         return ret_ref;
30186 }
30187
30188 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
30189         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30190         *ret_copy = DecodeError_unsupported_compression();
30191         uint64_t ret_ref = tag_ptr(ret_copy, true);
30192         return ret_ref;
30193 }
30194
30195 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
30196         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
30197         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
30198         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
30199         return ret_conv;
30200 }
30201
30202 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
30203         LDKInit this_obj_conv;
30204         this_obj_conv.inner = untag_ptr(this_obj);
30205         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30207         Init_free(this_obj_conv);
30208 }
30209
30210 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
30211         LDKInit this_ptr_conv;
30212         this_ptr_conv.inner = untag_ptr(this_ptr);
30213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30215         this_ptr_conv.is_owned = false;
30216         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30217         uint64_t ret_ref = 0;
30218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30220         return ret_ref;
30221 }
30222
30223 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
30224         LDKInit this_ptr_conv;
30225         this_ptr_conv.inner = untag_ptr(this_ptr);
30226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30228         this_ptr_conv.is_owned = false;
30229         LDKInitFeatures val_conv;
30230         val_conv.inner = untag_ptr(val);
30231         val_conv.is_owned = ptr_is_owned(val);
30232         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30233         val_conv = InitFeatures_clone(&val_conv);
30234         Init_set_features(&this_ptr_conv, val_conv);
30235 }
30236
30237 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
30238         LDKInit this_ptr_conv;
30239         this_ptr_conv.inner = untag_ptr(this_ptr);
30240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30242         this_ptr_conv.is_owned = false;
30243         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30244         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30245         uint64_t ret_ref = tag_ptr(ret_copy, true);
30246         return ret_ref;
30247 }
30248
30249 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
30250         LDKInit this_ptr_conv;
30251         this_ptr_conv.inner = untag_ptr(this_ptr);
30252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30254         this_ptr_conv.is_owned = false;
30255         void* val_ptr = untag_ptr(val);
30256         CHECK_ACCESS(val_ptr);
30257         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30258         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
30259         Init_set_remote_network_address(&this_ptr_conv, val_conv);
30260 }
30261
30262 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
30263         LDKInitFeatures features_arg_conv;
30264         features_arg_conv.inner = untag_ptr(features_arg);
30265         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30266         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30267         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30268         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
30269         CHECK_ACCESS(remote_network_address_arg_ptr);
30270         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30271         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30272         uint64_t ret_ref = 0;
30273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30275         return ret_ref;
30276 }
30277
30278 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30279         LDKInit ret_var = Init_clone(arg);
30280         uint64_t ret_ref = 0;
30281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30283         return ret_ref;
30284 }
30285 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
30286         LDKInit arg_conv;
30287         arg_conv.inner = untag_ptr(arg);
30288         arg_conv.is_owned = ptr_is_owned(arg);
30289         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30290         arg_conv.is_owned = false;
30291         int64_t ret_conv = Init_clone_ptr(&arg_conv);
30292         return ret_conv;
30293 }
30294
30295 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
30296         LDKInit orig_conv;
30297         orig_conv.inner = untag_ptr(orig);
30298         orig_conv.is_owned = ptr_is_owned(orig);
30299         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30300         orig_conv.is_owned = false;
30301         LDKInit ret_var = Init_clone(&orig_conv);
30302         uint64_t ret_ref = 0;
30303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30305         return ret_ref;
30306 }
30307
30308 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
30309         LDKInit a_conv;
30310         a_conv.inner = untag_ptr(a);
30311         a_conv.is_owned = ptr_is_owned(a);
30312         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30313         a_conv.is_owned = false;
30314         LDKInit b_conv;
30315         b_conv.inner = untag_ptr(b);
30316         b_conv.is_owned = ptr_is_owned(b);
30317         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30318         b_conv.is_owned = false;
30319         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
30320         return ret_conv;
30321 }
30322
30323 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
30324         LDKErrorMessage this_obj_conv;
30325         this_obj_conv.inner = untag_ptr(this_obj);
30326         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30328         ErrorMessage_free(this_obj_conv);
30329 }
30330
30331 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
30332         LDKErrorMessage this_ptr_conv;
30333         this_ptr_conv.inner = untag_ptr(this_ptr);
30334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30336         this_ptr_conv.is_owned = false;
30337         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30338         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
30339         return ret_arr;
30340 }
30341
30342 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30343         LDKErrorMessage this_ptr_conv;
30344         this_ptr_conv.inner = untag_ptr(this_ptr);
30345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30347         this_ptr_conv.is_owned = false;
30348         LDKThirtyTwoBytes val_ref;
30349         CHECK(val->arr_len == 32);
30350         memcpy(val_ref.data, val->elems, 32); FREE(val);
30351         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30352 }
30353
30354 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
30355         LDKErrorMessage this_ptr_conv;
30356         this_ptr_conv.inner = untag_ptr(this_ptr);
30357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30359         this_ptr_conv.is_owned = false;
30360         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30361         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30362         Str_free(ret_str);
30363         return ret_conv;
30364 }
30365
30366 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
30367         LDKErrorMessage this_ptr_conv;
30368         this_ptr_conv.inner = untag_ptr(this_ptr);
30369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30371         this_ptr_conv.is_owned = false;
30372         LDKStr val_conv = str_ref_to_owned_c(val);
30373         ErrorMessage_set_data(&this_ptr_conv, val_conv);
30374 }
30375
30376 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30377         LDKThirtyTwoBytes channel_id_arg_ref;
30378         CHECK(channel_id_arg->arr_len == 32);
30379         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30380         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30381         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30382         uint64_t ret_ref = 0;
30383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30385         return ret_ref;
30386 }
30387
30388 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30389         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30390         uint64_t ret_ref = 0;
30391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30393         return ret_ref;
30394 }
30395 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
30396         LDKErrorMessage arg_conv;
30397         arg_conv.inner = untag_ptr(arg);
30398         arg_conv.is_owned = ptr_is_owned(arg);
30399         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30400         arg_conv.is_owned = false;
30401         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30402         return ret_conv;
30403 }
30404
30405 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
30406         LDKErrorMessage orig_conv;
30407         orig_conv.inner = untag_ptr(orig);
30408         orig_conv.is_owned = ptr_is_owned(orig);
30409         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30410         orig_conv.is_owned = false;
30411         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30412         uint64_t ret_ref = 0;
30413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30415         return ret_ref;
30416 }
30417
30418 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
30419         LDKErrorMessage a_conv;
30420         a_conv.inner = untag_ptr(a);
30421         a_conv.is_owned = ptr_is_owned(a);
30422         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30423         a_conv.is_owned = false;
30424         LDKErrorMessage b_conv;
30425         b_conv.inner = untag_ptr(b);
30426         b_conv.is_owned = ptr_is_owned(b);
30427         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30428         b_conv.is_owned = false;
30429         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
30430         return ret_conv;
30431 }
30432
30433 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
30434         LDKWarningMessage this_obj_conv;
30435         this_obj_conv.inner = untag_ptr(this_obj);
30436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30438         WarningMessage_free(this_obj_conv);
30439 }
30440
30441 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
30442         LDKWarningMessage this_ptr_conv;
30443         this_ptr_conv.inner = untag_ptr(this_ptr);
30444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30446         this_ptr_conv.is_owned = false;
30447         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30448         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
30449         return ret_arr;
30450 }
30451
30452 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30453         LDKWarningMessage this_ptr_conv;
30454         this_ptr_conv.inner = untag_ptr(this_ptr);
30455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30457         this_ptr_conv.is_owned = false;
30458         LDKThirtyTwoBytes val_ref;
30459         CHECK(val->arr_len == 32);
30460         memcpy(val_ref.data, val->elems, 32); FREE(val);
30461         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30462 }
30463
30464 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
30465         LDKWarningMessage this_ptr_conv;
30466         this_ptr_conv.inner = untag_ptr(this_ptr);
30467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30469         this_ptr_conv.is_owned = false;
30470         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30471         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30472         Str_free(ret_str);
30473         return ret_conv;
30474 }
30475
30476 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
30477         LDKWarningMessage this_ptr_conv;
30478         this_ptr_conv.inner = untag_ptr(this_ptr);
30479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30481         this_ptr_conv.is_owned = false;
30482         LDKStr val_conv = str_ref_to_owned_c(val);
30483         WarningMessage_set_data(&this_ptr_conv, val_conv);
30484 }
30485
30486 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30487         LDKThirtyTwoBytes channel_id_arg_ref;
30488         CHECK(channel_id_arg->arr_len == 32);
30489         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30490         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30491         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30492         uint64_t ret_ref = 0;
30493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30495         return ret_ref;
30496 }
30497
30498 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30499         LDKWarningMessage ret_var = WarningMessage_clone(arg);
30500         uint64_t ret_ref = 0;
30501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30503         return ret_ref;
30504 }
30505 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
30506         LDKWarningMessage arg_conv;
30507         arg_conv.inner = untag_ptr(arg);
30508         arg_conv.is_owned = ptr_is_owned(arg);
30509         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30510         arg_conv.is_owned = false;
30511         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30512         return ret_conv;
30513 }
30514
30515 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
30516         LDKWarningMessage orig_conv;
30517         orig_conv.inner = untag_ptr(orig);
30518         orig_conv.is_owned = ptr_is_owned(orig);
30519         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30520         orig_conv.is_owned = false;
30521         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30522         uint64_t ret_ref = 0;
30523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30525         return ret_ref;
30526 }
30527
30528 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
30529         LDKWarningMessage a_conv;
30530         a_conv.inner = untag_ptr(a);
30531         a_conv.is_owned = ptr_is_owned(a);
30532         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30533         a_conv.is_owned = false;
30534         LDKWarningMessage b_conv;
30535         b_conv.inner = untag_ptr(b);
30536         b_conv.is_owned = ptr_is_owned(b);
30537         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30538         b_conv.is_owned = false;
30539         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
30540         return ret_conv;
30541 }
30542
30543 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
30544         LDKPing this_obj_conv;
30545         this_obj_conv.inner = untag_ptr(this_obj);
30546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30548         Ping_free(this_obj_conv);
30549 }
30550
30551 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
30552         LDKPing this_ptr_conv;
30553         this_ptr_conv.inner = untag_ptr(this_ptr);
30554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30556         this_ptr_conv.is_owned = false;
30557         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30558         return ret_conv;
30559 }
30560
30561 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
30562         LDKPing this_ptr_conv;
30563         this_ptr_conv.inner = untag_ptr(this_ptr);
30564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30566         this_ptr_conv.is_owned = false;
30567         Ping_set_ponglen(&this_ptr_conv, val);
30568 }
30569
30570 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
30571         LDKPing this_ptr_conv;
30572         this_ptr_conv.inner = untag_ptr(this_ptr);
30573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30575         this_ptr_conv.is_owned = false;
30576         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30577         return ret_conv;
30578 }
30579
30580 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
30581         LDKPing this_ptr_conv;
30582         this_ptr_conv.inner = untag_ptr(this_ptr);
30583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30585         this_ptr_conv.is_owned = false;
30586         Ping_set_byteslen(&this_ptr_conv, val);
30587 }
30588
30589 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
30590         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30591         uint64_t ret_ref = 0;
30592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30594         return ret_ref;
30595 }
30596
30597 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30598         LDKPing ret_var = Ping_clone(arg);
30599         uint64_t ret_ref = 0;
30600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30602         return ret_ref;
30603 }
30604 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
30605         LDKPing arg_conv;
30606         arg_conv.inner = untag_ptr(arg);
30607         arg_conv.is_owned = ptr_is_owned(arg);
30608         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30609         arg_conv.is_owned = false;
30610         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30611         return ret_conv;
30612 }
30613
30614 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
30615         LDKPing orig_conv;
30616         orig_conv.inner = untag_ptr(orig);
30617         orig_conv.is_owned = ptr_is_owned(orig);
30618         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30619         orig_conv.is_owned = false;
30620         LDKPing ret_var = Ping_clone(&orig_conv);
30621         uint64_t ret_ref = 0;
30622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30624         return ret_ref;
30625 }
30626
30627 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
30628         LDKPing a_conv;
30629         a_conv.inner = untag_ptr(a);
30630         a_conv.is_owned = ptr_is_owned(a);
30631         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30632         a_conv.is_owned = false;
30633         LDKPing b_conv;
30634         b_conv.inner = untag_ptr(b);
30635         b_conv.is_owned = ptr_is_owned(b);
30636         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30637         b_conv.is_owned = false;
30638         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
30639         return ret_conv;
30640 }
30641
30642 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
30643         LDKPong this_obj_conv;
30644         this_obj_conv.inner = untag_ptr(this_obj);
30645         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30647         Pong_free(this_obj_conv);
30648 }
30649
30650 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
30651         LDKPong this_ptr_conv;
30652         this_ptr_conv.inner = untag_ptr(this_ptr);
30653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30655         this_ptr_conv.is_owned = false;
30656         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30657         return ret_conv;
30658 }
30659
30660 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
30661         LDKPong this_ptr_conv;
30662         this_ptr_conv.inner = untag_ptr(this_ptr);
30663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30665         this_ptr_conv.is_owned = false;
30666         Pong_set_byteslen(&this_ptr_conv, val);
30667 }
30668
30669 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
30670         LDKPong ret_var = Pong_new(byteslen_arg);
30671         uint64_t ret_ref = 0;
30672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30674         return ret_ref;
30675 }
30676
30677 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30678         LDKPong ret_var = Pong_clone(arg);
30679         uint64_t ret_ref = 0;
30680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30682         return ret_ref;
30683 }
30684 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
30685         LDKPong arg_conv;
30686         arg_conv.inner = untag_ptr(arg);
30687         arg_conv.is_owned = ptr_is_owned(arg);
30688         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30689         arg_conv.is_owned = false;
30690         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30691         return ret_conv;
30692 }
30693
30694 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
30695         LDKPong orig_conv;
30696         orig_conv.inner = untag_ptr(orig);
30697         orig_conv.is_owned = ptr_is_owned(orig);
30698         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30699         orig_conv.is_owned = false;
30700         LDKPong ret_var = Pong_clone(&orig_conv);
30701         uint64_t ret_ref = 0;
30702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30704         return ret_ref;
30705 }
30706
30707 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
30708         LDKPong a_conv;
30709         a_conv.inner = untag_ptr(a);
30710         a_conv.is_owned = ptr_is_owned(a);
30711         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30712         a_conv.is_owned = false;
30713         LDKPong b_conv;
30714         b_conv.inner = untag_ptr(b);
30715         b_conv.is_owned = ptr_is_owned(b);
30716         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30717         b_conv.is_owned = false;
30718         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
30719         return ret_conv;
30720 }
30721
30722 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
30723         LDKOpenChannel this_obj_conv;
30724         this_obj_conv.inner = untag_ptr(this_obj);
30725         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30727         OpenChannel_free(this_obj_conv);
30728 }
30729
30730 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
30731         LDKOpenChannel this_ptr_conv;
30732         this_ptr_conv.inner = untag_ptr(this_ptr);
30733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30735         this_ptr_conv.is_owned = false;
30736         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30737         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
30738         return ret_arr;
30739 }
30740
30741 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30742         LDKOpenChannel this_ptr_conv;
30743         this_ptr_conv.inner = untag_ptr(this_ptr);
30744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30746         this_ptr_conv.is_owned = false;
30747         LDKThirtyTwoBytes val_ref;
30748         CHECK(val->arr_len == 32);
30749         memcpy(val_ref.data, val->elems, 32); FREE(val);
30750         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30751 }
30752
30753 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
30754         LDKOpenChannel this_ptr_conv;
30755         this_ptr_conv.inner = untag_ptr(this_ptr);
30756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30758         this_ptr_conv.is_owned = false;
30759         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30760         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30761         return ret_arr;
30762 }
30763
30764 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30765         LDKOpenChannel this_ptr_conv;
30766         this_ptr_conv.inner = untag_ptr(this_ptr);
30767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30769         this_ptr_conv.is_owned = false;
30770         LDKThirtyTwoBytes val_ref;
30771         CHECK(val->arr_len == 32);
30772         memcpy(val_ref.data, val->elems, 32); FREE(val);
30773         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30774 }
30775
30776 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
30777         LDKOpenChannel this_ptr_conv;
30778         this_ptr_conv.inner = untag_ptr(this_ptr);
30779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30781         this_ptr_conv.is_owned = false;
30782         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30783         return ret_conv;
30784 }
30785
30786 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
30787         LDKOpenChannel this_ptr_conv;
30788         this_ptr_conv.inner = untag_ptr(this_ptr);
30789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30791         this_ptr_conv.is_owned = false;
30792         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30793 }
30794
30795 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
30796         LDKOpenChannel this_ptr_conv;
30797         this_ptr_conv.inner = untag_ptr(this_ptr);
30798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30800         this_ptr_conv.is_owned = false;
30801         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30802         return ret_conv;
30803 }
30804
30805 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
30806         LDKOpenChannel this_ptr_conv;
30807         this_ptr_conv.inner = untag_ptr(this_ptr);
30808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30810         this_ptr_conv.is_owned = false;
30811         OpenChannel_set_push_msat(&this_ptr_conv, val);
30812 }
30813
30814 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30815         LDKOpenChannel this_ptr_conv;
30816         this_ptr_conv.inner = untag_ptr(this_ptr);
30817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30819         this_ptr_conv.is_owned = false;
30820         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30821         return ret_conv;
30822 }
30823
30824 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30825         LDKOpenChannel this_ptr_conv;
30826         this_ptr_conv.inner = untag_ptr(this_ptr);
30827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30829         this_ptr_conv.is_owned = false;
30830         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30831 }
30832
30833 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) {
30834         LDKOpenChannel this_ptr_conv;
30835         this_ptr_conv.inner = untag_ptr(this_ptr);
30836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30838         this_ptr_conv.is_owned = false;
30839         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30840         return ret_conv;
30841 }
30842
30843 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) {
30844         LDKOpenChannel this_ptr_conv;
30845         this_ptr_conv.inner = untag_ptr(this_ptr);
30846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30848         this_ptr_conv.is_owned = false;
30849         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30850 }
30851
30852 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30853         LDKOpenChannel this_ptr_conv;
30854         this_ptr_conv.inner = untag_ptr(this_ptr);
30855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30857         this_ptr_conv.is_owned = false;
30858         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30859         return ret_conv;
30860 }
30861
30862 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
30863         LDKOpenChannel this_ptr_conv;
30864         this_ptr_conv.inner = untag_ptr(this_ptr);
30865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30867         this_ptr_conv.is_owned = false;
30868         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30869 }
30870
30871 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30872         LDKOpenChannel this_ptr_conv;
30873         this_ptr_conv.inner = untag_ptr(this_ptr);
30874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30876         this_ptr_conv.is_owned = false;
30877         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30878         return ret_conv;
30879 }
30880
30881 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30882         LDKOpenChannel this_ptr_conv;
30883         this_ptr_conv.inner = untag_ptr(this_ptr);
30884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30886         this_ptr_conv.is_owned = false;
30887         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30888 }
30889
30890 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
30891         LDKOpenChannel this_ptr_conv;
30892         this_ptr_conv.inner = untag_ptr(this_ptr);
30893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30895         this_ptr_conv.is_owned = false;
30896         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
30897         return ret_conv;
30898 }
30899
30900 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
30901         LDKOpenChannel this_ptr_conv;
30902         this_ptr_conv.inner = untag_ptr(this_ptr);
30903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30905         this_ptr_conv.is_owned = false;
30906         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
30907 }
30908
30909 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
30910         LDKOpenChannel this_ptr_conv;
30911         this_ptr_conv.inner = untag_ptr(this_ptr);
30912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30914         this_ptr_conv.is_owned = false;
30915         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
30916         return ret_conv;
30917 }
30918
30919 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
30920         LDKOpenChannel this_ptr_conv;
30921         this_ptr_conv.inner = untag_ptr(this_ptr);
30922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30924         this_ptr_conv.is_owned = false;
30925         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
30926 }
30927
30928 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
30929         LDKOpenChannel this_ptr_conv;
30930         this_ptr_conv.inner = untag_ptr(this_ptr);
30931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30933         this_ptr_conv.is_owned = false;
30934         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
30935         return ret_conv;
30936 }
30937
30938 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
30939         LDKOpenChannel this_ptr_conv;
30940         this_ptr_conv.inner = untag_ptr(this_ptr);
30941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30943         this_ptr_conv.is_owned = false;
30944         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30945 }
30946
30947 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
30948         LDKOpenChannel this_ptr_conv;
30949         this_ptr_conv.inner = untag_ptr(this_ptr);
30950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30952         this_ptr_conv.is_owned = false;
30953         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30954         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
30955         return ret_arr;
30956 }
30957
30958 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
30959         LDKOpenChannel this_ptr_conv;
30960         this_ptr_conv.inner = untag_ptr(this_ptr);
30961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30963         this_ptr_conv.is_owned = false;
30964         LDKPublicKey val_ref;
30965         CHECK(val->arr_len == 33);
30966         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30967         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30968 }
30969
30970 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
30971         LDKOpenChannel this_ptr_conv;
30972         this_ptr_conv.inner = untag_ptr(this_ptr);
30973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30975         this_ptr_conv.is_owned = false;
30976         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30977         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
30978         return ret_arr;
30979 }
30980
30981 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
30982         LDKOpenChannel this_ptr_conv;
30983         this_ptr_conv.inner = untag_ptr(this_ptr);
30984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30986         this_ptr_conv.is_owned = false;
30987         LDKPublicKey val_ref;
30988         CHECK(val->arr_len == 33);
30989         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30990         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30991 }
30992
30993 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
30994         LDKOpenChannel this_ptr_conv;
30995         this_ptr_conv.inner = untag_ptr(this_ptr);
30996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30998         this_ptr_conv.is_owned = false;
30999         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31000         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31001         return ret_arr;
31002 }
31003
31004 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31005         LDKOpenChannel this_ptr_conv;
31006         this_ptr_conv.inner = untag_ptr(this_ptr);
31007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31009         this_ptr_conv.is_owned = false;
31010         LDKPublicKey val_ref;
31011         CHECK(val->arr_len == 33);
31012         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31013         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31014 }
31015
31016 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31017         LDKOpenChannel this_ptr_conv;
31018         this_ptr_conv.inner = untag_ptr(this_ptr);
31019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31021         this_ptr_conv.is_owned = false;
31022         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31023         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31024         return ret_arr;
31025 }
31026
31027 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31028         LDKOpenChannel this_ptr_conv;
31029         this_ptr_conv.inner = untag_ptr(this_ptr);
31030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31032         this_ptr_conv.is_owned = false;
31033         LDKPublicKey val_ref;
31034         CHECK(val->arr_len == 33);
31035         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31036         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31037 }
31038
31039 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
31040         LDKOpenChannel this_ptr_conv;
31041         this_ptr_conv.inner = untag_ptr(this_ptr);
31042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31044         this_ptr_conv.is_owned = false;
31045         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31046         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31047         return ret_arr;
31048 }
31049
31050 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31051         LDKOpenChannel this_ptr_conv;
31052         this_ptr_conv.inner = untag_ptr(this_ptr);
31053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31055         this_ptr_conv.is_owned = false;
31056         LDKPublicKey val_ref;
31057         CHECK(val->arr_len == 33);
31058         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31059         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31060 }
31061
31062 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31063         LDKOpenChannel this_ptr_conv;
31064         this_ptr_conv.inner = untag_ptr(this_ptr);
31065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31067         this_ptr_conv.is_owned = false;
31068         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31069         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31070         return ret_arr;
31071 }
31072
31073 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) {
31074         LDKOpenChannel this_ptr_conv;
31075         this_ptr_conv.inner = untag_ptr(this_ptr);
31076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31078         this_ptr_conv.is_owned = false;
31079         LDKPublicKey val_ref;
31080         CHECK(val->arr_len == 33);
31081         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31082         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31083 }
31084
31085 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
31086         LDKOpenChannel this_ptr_conv;
31087         this_ptr_conv.inner = untag_ptr(this_ptr);
31088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31090         this_ptr_conv.is_owned = false;
31091         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31092         return ret_conv;
31093 }
31094
31095 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
31096         LDKOpenChannel this_ptr_conv;
31097         this_ptr_conv.inner = untag_ptr(this_ptr);
31098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31100         this_ptr_conv.is_owned = false;
31101         OpenChannel_set_channel_flags(&this_ptr_conv, val);
31102 }
31103
31104 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
31105         LDKOpenChannel this_ptr_conv;
31106         this_ptr_conv.inner = untag_ptr(this_ptr);
31107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31109         this_ptr_conv.is_owned = false;
31110         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31111         uint64_t ret_ref = 0;
31112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31114         return ret_ref;
31115 }
31116
31117 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31118         LDKOpenChannel this_ptr_conv;
31119         this_ptr_conv.inner = untag_ptr(this_ptr);
31120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31122         this_ptr_conv.is_owned = false;
31123         LDKChannelTypeFeatures val_conv;
31124         val_conv.inner = untag_ptr(val);
31125         val_conv.is_owned = ptr_is_owned(val);
31126         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31127         val_conv = ChannelTypeFeatures_clone(&val_conv);
31128         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31129 }
31130
31131 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31132         LDKOpenChannel ret_var = OpenChannel_clone(arg);
31133         uint64_t ret_ref = 0;
31134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31136         return ret_ref;
31137 }
31138 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
31139         LDKOpenChannel arg_conv;
31140         arg_conv.inner = untag_ptr(arg);
31141         arg_conv.is_owned = ptr_is_owned(arg);
31142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31143         arg_conv.is_owned = false;
31144         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31145         return ret_conv;
31146 }
31147
31148 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
31149         LDKOpenChannel orig_conv;
31150         orig_conv.inner = untag_ptr(orig);
31151         orig_conv.is_owned = ptr_is_owned(orig);
31152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31153         orig_conv.is_owned = false;
31154         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31155         uint64_t ret_ref = 0;
31156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31158         return ret_ref;
31159 }
31160
31161 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
31162         LDKOpenChannel a_conv;
31163         a_conv.inner = untag_ptr(a);
31164         a_conv.is_owned = ptr_is_owned(a);
31165         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31166         a_conv.is_owned = false;
31167         LDKOpenChannel b_conv;
31168         b_conv.inner = untag_ptr(b);
31169         b_conv.is_owned = ptr_is_owned(b);
31170         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31171         b_conv.is_owned = false;
31172         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
31173         return ret_conv;
31174 }
31175
31176 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
31177         LDKAcceptChannel this_obj_conv;
31178         this_obj_conv.inner = untag_ptr(this_obj);
31179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31181         AcceptChannel_free(this_obj_conv);
31182 }
31183
31184 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
31185         LDKAcceptChannel this_ptr_conv;
31186         this_ptr_conv.inner = untag_ptr(this_ptr);
31187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31189         this_ptr_conv.is_owned = false;
31190         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31191         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
31192         return ret_arr;
31193 }
31194
31195 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31196         LDKAcceptChannel this_ptr_conv;
31197         this_ptr_conv.inner = untag_ptr(this_ptr);
31198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31200         this_ptr_conv.is_owned = false;
31201         LDKThirtyTwoBytes val_ref;
31202         CHECK(val->arr_len == 32);
31203         memcpy(val_ref.data, val->elems, 32); FREE(val);
31204         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31205 }
31206
31207 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
31208         LDKAcceptChannel this_ptr_conv;
31209         this_ptr_conv.inner = untag_ptr(this_ptr);
31210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31212         this_ptr_conv.is_owned = false;
31213         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31214         return ret_conv;
31215 }
31216
31217 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
31218         LDKAcceptChannel this_ptr_conv;
31219         this_ptr_conv.inner = untag_ptr(this_ptr);
31220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31222         this_ptr_conv.is_owned = false;
31223         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31224 }
31225
31226 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) {
31227         LDKAcceptChannel this_ptr_conv;
31228         this_ptr_conv.inner = untag_ptr(this_ptr);
31229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31231         this_ptr_conv.is_owned = false;
31232         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31233         return ret_conv;
31234 }
31235
31236 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) {
31237         LDKAcceptChannel this_ptr_conv;
31238         this_ptr_conv.inner = untag_ptr(this_ptr);
31239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31241         this_ptr_conv.is_owned = false;
31242         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31243 }
31244
31245 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
31246         LDKAcceptChannel this_ptr_conv;
31247         this_ptr_conv.inner = untag_ptr(this_ptr);
31248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31250         this_ptr_conv.is_owned = false;
31251         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31252         return ret_conv;
31253 }
31254
31255 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
31256         LDKAcceptChannel this_ptr_conv;
31257         this_ptr_conv.inner = untag_ptr(this_ptr);
31258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31260         this_ptr_conv.is_owned = false;
31261         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31262 }
31263
31264 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
31265         LDKAcceptChannel this_ptr_conv;
31266         this_ptr_conv.inner = untag_ptr(this_ptr);
31267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31269         this_ptr_conv.is_owned = false;
31270         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31271         return ret_conv;
31272 }
31273
31274 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
31275         LDKAcceptChannel this_ptr_conv;
31276         this_ptr_conv.inner = untag_ptr(this_ptr);
31277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31279         this_ptr_conv.is_owned = false;
31280         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31281 }
31282
31283 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
31284         LDKAcceptChannel this_ptr_conv;
31285         this_ptr_conv.inner = untag_ptr(this_ptr);
31286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31288         this_ptr_conv.is_owned = false;
31289         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31290         return ret_conv;
31291 }
31292
31293 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
31294         LDKAcceptChannel this_ptr_conv;
31295         this_ptr_conv.inner = untag_ptr(this_ptr);
31296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31298         this_ptr_conv.is_owned = false;
31299         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31300 }
31301
31302 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
31303         LDKAcceptChannel this_ptr_conv;
31304         this_ptr_conv.inner = untag_ptr(this_ptr);
31305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31307         this_ptr_conv.is_owned = false;
31308         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31309         return ret_conv;
31310 }
31311
31312 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
31313         LDKAcceptChannel this_ptr_conv;
31314         this_ptr_conv.inner = untag_ptr(this_ptr);
31315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31317         this_ptr_conv.is_owned = false;
31318         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31319 }
31320
31321 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
31322         LDKAcceptChannel this_ptr_conv;
31323         this_ptr_conv.inner = untag_ptr(this_ptr);
31324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31326         this_ptr_conv.is_owned = false;
31327         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31328         return ret_conv;
31329 }
31330
31331 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
31332         LDKAcceptChannel this_ptr_conv;
31333         this_ptr_conv.inner = untag_ptr(this_ptr);
31334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31336         this_ptr_conv.is_owned = false;
31337         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31338 }
31339
31340 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
31341         LDKAcceptChannel this_ptr_conv;
31342         this_ptr_conv.inner = untag_ptr(this_ptr);
31343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31345         this_ptr_conv.is_owned = false;
31346         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31347         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
31348         return ret_arr;
31349 }
31350
31351 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
31352         LDKAcceptChannel this_ptr_conv;
31353         this_ptr_conv.inner = untag_ptr(this_ptr);
31354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31356         this_ptr_conv.is_owned = false;
31357         LDKPublicKey val_ref;
31358         CHECK(val->arr_len == 33);
31359         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31360         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31361 }
31362
31363 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
31364         LDKAcceptChannel this_ptr_conv;
31365         this_ptr_conv.inner = untag_ptr(this_ptr);
31366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31368         this_ptr_conv.is_owned = false;
31369         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31370         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
31371         return ret_arr;
31372 }
31373
31374 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31375         LDKAcceptChannel this_ptr_conv;
31376         this_ptr_conv.inner = untag_ptr(this_ptr);
31377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31379         this_ptr_conv.is_owned = false;
31380         LDKPublicKey val_ref;
31381         CHECK(val->arr_len == 33);
31382         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31383         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31384 }
31385
31386 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
31387         LDKAcceptChannel this_ptr_conv;
31388         this_ptr_conv.inner = untag_ptr(this_ptr);
31389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31391         this_ptr_conv.is_owned = false;
31392         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31393         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31394         return ret_arr;
31395 }
31396
31397 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31398         LDKAcceptChannel this_ptr_conv;
31399         this_ptr_conv.inner = untag_ptr(this_ptr);
31400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31402         this_ptr_conv.is_owned = false;
31403         LDKPublicKey val_ref;
31404         CHECK(val->arr_len == 33);
31405         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31406         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31407 }
31408
31409 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31410         LDKAcceptChannel this_ptr_conv;
31411         this_ptr_conv.inner = untag_ptr(this_ptr);
31412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31414         this_ptr_conv.is_owned = false;
31415         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31416         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31417         return ret_arr;
31418 }
31419
31420 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31421         LDKAcceptChannel this_ptr_conv;
31422         this_ptr_conv.inner = untag_ptr(this_ptr);
31423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31425         this_ptr_conv.is_owned = false;
31426         LDKPublicKey val_ref;
31427         CHECK(val->arr_len == 33);
31428         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31429         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31430 }
31431
31432 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
31433         LDKAcceptChannel this_ptr_conv;
31434         this_ptr_conv.inner = untag_ptr(this_ptr);
31435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31437         this_ptr_conv.is_owned = false;
31438         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31439         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31440         return ret_arr;
31441 }
31442
31443 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31444         LDKAcceptChannel this_ptr_conv;
31445         this_ptr_conv.inner = untag_ptr(this_ptr);
31446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31448         this_ptr_conv.is_owned = false;
31449         LDKPublicKey val_ref;
31450         CHECK(val->arr_len == 33);
31451         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31452         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31453 }
31454
31455 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31456         LDKAcceptChannel this_ptr_conv;
31457         this_ptr_conv.inner = untag_ptr(this_ptr);
31458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31460         this_ptr_conv.is_owned = false;
31461         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31462         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31463         return ret_arr;
31464 }
31465
31466 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) {
31467         LDKAcceptChannel this_ptr_conv;
31468         this_ptr_conv.inner = untag_ptr(this_ptr);
31469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31471         this_ptr_conv.is_owned = false;
31472         LDKPublicKey val_ref;
31473         CHECK(val->arr_len == 33);
31474         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31475         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31476 }
31477
31478 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
31479         LDKAcceptChannel this_ptr_conv;
31480         this_ptr_conv.inner = untag_ptr(this_ptr);
31481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31483         this_ptr_conv.is_owned = false;
31484         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31485         uint64_t ret_ref = 0;
31486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31488         return ret_ref;
31489 }
31490
31491 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31492         LDKAcceptChannel this_ptr_conv;
31493         this_ptr_conv.inner = untag_ptr(this_ptr);
31494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31496         this_ptr_conv.is_owned = false;
31497         LDKChannelTypeFeatures val_conv;
31498         val_conv.inner = untag_ptr(val);
31499         val_conv.is_owned = ptr_is_owned(val);
31500         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31501         val_conv = ChannelTypeFeatures_clone(&val_conv);
31502         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31503 }
31504
31505 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31506         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31507         uint64_t ret_ref = 0;
31508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31510         return ret_ref;
31511 }
31512 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
31513         LDKAcceptChannel arg_conv;
31514         arg_conv.inner = untag_ptr(arg);
31515         arg_conv.is_owned = ptr_is_owned(arg);
31516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31517         arg_conv.is_owned = false;
31518         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31519         return ret_conv;
31520 }
31521
31522 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
31523         LDKAcceptChannel orig_conv;
31524         orig_conv.inner = untag_ptr(orig);
31525         orig_conv.is_owned = ptr_is_owned(orig);
31526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31527         orig_conv.is_owned = false;
31528         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31529         uint64_t ret_ref = 0;
31530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31532         return ret_ref;
31533 }
31534
31535 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
31536         LDKAcceptChannel a_conv;
31537         a_conv.inner = untag_ptr(a);
31538         a_conv.is_owned = ptr_is_owned(a);
31539         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31540         a_conv.is_owned = false;
31541         LDKAcceptChannel b_conv;
31542         b_conv.inner = untag_ptr(b);
31543         b_conv.is_owned = ptr_is_owned(b);
31544         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31545         b_conv.is_owned = false;
31546         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
31547         return ret_conv;
31548 }
31549
31550 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
31551         LDKFundingCreated this_obj_conv;
31552         this_obj_conv.inner = untag_ptr(this_obj);
31553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31555         FundingCreated_free(this_obj_conv);
31556 }
31557
31558 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
31559         LDKFundingCreated this_ptr_conv;
31560         this_ptr_conv.inner = untag_ptr(this_ptr);
31561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31563         this_ptr_conv.is_owned = false;
31564         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31565         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
31566         return ret_arr;
31567 }
31568
31569 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31570         LDKFundingCreated this_ptr_conv;
31571         this_ptr_conv.inner = untag_ptr(this_ptr);
31572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31574         this_ptr_conv.is_owned = false;
31575         LDKThirtyTwoBytes val_ref;
31576         CHECK(val->arr_len == 32);
31577         memcpy(val_ref.data, val->elems, 32); FREE(val);
31578         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31579 }
31580
31581 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
31582         LDKFundingCreated this_ptr_conv;
31583         this_ptr_conv.inner = untag_ptr(this_ptr);
31584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31586         this_ptr_conv.is_owned = false;
31587         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31588         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
31589         return ret_arr;
31590 }
31591
31592 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
31593         LDKFundingCreated this_ptr_conv;
31594         this_ptr_conv.inner = untag_ptr(this_ptr);
31595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31597         this_ptr_conv.is_owned = false;
31598         LDKThirtyTwoBytes val_ref;
31599         CHECK(val->arr_len == 32);
31600         memcpy(val_ref.data, val->elems, 32); FREE(val);
31601         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31602 }
31603
31604 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
31605         LDKFundingCreated this_ptr_conv;
31606         this_ptr_conv.inner = untag_ptr(this_ptr);
31607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31609         this_ptr_conv.is_owned = false;
31610         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31611         return ret_conv;
31612 }
31613
31614 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
31615         LDKFundingCreated this_ptr_conv;
31616         this_ptr_conv.inner = untag_ptr(this_ptr);
31617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31619         this_ptr_conv.is_owned = false;
31620         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31621 }
31622
31623 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
31624         LDKFundingCreated this_ptr_conv;
31625         this_ptr_conv.inner = untag_ptr(this_ptr);
31626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31628         this_ptr_conv.is_owned = false;
31629         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31630         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
31631         return ret_arr;
31632 }
31633
31634 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
31635         LDKFundingCreated this_ptr_conv;
31636         this_ptr_conv.inner = untag_ptr(this_ptr);
31637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31639         this_ptr_conv.is_owned = false;
31640         LDKSignature val_ref;
31641         CHECK(val->arr_len == 64);
31642         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31643         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31644 }
31645
31646 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) {
31647         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31648         CHECK(temporary_channel_id_arg->arr_len == 32);
31649         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
31650         LDKThirtyTwoBytes funding_txid_arg_ref;
31651         CHECK(funding_txid_arg->arr_len == 32);
31652         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
31653         LDKSignature signature_arg_ref;
31654         CHECK(signature_arg->arr_len == 64);
31655         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31656         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31657         uint64_t ret_ref = 0;
31658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31660         return ret_ref;
31661 }
31662
31663 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31664         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31665         uint64_t ret_ref = 0;
31666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31668         return ret_ref;
31669 }
31670 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
31671         LDKFundingCreated arg_conv;
31672         arg_conv.inner = untag_ptr(arg);
31673         arg_conv.is_owned = ptr_is_owned(arg);
31674         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31675         arg_conv.is_owned = false;
31676         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31677         return ret_conv;
31678 }
31679
31680 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
31681         LDKFundingCreated orig_conv;
31682         orig_conv.inner = untag_ptr(orig);
31683         orig_conv.is_owned = ptr_is_owned(orig);
31684         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31685         orig_conv.is_owned = false;
31686         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31687         uint64_t ret_ref = 0;
31688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31690         return ret_ref;
31691 }
31692
31693 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
31694         LDKFundingCreated a_conv;
31695         a_conv.inner = untag_ptr(a);
31696         a_conv.is_owned = ptr_is_owned(a);
31697         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31698         a_conv.is_owned = false;
31699         LDKFundingCreated b_conv;
31700         b_conv.inner = untag_ptr(b);
31701         b_conv.is_owned = ptr_is_owned(b);
31702         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31703         b_conv.is_owned = false;
31704         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
31705         return ret_conv;
31706 }
31707
31708 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
31709         LDKFundingSigned this_obj_conv;
31710         this_obj_conv.inner = untag_ptr(this_obj);
31711         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31713         FundingSigned_free(this_obj_conv);
31714 }
31715
31716 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
31717         LDKFundingSigned this_ptr_conv;
31718         this_ptr_conv.inner = untag_ptr(this_ptr);
31719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31721         this_ptr_conv.is_owned = false;
31722         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31723         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
31724         return ret_arr;
31725 }
31726
31727 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31728         LDKFundingSigned this_ptr_conv;
31729         this_ptr_conv.inner = untag_ptr(this_ptr);
31730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31732         this_ptr_conv.is_owned = false;
31733         LDKThirtyTwoBytes val_ref;
31734         CHECK(val->arr_len == 32);
31735         memcpy(val_ref.data, val->elems, 32); FREE(val);
31736         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31737 }
31738
31739 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
31740         LDKFundingSigned this_ptr_conv;
31741         this_ptr_conv.inner = untag_ptr(this_ptr);
31742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31744         this_ptr_conv.is_owned = false;
31745         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31746         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31747         return ret_arr;
31748 }
31749
31750 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31751         LDKFundingSigned this_ptr_conv;
31752         this_ptr_conv.inner = untag_ptr(this_ptr);
31753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31755         this_ptr_conv.is_owned = false;
31756         LDKSignature val_ref;
31757         CHECK(val->arr_len == 64);
31758         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31759         FundingSigned_set_signature(&this_ptr_conv, val_ref);
31760 }
31761
31762 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
31763         LDKThirtyTwoBytes channel_id_arg_ref;
31764         CHECK(channel_id_arg->arr_len == 32);
31765         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31766         LDKSignature signature_arg_ref;
31767         CHECK(signature_arg->arr_len == 64);
31768         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31769         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31770         uint64_t ret_ref = 0;
31771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31773         return ret_ref;
31774 }
31775
31776 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31777         LDKFundingSigned ret_var = FundingSigned_clone(arg);
31778         uint64_t ret_ref = 0;
31779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31781         return ret_ref;
31782 }
31783 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
31784         LDKFundingSigned arg_conv;
31785         arg_conv.inner = untag_ptr(arg);
31786         arg_conv.is_owned = ptr_is_owned(arg);
31787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31788         arg_conv.is_owned = false;
31789         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31790         return ret_conv;
31791 }
31792
31793 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
31794         LDKFundingSigned orig_conv;
31795         orig_conv.inner = untag_ptr(orig);
31796         orig_conv.is_owned = ptr_is_owned(orig);
31797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31798         orig_conv.is_owned = false;
31799         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31800         uint64_t ret_ref = 0;
31801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31803         return ret_ref;
31804 }
31805
31806 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
31807         LDKFundingSigned a_conv;
31808         a_conv.inner = untag_ptr(a);
31809         a_conv.is_owned = ptr_is_owned(a);
31810         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31811         a_conv.is_owned = false;
31812         LDKFundingSigned b_conv;
31813         b_conv.inner = untag_ptr(b);
31814         b_conv.is_owned = ptr_is_owned(b);
31815         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31816         b_conv.is_owned = false;
31817         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
31818         return ret_conv;
31819 }
31820
31821 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
31822         LDKChannelReady this_obj_conv;
31823         this_obj_conv.inner = untag_ptr(this_obj);
31824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31826         ChannelReady_free(this_obj_conv);
31827 }
31828
31829 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
31830         LDKChannelReady this_ptr_conv;
31831         this_ptr_conv.inner = untag_ptr(this_ptr);
31832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31834         this_ptr_conv.is_owned = false;
31835         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31836         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
31837         return ret_arr;
31838 }
31839
31840 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31841         LDKChannelReady this_ptr_conv;
31842         this_ptr_conv.inner = untag_ptr(this_ptr);
31843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31845         this_ptr_conv.is_owned = false;
31846         LDKThirtyTwoBytes val_ref;
31847         CHECK(val->arr_len == 32);
31848         memcpy(val_ref.data, val->elems, 32); FREE(val);
31849         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
31850 }
31851
31852 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
31853         LDKChannelReady this_ptr_conv;
31854         this_ptr_conv.inner = untag_ptr(this_ptr);
31855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31857         this_ptr_conv.is_owned = false;
31858         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31859         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31860         return ret_arr;
31861 }
31862
31863 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) {
31864         LDKChannelReady this_ptr_conv;
31865         this_ptr_conv.inner = untag_ptr(this_ptr);
31866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31868         this_ptr_conv.is_owned = false;
31869         LDKPublicKey val_ref;
31870         CHECK(val->arr_len == 33);
31871         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31872         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31873 }
31874
31875 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
31876         LDKChannelReady this_ptr_conv;
31877         this_ptr_conv.inner = untag_ptr(this_ptr);
31878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31880         this_ptr_conv.is_owned = false;
31881         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31882         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
31883         uint64_t ret_ref = tag_ptr(ret_copy, true);
31884         return ret_ref;
31885 }
31886
31887 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) {
31888         LDKChannelReady this_ptr_conv;
31889         this_ptr_conv.inner = untag_ptr(this_ptr);
31890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31892         this_ptr_conv.is_owned = false;
31893         void* val_ptr = untag_ptr(val);
31894         CHECK_ACCESS(val_ptr);
31895         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31896         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31897         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
31898 }
31899
31900 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) {
31901         LDKThirtyTwoBytes channel_id_arg_ref;
31902         CHECK(channel_id_arg->arr_len == 32);
31903         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31904         LDKPublicKey next_per_commitment_point_arg_ref;
31905         CHECK(next_per_commitment_point_arg->arr_len == 33);
31906         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
31907         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
31908         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
31909         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
31910         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
31911         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
31912         uint64_t ret_ref = 0;
31913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31915         return ret_ref;
31916 }
31917
31918 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
31919         LDKChannelReady ret_var = ChannelReady_clone(arg);
31920         uint64_t ret_ref = 0;
31921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31923         return ret_ref;
31924 }
31925 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
31926         LDKChannelReady arg_conv;
31927         arg_conv.inner = untag_ptr(arg);
31928         arg_conv.is_owned = ptr_is_owned(arg);
31929         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31930         arg_conv.is_owned = false;
31931         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
31932         return ret_conv;
31933 }
31934
31935 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
31936         LDKChannelReady orig_conv;
31937         orig_conv.inner = untag_ptr(orig);
31938         orig_conv.is_owned = ptr_is_owned(orig);
31939         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31940         orig_conv.is_owned = false;
31941         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
31942         uint64_t ret_ref = 0;
31943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31945         return ret_ref;
31946 }
31947
31948 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
31949         LDKChannelReady a_conv;
31950         a_conv.inner = untag_ptr(a);
31951         a_conv.is_owned = ptr_is_owned(a);
31952         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31953         a_conv.is_owned = false;
31954         LDKChannelReady b_conv;
31955         b_conv.inner = untag_ptr(b);
31956         b_conv.is_owned = ptr_is_owned(b);
31957         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31958         b_conv.is_owned = false;
31959         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
31960         return ret_conv;
31961 }
31962
31963 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
31964         LDKShutdown this_obj_conv;
31965         this_obj_conv.inner = untag_ptr(this_obj);
31966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31968         Shutdown_free(this_obj_conv);
31969 }
31970
31971 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
31972         LDKShutdown this_ptr_conv;
31973         this_ptr_conv.inner = untag_ptr(this_ptr);
31974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31976         this_ptr_conv.is_owned = false;
31977         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31978         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
31979         return ret_arr;
31980 }
31981
31982 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31983         LDKShutdown this_ptr_conv;
31984         this_ptr_conv.inner = untag_ptr(this_ptr);
31985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31987         this_ptr_conv.is_owned = false;
31988         LDKThirtyTwoBytes val_ref;
31989         CHECK(val->arr_len == 32);
31990         memcpy(val_ref.data, val->elems, 32); FREE(val);
31991         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
31992 }
31993
31994 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
31995         LDKShutdown this_ptr_conv;
31996         this_ptr_conv.inner = untag_ptr(this_ptr);
31997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31999         this_ptr_conv.is_owned = false;
32000         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32001         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32002         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32003         return ret_arr;
32004 }
32005
32006 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
32007         LDKShutdown this_ptr_conv;
32008         this_ptr_conv.inner = untag_ptr(this_ptr);
32009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32011         this_ptr_conv.is_owned = false;
32012         LDKCVec_u8Z val_ref;
32013         val_ref.datalen = val->arr_len;
32014         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32015         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32016         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32017 }
32018
32019 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32020         LDKThirtyTwoBytes channel_id_arg_ref;
32021         CHECK(channel_id_arg->arr_len == 32);
32022         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32023         LDKCVec_u8Z scriptpubkey_arg_ref;
32024         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
32025         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32026         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
32027         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32028         uint64_t ret_ref = 0;
32029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32031         return ret_ref;
32032 }
32033
32034 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32035         LDKShutdown ret_var = Shutdown_clone(arg);
32036         uint64_t ret_ref = 0;
32037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32039         return ret_ref;
32040 }
32041 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
32042         LDKShutdown arg_conv;
32043         arg_conv.inner = untag_ptr(arg);
32044         arg_conv.is_owned = ptr_is_owned(arg);
32045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32046         arg_conv.is_owned = false;
32047         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32048         return ret_conv;
32049 }
32050
32051 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
32052         LDKShutdown orig_conv;
32053         orig_conv.inner = untag_ptr(orig);
32054         orig_conv.is_owned = ptr_is_owned(orig);
32055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32056         orig_conv.is_owned = false;
32057         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32058         uint64_t ret_ref = 0;
32059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32061         return ret_ref;
32062 }
32063
32064 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
32065         LDKShutdown a_conv;
32066         a_conv.inner = untag_ptr(a);
32067         a_conv.is_owned = ptr_is_owned(a);
32068         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32069         a_conv.is_owned = false;
32070         LDKShutdown b_conv;
32071         b_conv.inner = untag_ptr(b);
32072         b_conv.is_owned = ptr_is_owned(b);
32073         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32074         b_conv.is_owned = false;
32075         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
32076         return ret_conv;
32077 }
32078
32079 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
32080         LDKClosingSignedFeeRange this_obj_conv;
32081         this_obj_conv.inner = untag_ptr(this_obj);
32082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32084         ClosingSignedFeeRange_free(this_obj_conv);
32085 }
32086
32087 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
32088         LDKClosingSignedFeeRange this_ptr_conv;
32089         this_ptr_conv.inner = untag_ptr(this_ptr);
32090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32092         this_ptr_conv.is_owned = false;
32093         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32094         return ret_conv;
32095 }
32096
32097 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
32098         LDKClosingSignedFeeRange this_ptr_conv;
32099         this_ptr_conv.inner = untag_ptr(this_ptr);
32100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32102         this_ptr_conv.is_owned = false;
32103         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32104 }
32105
32106 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
32107         LDKClosingSignedFeeRange this_ptr_conv;
32108         this_ptr_conv.inner = untag_ptr(this_ptr);
32109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32111         this_ptr_conv.is_owned = false;
32112         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32113         return ret_conv;
32114 }
32115
32116 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
32117         LDKClosingSignedFeeRange this_ptr_conv;
32118         this_ptr_conv.inner = untag_ptr(this_ptr);
32119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32121         this_ptr_conv.is_owned = false;
32122         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32123 }
32124
32125 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
32126         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32127         uint64_t ret_ref = 0;
32128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32130         return ret_ref;
32131 }
32132
32133 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32134         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32135         uint64_t ret_ref = 0;
32136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32138         return ret_ref;
32139 }
32140 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
32141         LDKClosingSignedFeeRange arg_conv;
32142         arg_conv.inner = untag_ptr(arg);
32143         arg_conv.is_owned = ptr_is_owned(arg);
32144         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32145         arg_conv.is_owned = false;
32146         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32147         return ret_conv;
32148 }
32149
32150 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
32151         LDKClosingSignedFeeRange orig_conv;
32152         orig_conv.inner = untag_ptr(orig);
32153         orig_conv.is_owned = ptr_is_owned(orig);
32154         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32155         orig_conv.is_owned = false;
32156         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32157         uint64_t ret_ref = 0;
32158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32160         return ret_ref;
32161 }
32162
32163 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
32164         LDKClosingSignedFeeRange a_conv;
32165         a_conv.inner = untag_ptr(a);
32166         a_conv.is_owned = ptr_is_owned(a);
32167         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32168         a_conv.is_owned = false;
32169         LDKClosingSignedFeeRange b_conv;
32170         b_conv.inner = untag_ptr(b);
32171         b_conv.is_owned = ptr_is_owned(b);
32172         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32173         b_conv.is_owned = false;
32174         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
32175         return ret_conv;
32176 }
32177
32178 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
32179         LDKClosingSigned this_obj_conv;
32180         this_obj_conv.inner = untag_ptr(this_obj);
32181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32183         ClosingSigned_free(this_obj_conv);
32184 }
32185
32186 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
32187         LDKClosingSigned this_ptr_conv;
32188         this_ptr_conv.inner = untag_ptr(this_ptr);
32189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32191         this_ptr_conv.is_owned = false;
32192         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32193         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
32194         return ret_arr;
32195 }
32196
32197 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32198         LDKClosingSigned this_ptr_conv;
32199         this_ptr_conv.inner = untag_ptr(this_ptr);
32200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32202         this_ptr_conv.is_owned = false;
32203         LDKThirtyTwoBytes val_ref;
32204         CHECK(val->arr_len == 32);
32205         memcpy(val_ref.data, val->elems, 32); FREE(val);
32206         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32207 }
32208
32209 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
32210         LDKClosingSigned this_ptr_conv;
32211         this_ptr_conv.inner = untag_ptr(this_ptr);
32212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32214         this_ptr_conv.is_owned = false;
32215         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32216         return ret_conv;
32217 }
32218
32219 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
32220         LDKClosingSigned this_ptr_conv;
32221         this_ptr_conv.inner = untag_ptr(this_ptr);
32222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32224         this_ptr_conv.is_owned = false;
32225         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32226 }
32227
32228 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
32229         LDKClosingSigned this_ptr_conv;
32230         this_ptr_conv.inner = untag_ptr(this_ptr);
32231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32233         this_ptr_conv.is_owned = false;
32234         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32235         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
32236         return ret_arr;
32237 }
32238
32239 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32240         LDKClosingSigned this_ptr_conv;
32241         this_ptr_conv.inner = untag_ptr(this_ptr);
32242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32244         this_ptr_conv.is_owned = false;
32245         LDKSignature val_ref;
32246         CHECK(val->arr_len == 64);
32247         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32248         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32249 }
32250
32251 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
32252         LDKClosingSigned this_ptr_conv;
32253         this_ptr_conv.inner = untag_ptr(this_ptr);
32254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32256         this_ptr_conv.is_owned = false;
32257         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32258         uint64_t ret_ref = 0;
32259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32261         return ret_ref;
32262 }
32263
32264 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
32265         LDKClosingSigned this_ptr_conv;
32266         this_ptr_conv.inner = untag_ptr(this_ptr);
32267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32269         this_ptr_conv.is_owned = false;
32270         LDKClosingSignedFeeRange val_conv;
32271         val_conv.inner = untag_ptr(val);
32272         val_conv.is_owned = ptr_is_owned(val);
32273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32274         val_conv = ClosingSignedFeeRange_clone(&val_conv);
32275         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32276 }
32277
32278 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) {
32279         LDKThirtyTwoBytes channel_id_arg_ref;
32280         CHECK(channel_id_arg->arr_len == 32);
32281         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32282         LDKSignature signature_arg_ref;
32283         CHECK(signature_arg->arr_len == 64);
32284         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32285         LDKClosingSignedFeeRange fee_range_arg_conv;
32286         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
32287         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
32288         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32289         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32290         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
32291         uint64_t ret_ref = 0;
32292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32294         return ret_ref;
32295 }
32296
32297 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32298         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
32299         uint64_t ret_ref = 0;
32300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32302         return ret_ref;
32303 }
32304 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
32305         LDKClosingSigned arg_conv;
32306         arg_conv.inner = untag_ptr(arg);
32307         arg_conv.is_owned = ptr_is_owned(arg);
32308         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32309         arg_conv.is_owned = false;
32310         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
32311         return ret_conv;
32312 }
32313
32314 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
32315         LDKClosingSigned orig_conv;
32316         orig_conv.inner = untag_ptr(orig);
32317         orig_conv.is_owned = ptr_is_owned(orig);
32318         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32319         orig_conv.is_owned = false;
32320         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
32321         uint64_t ret_ref = 0;
32322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32324         return ret_ref;
32325 }
32326
32327 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
32328         LDKClosingSigned a_conv;
32329         a_conv.inner = untag_ptr(a);
32330         a_conv.is_owned = ptr_is_owned(a);
32331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32332         a_conv.is_owned = false;
32333         LDKClosingSigned b_conv;
32334         b_conv.inner = untag_ptr(b);
32335         b_conv.is_owned = ptr_is_owned(b);
32336         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32337         b_conv.is_owned = false;
32338         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
32339         return ret_conv;
32340 }
32341
32342 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
32343         LDKUpdateAddHTLC this_obj_conv;
32344         this_obj_conv.inner = untag_ptr(this_obj);
32345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32347         UpdateAddHTLC_free(this_obj_conv);
32348 }
32349
32350 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
32351         LDKUpdateAddHTLC this_ptr_conv;
32352         this_ptr_conv.inner = untag_ptr(this_ptr);
32353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32355         this_ptr_conv.is_owned = false;
32356         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32357         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
32358         return ret_arr;
32359 }
32360
32361 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32362         LDKUpdateAddHTLC this_ptr_conv;
32363         this_ptr_conv.inner = untag_ptr(this_ptr);
32364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32366         this_ptr_conv.is_owned = false;
32367         LDKThirtyTwoBytes val_ref;
32368         CHECK(val->arr_len == 32);
32369         memcpy(val_ref.data, val->elems, 32); FREE(val);
32370         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32371 }
32372
32373 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
32374         LDKUpdateAddHTLC this_ptr_conv;
32375         this_ptr_conv.inner = untag_ptr(this_ptr);
32376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32378         this_ptr_conv.is_owned = false;
32379         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32380         return ret_conv;
32381 }
32382
32383 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32384         LDKUpdateAddHTLC this_ptr_conv;
32385         this_ptr_conv.inner = untag_ptr(this_ptr);
32386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32388         this_ptr_conv.is_owned = false;
32389         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32390 }
32391
32392 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
32393         LDKUpdateAddHTLC this_ptr_conv;
32394         this_ptr_conv.inner = untag_ptr(this_ptr);
32395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32397         this_ptr_conv.is_owned = false;
32398         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32399         return ret_conv;
32400 }
32401
32402 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
32403         LDKUpdateAddHTLC this_ptr_conv;
32404         this_ptr_conv.inner = untag_ptr(this_ptr);
32405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32407         this_ptr_conv.is_owned = false;
32408         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32409 }
32410
32411 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
32412         LDKUpdateAddHTLC this_ptr_conv;
32413         this_ptr_conv.inner = untag_ptr(this_ptr);
32414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32416         this_ptr_conv.is_owned = false;
32417         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32418         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
32419         return ret_arr;
32420 }
32421
32422 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
32423         LDKUpdateAddHTLC this_ptr_conv;
32424         this_ptr_conv.inner = untag_ptr(this_ptr);
32425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32427         this_ptr_conv.is_owned = false;
32428         LDKThirtyTwoBytes val_ref;
32429         CHECK(val->arr_len == 32);
32430         memcpy(val_ref.data, val->elems, 32); FREE(val);
32431         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32432 }
32433
32434 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
32435         LDKUpdateAddHTLC this_ptr_conv;
32436         this_ptr_conv.inner = untag_ptr(this_ptr);
32437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32439         this_ptr_conv.is_owned = false;
32440         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32441         return ret_conv;
32442 }
32443
32444 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
32445         LDKUpdateAddHTLC this_ptr_conv;
32446         this_ptr_conv.inner = untag_ptr(this_ptr);
32447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32449         this_ptr_conv.is_owned = false;
32450         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32451 }
32452
32453 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32454         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32455         uint64_t ret_ref = 0;
32456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32458         return ret_ref;
32459 }
32460 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
32461         LDKUpdateAddHTLC arg_conv;
32462         arg_conv.inner = untag_ptr(arg);
32463         arg_conv.is_owned = ptr_is_owned(arg);
32464         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32465         arg_conv.is_owned = false;
32466         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32467         return ret_conv;
32468 }
32469
32470 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
32471         LDKUpdateAddHTLC orig_conv;
32472         orig_conv.inner = untag_ptr(orig);
32473         orig_conv.is_owned = ptr_is_owned(orig);
32474         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32475         orig_conv.is_owned = false;
32476         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32477         uint64_t ret_ref = 0;
32478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32480         return ret_ref;
32481 }
32482
32483 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
32484         LDKUpdateAddHTLC a_conv;
32485         a_conv.inner = untag_ptr(a);
32486         a_conv.is_owned = ptr_is_owned(a);
32487         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32488         a_conv.is_owned = false;
32489         LDKUpdateAddHTLC b_conv;
32490         b_conv.inner = untag_ptr(b);
32491         b_conv.is_owned = ptr_is_owned(b);
32492         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32493         b_conv.is_owned = false;
32494         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
32495         return ret_conv;
32496 }
32497
32498 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
32499         LDKOnionMessage this_obj_conv;
32500         this_obj_conv.inner = untag_ptr(this_obj);
32501         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32503         OnionMessage_free(this_obj_conv);
32504 }
32505
32506 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
32507         LDKOnionMessage this_ptr_conv;
32508         this_ptr_conv.inner = untag_ptr(this_ptr);
32509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32511         this_ptr_conv.is_owned = false;
32512         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32513         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
32514         return ret_arr;
32515 }
32516
32517 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
32518         LDKOnionMessage this_ptr_conv;
32519         this_ptr_conv.inner = untag_ptr(this_ptr);
32520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32522         this_ptr_conv.is_owned = false;
32523         LDKPublicKey val_ref;
32524         CHECK(val->arr_len == 33);
32525         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32526         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
32527 }
32528
32529 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
32530         LDKOnionMessage ret_var = OnionMessage_clone(arg);
32531         uint64_t ret_ref = 0;
32532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32534         return ret_ref;
32535 }
32536 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
32537         LDKOnionMessage arg_conv;
32538         arg_conv.inner = untag_ptr(arg);
32539         arg_conv.is_owned = ptr_is_owned(arg);
32540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32541         arg_conv.is_owned = false;
32542         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
32543         return ret_conv;
32544 }
32545
32546 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
32547         LDKOnionMessage orig_conv;
32548         orig_conv.inner = untag_ptr(orig);
32549         orig_conv.is_owned = ptr_is_owned(orig);
32550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32551         orig_conv.is_owned = false;
32552         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
32553         uint64_t ret_ref = 0;
32554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32556         return ret_ref;
32557 }
32558
32559 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
32560         LDKOnionMessage a_conv;
32561         a_conv.inner = untag_ptr(a);
32562         a_conv.is_owned = ptr_is_owned(a);
32563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32564         a_conv.is_owned = false;
32565         LDKOnionMessage b_conv;
32566         b_conv.inner = untag_ptr(b);
32567         b_conv.is_owned = ptr_is_owned(b);
32568         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32569         b_conv.is_owned = false;
32570         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
32571         return ret_conv;
32572 }
32573
32574 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
32575         LDKUpdateFulfillHTLC this_obj_conv;
32576         this_obj_conv.inner = untag_ptr(this_obj);
32577         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32579         UpdateFulfillHTLC_free(this_obj_conv);
32580 }
32581
32582 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
32583         LDKUpdateFulfillHTLC this_ptr_conv;
32584         this_ptr_conv.inner = untag_ptr(this_ptr);
32585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32587         this_ptr_conv.is_owned = false;
32588         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32589         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
32590         return ret_arr;
32591 }
32592
32593 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32594         LDKUpdateFulfillHTLC this_ptr_conv;
32595         this_ptr_conv.inner = untag_ptr(this_ptr);
32596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32598         this_ptr_conv.is_owned = false;
32599         LDKThirtyTwoBytes val_ref;
32600         CHECK(val->arr_len == 32);
32601         memcpy(val_ref.data, val->elems, 32); FREE(val);
32602         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32603 }
32604
32605 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
32606         LDKUpdateFulfillHTLC this_ptr_conv;
32607         this_ptr_conv.inner = untag_ptr(this_ptr);
32608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32610         this_ptr_conv.is_owned = false;
32611         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32612         return ret_conv;
32613 }
32614
32615 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32616         LDKUpdateFulfillHTLC this_ptr_conv;
32617         this_ptr_conv.inner = untag_ptr(this_ptr);
32618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32620         this_ptr_conv.is_owned = false;
32621         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32622 }
32623
32624 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
32625         LDKUpdateFulfillHTLC this_ptr_conv;
32626         this_ptr_conv.inner = untag_ptr(this_ptr);
32627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32629         this_ptr_conv.is_owned = false;
32630         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32631         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
32632         return ret_arr;
32633 }
32634
32635 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
32636         LDKUpdateFulfillHTLC this_ptr_conv;
32637         this_ptr_conv.inner = untag_ptr(this_ptr);
32638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32640         this_ptr_conv.is_owned = false;
32641         LDKThirtyTwoBytes val_ref;
32642         CHECK(val->arr_len == 32);
32643         memcpy(val_ref.data, val->elems, 32); FREE(val);
32644         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32645 }
32646
32647 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) {
32648         LDKThirtyTwoBytes channel_id_arg_ref;
32649         CHECK(channel_id_arg->arr_len == 32);
32650         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32651         LDKThirtyTwoBytes payment_preimage_arg_ref;
32652         CHECK(payment_preimage_arg->arr_len == 32);
32653         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
32654         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32655         uint64_t ret_ref = 0;
32656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32658         return ret_ref;
32659 }
32660
32661 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32662         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32663         uint64_t ret_ref = 0;
32664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32666         return ret_ref;
32667 }
32668 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
32669         LDKUpdateFulfillHTLC arg_conv;
32670         arg_conv.inner = untag_ptr(arg);
32671         arg_conv.is_owned = ptr_is_owned(arg);
32672         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32673         arg_conv.is_owned = false;
32674         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32675         return ret_conv;
32676 }
32677
32678 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
32679         LDKUpdateFulfillHTLC orig_conv;
32680         orig_conv.inner = untag_ptr(orig);
32681         orig_conv.is_owned = ptr_is_owned(orig);
32682         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32683         orig_conv.is_owned = false;
32684         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32685         uint64_t ret_ref = 0;
32686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32688         return ret_ref;
32689 }
32690
32691 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
32692         LDKUpdateFulfillHTLC a_conv;
32693         a_conv.inner = untag_ptr(a);
32694         a_conv.is_owned = ptr_is_owned(a);
32695         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32696         a_conv.is_owned = false;
32697         LDKUpdateFulfillHTLC b_conv;
32698         b_conv.inner = untag_ptr(b);
32699         b_conv.is_owned = ptr_is_owned(b);
32700         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32701         b_conv.is_owned = false;
32702         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
32703         return ret_conv;
32704 }
32705
32706 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
32707         LDKUpdateFailHTLC this_obj_conv;
32708         this_obj_conv.inner = untag_ptr(this_obj);
32709         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32711         UpdateFailHTLC_free(this_obj_conv);
32712 }
32713
32714 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
32715         LDKUpdateFailHTLC this_ptr_conv;
32716         this_ptr_conv.inner = untag_ptr(this_ptr);
32717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32719         this_ptr_conv.is_owned = false;
32720         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32721         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
32722         return ret_arr;
32723 }
32724
32725 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32726         LDKUpdateFailHTLC this_ptr_conv;
32727         this_ptr_conv.inner = untag_ptr(this_ptr);
32728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32730         this_ptr_conv.is_owned = false;
32731         LDKThirtyTwoBytes val_ref;
32732         CHECK(val->arr_len == 32);
32733         memcpy(val_ref.data, val->elems, 32); FREE(val);
32734         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32735 }
32736
32737 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
32738         LDKUpdateFailHTLC this_ptr_conv;
32739         this_ptr_conv.inner = untag_ptr(this_ptr);
32740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32742         this_ptr_conv.is_owned = false;
32743         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32744         return ret_conv;
32745 }
32746
32747 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32748         LDKUpdateFailHTLC this_ptr_conv;
32749         this_ptr_conv.inner = untag_ptr(this_ptr);
32750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32752         this_ptr_conv.is_owned = false;
32753         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32754 }
32755
32756 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32757         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32758         uint64_t ret_ref = 0;
32759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32761         return ret_ref;
32762 }
32763 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
32764         LDKUpdateFailHTLC arg_conv;
32765         arg_conv.inner = untag_ptr(arg);
32766         arg_conv.is_owned = ptr_is_owned(arg);
32767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32768         arg_conv.is_owned = false;
32769         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32770         return ret_conv;
32771 }
32772
32773 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
32774         LDKUpdateFailHTLC orig_conv;
32775         orig_conv.inner = untag_ptr(orig);
32776         orig_conv.is_owned = ptr_is_owned(orig);
32777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32778         orig_conv.is_owned = false;
32779         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32780         uint64_t ret_ref = 0;
32781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32783         return ret_ref;
32784 }
32785
32786 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
32787         LDKUpdateFailHTLC a_conv;
32788         a_conv.inner = untag_ptr(a);
32789         a_conv.is_owned = ptr_is_owned(a);
32790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32791         a_conv.is_owned = false;
32792         LDKUpdateFailHTLC b_conv;
32793         b_conv.inner = untag_ptr(b);
32794         b_conv.is_owned = ptr_is_owned(b);
32795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32796         b_conv.is_owned = false;
32797         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
32798         return ret_conv;
32799 }
32800
32801 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
32802         LDKUpdateFailMalformedHTLC this_obj_conv;
32803         this_obj_conv.inner = untag_ptr(this_obj);
32804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32806         UpdateFailMalformedHTLC_free(this_obj_conv);
32807 }
32808
32809 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
32810         LDKUpdateFailMalformedHTLC this_ptr_conv;
32811         this_ptr_conv.inner = untag_ptr(this_ptr);
32812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32814         this_ptr_conv.is_owned = false;
32815         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32816         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
32817         return ret_arr;
32818 }
32819
32820 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32821         LDKUpdateFailMalformedHTLC this_ptr_conv;
32822         this_ptr_conv.inner = untag_ptr(this_ptr);
32823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32825         this_ptr_conv.is_owned = false;
32826         LDKThirtyTwoBytes val_ref;
32827         CHECK(val->arr_len == 32);
32828         memcpy(val_ref.data, val->elems, 32); FREE(val);
32829         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32830 }
32831
32832 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
32833         LDKUpdateFailMalformedHTLC this_ptr_conv;
32834         this_ptr_conv.inner = untag_ptr(this_ptr);
32835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32837         this_ptr_conv.is_owned = false;
32838         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32839         return ret_conv;
32840 }
32841
32842 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32843         LDKUpdateFailMalformedHTLC this_ptr_conv;
32844         this_ptr_conv.inner = untag_ptr(this_ptr);
32845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32847         this_ptr_conv.is_owned = false;
32848         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32849 }
32850
32851 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
32852         LDKUpdateFailMalformedHTLC this_ptr_conv;
32853         this_ptr_conv.inner = untag_ptr(this_ptr);
32854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32856         this_ptr_conv.is_owned = false;
32857         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32858         return ret_conv;
32859 }
32860
32861 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
32862         LDKUpdateFailMalformedHTLC this_ptr_conv;
32863         this_ptr_conv.inner = untag_ptr(this_ptr);
32864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32866         this_ptr_conv.is_owned = false;
32867         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32868 }
32869
32870 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32871         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32872         uint64_t ret_ref = 0;
32873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32875         return ret_ref;
32876 }
32877 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
32878         LDKUpdateFailMalformedHTLC arg_conv;
32879         arg_conv.inner = untag_ptr(arg);
32880         arg_conv.is_owned = ptr_is_owned(arg);
32881         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32882         arg_conv.is_owned = false;
32883         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32884         return ret_conv;
32885 }
32886
32887 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
32888         LDKUpdateFailMalformedHTLC orig_conv;
32889         orig_conv.inner = untag_ptr(orig);
32890         orig_conv.is_owned = ptr_is_owned(orig);
32891         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32892         orig_conv.is_owned = false;
32893         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
32894         uint64_t ret_ref = 0;
32895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32897         return ret_ref;
32898 }
32899
32900 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
32901         LDKUpdateFailMalformedHTLC a_conv;
32902         a_conv.inner = untag_ptr(a);
32903         a_conv.is_owned = ptr_is_owned(a);
32904         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32905         a_conv.is_owned = false;
32906         LDKUpdateFailMalformedHTLC b_conv;
32907         b_conv.inner = untag_ptr(b);
32908         b_conv.is_owned = ptr_is_owned(b);
32909         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32910         b_conv.is_owned = false;
32911         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
32912         return ret_conv;
32913 }
32914
32915 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
32916         LDKCommitmentSigned this_obj_conv;
32917         this_obj_conv.inner = untag_ptr(this_obj);
32918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32920         CommitmentSigned_free(this_obj_conv);
32921 }
32922
32923 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
32924         LDKCommitmentSigned this_ptr_conv;
32925         this_ptr_conv.inner = untag_ptr(this_ptr);
32926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32928         this_ptr_conv.is_owned = false;
32929         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32930         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
32931         return ret_arr;
32932 }
32933
32934 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32935         LDKCommitmentSigned this_ptr_conv;
32936         this_ptr_conv.inner = untag_ptr(this_ptr);
32937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32939         this_ptr_conv.is_owned = false;
32940         LDKThirtyTwoBytes val_ref;
32941         CHECK(val->arr_len == 32);
32942         memcpy(val_ref.data, val->elems, 32); FREE(val);
32943         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
32944 }
32945
32946 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
32947         LDKCommitmentSigned this_ptr_conv;
32948         this_ptr_conv.inner = untag_ptr(this_ptr);
32949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32951         this_ptr_conv.is_owned = false;
32952         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32953         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
32954         return ret_arr;
32955 }
32956
32957 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32958         LDKCommitmentSigned this_ptr_conv;
32959         this_ptr_conv.inner = untag_ptr(this_ptr);
32960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32962         this_ptr_conv.is_owned = false;
32963         LDKSignature val_ref;
32964         CHECK(val->arr_len == 64);
32965         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32966         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
32967 }
32968
32969 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
32970         LDKCommitmentSigned this_ptr_conv;
32971         this_ptr_conv.inner = untag_ptr(this_ptr);
32972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32974         this_ptr_conv.is_owned = false;
32975         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
32976         ptrArray ret_arr = NULL;
32977         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32978         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
32979         for (size_t m = 0; m < ret_var.datalen; m++) {
32980                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
32981                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
32982                 ret_arr_ptr[m] = ret_conv_12_arr;
32983         }
32984         
32985         FREE(ret_var.data);
32986         return ret_arr;
32987 }
32988
32989 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
32990         LDKCommitmentSigned this_ptr_conv;
32991         this_ptr_conv.inner = untag_ptr(this_ptr);
32992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32994         this_ptr_conv.is_owned = false;
32995         LDKCVec_SignatureZ val_constr;
32996         val_constr.datalen = val->arr_len;
32997         if (val_constr.datalen > 0)
32998                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32999         else
33000                 val_constr.data = NULL;
33001         int8_tArray* val_vals = (void*) val->elems;
33002         for (size_t m = 0; m < val_constr.datalen; m++) {
33003                 int8_tArray val_conv_12 = val_vals[m];
33004                 LDKSignature val_conv_12_ref;
33005                 CHECK(val_conv_12->arr_len == 64);
33006                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
33007                 val_constr.data[m] = val_conv_12_ref;
33008         }
33009         FREE(val);
33010         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33011 }
33012
33013 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
33014         LDKThirtyTwoBytes channel_id_arg_ref;
33015         CHECK(channel_id_arg->arr_len == 32);
33016         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33017         LDKSignature signature_arg_ref;
33018         CHECK(signature_arg->arr_len == 64);
33019         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33020         LDKCVec_SignatureZ htlc_signatures_arg_constr;
33021         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
33022         if (htlc_signatures_arg_constr.datalen > 0)
33023                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33024         else
33025                 htlc_signatures_arg_constr.data = NULL;
33026         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
33027         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
33028                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
33029                 LDKSignature htlc_signatures_arg_conv_12_ref;
33030                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
33031                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
33032                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
33033         }
33034         FREE(htlc_signatures_arg);
33035         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33036         uint64_t ret_ref = 0;
33037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33039         return ret_ref;
33040 }
33041
33042 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33043         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33044         uint64_t ret_ref = 0;
33045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33047         return ret_ref;
33048 }
33049 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
33050         LDKCommitmentSigned arg_conv;
33051         arg_conv.inner = untag_ptr(arg);
33052         arg_conv.is_owned = ptr_is_owned(arg);
33053         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33054         arg_conv.is_owned = false;
33055         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33056         return ret_conv;
33057 }
33058
33059 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
33060         LDKCommitmentSigned orig_conv;
33061         orig_conv.inner = untag_ptr(orig);
33062         orig_conv.is_owned = ptr_is_owned(orig);
33063         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33064         orig_conv.is_owned = false;
33065         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33066         uint64_t ret_ref = 0;
33067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33069         return ret_ref;
33070 }
33071
33072 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
33073         LDKCommitmentSigned a_conv;
33074         a_conv.inner = untag_ptr(a);
33075         a_conv.is_owned = ptr_is_owned(a);
33076         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33077         a_conv.is_owned = false;
33078         LDKCommitmentSigned b_conv;
33079         b_conv.inner = untag_ptr(b);
33080         b_conv.is_owned = ptr_is_owned(b);
33081         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33082         b_conv.is_owned = false;
33083         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
33084         return ret_conv;
33085 }
33086
33087 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
33088         LDKRevokeAndACK this_obj_conv;
33089         this_obj_conv.inner = untag_ptr(this_obj);
33090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33092         RevokeAndACK_free(this_obj_conv);
33093 }
33094
33095 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
33096         LDKRevokeAndACK this_ptr_conv;
33097         this_ptr_conv.inner = untag_ptr(this_ptr);
33098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33100         this_ptr_conv.is_owned = false;
33101         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33102         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
33103         return ret_arr;
33104 }
33105
33106 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33107         LDKRevokeAndACK this_ptr_conv;
33108         this_ptr_conv.inner = untag_ptr(this_ptr);
33109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33111         this_ptr_conv.is_owned = false;
33112         LDKThirtyTwoBytes val_ref;
33113         CHECK(val->arr_len == 32);
33114         memcpy(val_ref.data, val->elems, 32); FREE(val);
33115         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33116 }
33117
33118 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
33119         LDKRevokeAndACK this_ptr_conv;
33120         this_ptr_conv.inner = untag_ptr(this_ptr);
33121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33123         this_ptr_conv.is_owned = false;
33124         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33125         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
33126         return ret_arr;
33127 }
33128
33129 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
33130         LDKRevokeAndACK this_ptr_conv;
33131         this_ptr_conv.inner = untag_ptr(this_ptr);
33132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33134         this_ptr_conv.is_owned = false;
33135         LDKThirtyTwoBytes val_ref;
33136         CHECK(val->arr_len == 32);
33137         memcpy(val_ref.data, val->elems, 32); FREE(val);
33138         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33139 }
33140
33141 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
33142         LDKRevokeAndACK this_ptr_conv;
33143         this_ptr_conv.inner = untag_ptr(this_ptr);
33144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33146         this_ptr_conv.is_owned = false;
33147         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33148         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33149         return ret_arr;
33150 }
33151
33152 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) {
33153         LDKRevokeAndACK this_ptr_conv;
33154         this_ptr_conv.inner = untag_ptr(this_ptr);
33155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33157         this_ptr_conv.is_owned = false;
33158         LDKPublicKey val_ref;
33159         CHECK(val->arr_len == 33);
33160         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33161         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33162 }
33163
33164 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) {
33165         LDKThirtyTwoBytes channel_id_arg_ref;
33166         CHECK(channel_id_arg->arr_len == 32);
33167         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33168         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33169         CHECK(per_commitment_secret_arg->arr_len == 32);
33170         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
33171         LDKPublicKey next_per_commitment_point_arg_ref;
33172         CHECK(next_per_commitment_point_arg->arr_len == 33);
33173         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
33174         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33175         uint64_t ret_ref = 0;
33176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33178         return ret_ref;
33179 }
33180
33181 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33182         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33183         uint64_t ret_ref = 0;
33184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33186         return ret_ref;
33187 }
33188 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
33189         LDKRevokeAndACK arg_conv;
33190         arg_conv.inner = untag_ptr(arg);
33191         arg_conv.is_owned = ptr_is_owned(arg);
33192         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33193         arg_conv.is_owned = false;
33194         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33195         return ret_conv;
33196 }
33197
33198 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
33199         LDKRevokeAndACK orig_conv;
33200         orig_conv.inner = untag_ptr(orig);
33201         orig_conv.is_owned = ptr_is_owned(orig);
33202         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33203         orig_conv.is_owned = false;
33204         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33205         uint64_t ret_ref = 0;
33206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33208         return ret_ref;
33209 }
33210
33211 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
33212         LDKRevokeAndACK a_conv;
33213         a_conv.inner = untag_ptr(a);
33214         a_conv.is_owned = ptr_is_owned(a);
33215         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33216         a_conv.is_owned = false;
33217         LDKRevokeAndACK b_conv;
33218         b_conv.inner = untag_ptr(b);
33219         b_conv.is_owned = ptr_is_owned(b);
33220         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33221         b_conv.is_owned = false;
33222         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
33223         return ret_conv;
33224 }
33225
33226 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
33227         LDKUpdateFee this_obj_conv;
33228         this_obj_conv.inner = untag_ptr(this_obj);
33229         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33231         UpdateFee_free(this_obj_conv);
33232 }
33233
33234 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
33235         LDKUpdateFee this_ptr_conv;
33236         this_ptr_conv.inner = untag_ptr(this_ptr);
33237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33239         this_ptr_conv.is_owned = false;
33240         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33241         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
33242         return ret_arr;
33243 }
33244
33245 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33246         LDKUpdateFee this_ptr_conv;
33247         this_ptr_conv.inner = untag_ptr(this_ptr);
33248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33250         this_ptr_conv.is_owned = false;
33251         LDKThirtyTwoBytes val_ref;
33252         CHECK(val->arr_len == 32);
33253         memcpy(val_ref.data, val->elems, 32); FREE(val);
33254         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33255 }
33256
33257 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
33258         LDKUpdateFee this_ptr_conv;
33259         this_ptr_conv.inner = untag_ptr(this_ptr);
33260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33262         this_ptr_conv.is_owned = false;
33263         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33264         return ret_conv;
33265 }
33266
33267 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
33268         LDKUpdateFee this_ptr_conv;
33269         this_ptr_conv.inner = untag_ptr(this_ptr);
33270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33272         this_ptr_conv.is_owned = false;
33273         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33274 }
33275
33276 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
33277         LDKThirtyTwoBytes channel_id_arg_ref;
33278         CHECK(channel_id_arg->arr_len == 32);
33279         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33280         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33281         uint64_t ret_ref = 0;
33282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33284         return ret_ref;
33285 }
33286
33287 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33288         LDKUpdateFee ret_var = UpdateFee_clone(arg);
33289         uint64_t ret_ref = 0;
33290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33292         return ret_ref;
33293 }
33294 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
33295         LDKUpdateFee arg_conv;
33296         arg_conv.inner = untag_ptr(arg);
33297         arg_conv.is_owned = ptr_is_owned(arg);
33298         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33299         arg_conv.is_owned = false;
33300         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33301         return ret_conv;
33302 }
33303
33304 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
33305         LDKUpdateFee orig_conv;
33306         orig_conv.inner = untag_ptr(orig);
33307         orig_conv.is_owned = ptr_is_owned(orig);
33308         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33309         orig_conv.is_owned = false;
33310         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33311         uint64_t ret_ref = 0;
33312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33314         return ret_ref;
33315 }
33316
33317 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
33318         LDKUpdateFee a_conv;
33319         a_conv.inner = untag_ptr(a);
33320         a_conv.is_owned = ptr_is_owned(a);
33321         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33322         a_conv.is_owned = false;
33323         LDKUpdateFee b_conv;
33324         b_conv.inner = untag_ptr(b);
33325         b_conv.is_owned = ptr_is_owned(b);
33326         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33327         b_conv.is_owned = false;
33328         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
33329         return ret_conv;
33330 }
33331
33332 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
33333         LDKDataLossProtect this_obj_conv;
33334         this_obj_conv.inner = untag_ptr(this_obj);
33335         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33337         DataLossProtect_free(this_obj_conv);
33338 }
33339
33340 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) {
33341         LDKDataLossProtect this_ptr_conv;
33342         this_ptr_conv.inner = untag_ptr(this_ptr);
33343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33345         this_ptr_conv.is_owned = false;
33346         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33347         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
33348         return ret_arr;
33349 }
33350
33351 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) {
33352         LDKDataLossProtect this_ptr_conv;
33353         this_ptr_conv.inner = untag_ptr(this_ptr);
33354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33356         this_ptr_conv.is_owned = false;
33357         LDKThirtyTwoBytes val_ref;
33358         CHECK(val->arr_len == 32);
33359         memcpy(val_ref.data, val->elems, 32); FREE(val);
33360         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33361 }
33362
33363 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) {
33364         LDKDataLossProtect this_ptr_conv;
33365         this_ptr_conv.inner = untag_ptr(this_ptr);
33366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33368         this_ptr_conv.is_owned = false;
33369         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33370         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33371         return ret_arr;
33372 }
33373
33374 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) {
33375         LDKDataLossProtect this_ptr_conv;
33376         this_ptr_conv.inner = untag_ptr(this_ptr);
33377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33379         this_ptr_conv.is_owned = false;
33380         LDKPublicKey val_ref;
33381         CHECK(val->arr_len == 33);
33382         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33383         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33384 }
33385
33386 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) {
33387         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33388         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
33389         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
33390         LDKPublicKey my_current_per_commitment_point_arg_ref;
33391         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
33392         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);
33393         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33394         uint64_t ret_ref = 0;
33395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33397         return ret_ref;
33398 }
33399
33400 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33401         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33402         uint64_t ret_ref = 0;
33403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33405         return ret_ref;
33406 }
33407 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
33408         LDKDataLossProtect arg_conv;
33409         arg_conv.inner = untag_ptr(arg);
33410         arg_conv.is_owned = ptr_is_owned(arg);
33411         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33412         arg_conv.is_owned = false;
33413         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33414         return ret_conv;
33415 }
33416
33417 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
33418         LDKDataLossProtect orig_conv;
33419         orig_conv.inner = untag_ptr(orig);
33420         orig_conv.is_owned = ptr_is_owned(orig);
33421         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33422         orig_conv.is_owned = false;
33423         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33424         uint64_t ret_ref = 0;
33425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33427         return ret_ref;
33428 }
33429
33430 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
33431         LDKDataLossProtect a_conv;
33432         a_conv.inner = untag_ptr(a);
33433         a_conv.is_owned = ptr_is_owned(a);
33434         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33435         a_conv.is_owned = false;
33436         LDKDataLossProtect b_conv;
33437         b_conv.inner = untag_ptr(b);
33438         b_conv.is_owned = ptr_is_owned(b);
33439         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33440         b_conv.is_owned = false;
33441         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
33442         return ret_conv;
33443 }
33444
33445 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
33446         LDKChannelReestablish this_obj_conv;
33447         this_obj_conv.inner = untag_ptr(this_obj);
33448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33450         ChannelReestablish_free(this_obj_conv);
33451 }
33452
33453 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
33454         LDKChannelReestablish this_ptr_conv;
33455         this_ptr_conv.inner = untag_ptr(this_ptr);
33456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33458         this_ptr_conv.is_owned = false;
33459         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33460         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
33461         return ret_arr;
33462 }
33463
33464 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33465         LDKChannelReestablish this_ptr_conv;
33466         this_ptr_conv.inner = untag_ptr(this_ptr);
33467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33469         this_ptr_conv.is_owned = false;
33470         LDKThirtyTwoBytes val_ref;
33471         CHECK(val->arr_len == 32);
33472         memcpy(val_ref.data, val->elems, 32); FREE(val);
33473         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33474 }
33475
33476 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
33477         LDKChannelReestablish this_ptr_conv;
33478         this_ptr_conv.inner = untag_ptr(this_ptr);
33479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33481         this_ptr_conv.is_owned = false;
33482         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33483         return ret_conv;
33484 }
33485
33486 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) {
33487         LDKChannelReestablish this_ptr_conv;
33488         this_ptr_conv.inner = untag_ptr(this_ptr);
33489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33491         this_ptr_conv.is_owned = false;
33492         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33493 }
33494
33495 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
33496         LDKChannelReestablish this_ptr_conv;
33497         this_ptr_conv.inner = untag_ptr(this_ptr);
33498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33500         this_ptr_conv.is_owned = false;
33501         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33502         return ret_conv;
33503 }
33504
33505 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) {
33506         LDKChannelReestablish this_ptr_conv;
33507         this_ptr_conv.inner = untag_ptr(this_ptr);
33508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33510         this_ptr_conv.is_owned = false;
33511         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33512 }
33513
33514 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33515         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33516         uint64_t ret_ref = 0;
33517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33519         return ret_ref;
33520 }
33521 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
33522         LDKChannelReestablish arg_conv;
33523         arg_conv.inner = untag_ptr(arg);
33524         arg_conv.is_owned = ptr_is_owned(arg);
33525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33526         arg_conv.is_owned = false;
33527         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33528         return ret_conv;
33529 }
33530
33531 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
33532         LDKChannelReestablish orig_conv;
33533         orig_conv.inner = untag_ptr(orig);
33534         orig_conv.is_owned = ptr_is_owned(orig);
33535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33536         orig_conv.is_owned = false;
33537         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33538         uint64_t ret_ref = 0;
33539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33541         return ret_ref;
33542 }
33543
33544 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
33545         LDKChannelReestablish a_conv;
33546         a_conv.inner = untag_ptr(a);
33547         a_conv.is_owned = ptr_is_owned(a);
33548         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33549         a_conv.is_owned = false;
33550         LDKChannelReestablish b_conv;
33551         b_conv.inner = untag_ptr(b);
33552         b_conv.is_owned = ptr_is_owned(b);
33553         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33554         b_conv.is_owned = false;
33555         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
33556         return ret_conv;
33557 }
33558
33559 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
33560         LDKAnnouncementSignatures this_obj_conv;
33561         this_obj_conv.inner = untag_ptr(this_obj);
33562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33564         AnnouncementSignatures_free(this_obj_conv);
33565 }
33566
33567 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
33568         LDKAnnouncementSignatures this_ptr_conv;
33569         this_ptr_conv.inner = untag_ptr(this_ptr);
33570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33572         this_ptr_conv.is_owned = false;
33573         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33574         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
33575         return ret_arr;
33576 }
33577
33578 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33579         LDKAnnouncementSignatures this_ptr_conv;
33580         this_ptr_conv.inner = untag_ptr(this_ptr);
33581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33583         this_ptr_conv.is_owned = false;
33584         LDKThirtyTwoBytes val_ref;
33585         CHECK(val->arr_len == 32);
33586         memcpy(val_ref.data, val->elems, 32); FREE(val);
33587         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33588 }
33589
33590 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
33591         LDKAnnouncementSignatures this_ptr_conv;
33592         this_ptr_conv.inner = untag_ptr(this_ptr);
33593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33595         this_ptr_conv.is_owned = false;
33596         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33597         return ret_conv;
33598 }
33599
33600 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
33601         LDKAnnouncementSignatures this_ptr_conv;
33602         this_ptr_conv.inner = untag_ptr(this_ptr);
33603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33605         this_ptr_conv.is_owned = false;
33606         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33607 }
33608
33609 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
33610         LDKAnnouncementSignatures this_ptr_conv;
33611         this_ptr_conv.inner = untag_ptr(this_ptr);
33612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33614         this_ptr_conv.is_owned = false;
33615         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33616         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
33617         return ret_arr;
33618 }
33619
33620 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
33621         LDKAnnouncementSignatures this_ptr_conv;
33622         this_ptr_conv.inner = untag_ptr(this_ptr);
33623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33625         this_ptr_conv.is_owned = false;
33626         LDKSignature val_ref;
33627         CHECK(val->arr_len == 64);
33628         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33629         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33630 }
33631
33632 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
33633         LDKAnnouncementSignatures this_ptr_conv;
33634         this_ptr_conv.inner = untag_ptr(this_ptr);
33635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33637         this_ptr_conv.is_owned = false;
33638         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33639         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
33640         return ret_arr;
33641 }
33642
33643 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
33644         LDKAnnouncementSignatures this_ptr_conv;
33645         this_ptr_conv.inner = untag_ptr(this_ptr);
33646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33648         this_ptr_conv.is_owned = false;
33649         LDKSignature val_ref;
33650         CHECK(val->arr_len == 64);
33651         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33652         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33653 }
33654
33655 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) {
33656         LDKThirtyTwoBytes channel_id_arg_ref;
33657         CHECK(channel_id_arg->arr_len == 32);
33658         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33659         LDKSignature node_signature_arg_ref;
33660         CHECK(node_signature_arg->arr_len == 64);
33661         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
33662         LDKSignature bitcoin_signature_arg_ref;
33663         CHECK(bitcoin_signature_arg->arr_len == 64);
33664         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
33665         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33666         uint64_t ret_ref = 0;
33667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33669         return ret_ref;
33670 }
33671
33672 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33673         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33674         uint64_t ret_ref = 0;
33675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33677         return ret_ref;
33678 }
33679 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
33680         LDKAnnouncementSignatures arg_conv;
33681         arg_conv.inner = untag_ptr(arg);
33682         arg_conv.is_owned = ptr_is_owned(arg);
33683         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33684         arg_conv.is_owned = false;
33685         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33686         return ret_conv;
33687 }
33688
33689 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
33690         LDKAnnouncementSignatures orig_conv;
33691         orig_conv.inner = untag_ptr(orig);
33692         orig_conv.is_owned = ptr_is_owned(orig);
33693         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33694         orig_conv.is_owned = false;
33695         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33696         uint64_t ret_ref = 0;
33697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33699         return ret_ref;
33700 }
33701
33702 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
33703         LDKAnnouncementSignatures a_conv;
33704         a_conv.inner = untag_ptr(a);
33705         a_conv.is_owned = ptr_is_owned(a);
33706         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33707         a_conv.is_owned = false;
33708         LDKAnnouncementSignatures b_conv;
33709         b_conv.inner = untag_ptr(b);
33710         b_conv.is_owned = ptr_is_owned(b);
33711         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33712         b_conv.is_owned = false;
33713         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
33714         return ret_conv;
33715 }
33716
33717 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
33718         if (!ptr_is_owned(this_ptr)) return;
33719         void* this_ptr_ptr = untag_ptr(this_ptr);
33720         CHECK_ACCESS(this_ptr_ptr);
33721         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33722         FREE(untag_ptr(this_ptr));
33723         NetAddress_free(this_ptr_conv);
33724 }
33725
33726 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33727         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33728         *ret_copy = NetAddress_clone(arg);
33729         uint64_t ret_ref = tag_ptr(ret_copy, true);
33730         return ret_ref;
33731 }
33732 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
33733         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33734         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33735         return ret_conv;
33736 }
33737
33738 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
33739         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33740         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33741         *ret_copy = NetAddress_clone(orig_conv);
33742         uint64_t ret_ref = tag_ptr(ret_copy, true);
33743         return ret_ref;
33744 }
33745
33746 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
33747         LDKFourBytes addr_ref;
33748         CHECK(addr->arr_len == 4);
33749         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
33750         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33751         *ret_copy = NetAddress_ipv4(addr_ref, port);
33752         uint64_t ret_ref = tag_ptr(ret_copy, true);
33753         return ret_ref;
33754 }
33755
33756 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
33757         LDKSixteenBytes addr_ref;
33758         CHECK(addr->arr_len == 16);
33759         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
33760         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33761         *ret_copy = NetAddress_ipv6(addr_ref, port);
33762         uint64_t ret_ref = tag_ptr(ret_copy, true);
33763         return ret_ref;
33764 }
33765
33766 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
33767         LDKTwelveBytes a_ref;
33768         CHECK(a->arr_len == 12);
33769         memcpy(a_ref.data, a->elems, 12); FREE(a);
33770         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33771         *ret_copy = NetAddress_onion_v2(a_ref);
33772         uint64_t ret_ref = tag_ptr(ret_copy, true);
33773         return ret_ref;
33774 }
33775
33776 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) {
33777         LDKThirtyTwoBytes ed25519_pubkey_ref;
33778         CHECK(ed25519_pubkey->arr_len == 32);
33779         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
33780         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33781         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33782         uint64_t ret_ref = tag_ptr(ret_copy, true);
33783         return ret_ref;
33784 }
33785
33786 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
33787         LDKHostname hostname_conv;
33788         hostname_conv.inner = untag_ptr(hostname);
33789         hostname_conv.is_owned = ptr_is_owned(hostname);
33790         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33791         hostname_conv = Hostname_clone(&hostname_conv);
33792         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33793         *ret_copy = NetAddress_hostname(hostname_conv, port);
33794         uint64_t ret_ref = tag_ptr(ret_copy, true);
33795         return ret_ref;
33796 }
33797
33798 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
33799         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
33800         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
33801         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
33802         return ret_conv;
33803 }
33804
33805 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
33806         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33807         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33808         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33809         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33810         CVec_u8Z_free(ret_var);
33811         return ret_arr;
33812 }
33813
33814 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
33815         LDKu8slice ser_ref;
33816         ser_ref.datalen = ser->arr_len;
33817         ser_ref.data = ser->elems;
33818         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33819         *ret_conv = NetAddress_read(ser_ref);
33820         FREE(ser);
33821         return tag_ptr(ret_conv, true);
33822 }
33823
33824 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
33825         if (!ptr_is_owned(this_ptr)) return;
33826         void* this_ptr_ptr = untag_ptr(this_ptr);
33827         CHECK_ACCESS(this_ptr_ptr);
33828         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
33829         FREE(untag_ptr(this_ptr));
33830         UnsignedGossipMessage_free(this_ptr_conv);
33831 }
33832
33833 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
33834         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33835         *ret_copy = UnsignedGossipMessage_clone(arg);
33836         uint64_t ret_ref = tag_ptr(ret_copy, true);
33837         return ret_ref;
33838 }
33839 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
33840         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
33841         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
33842         return ret_conv;
33843 }
33844
33845 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
33846         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
33847         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33848         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
33849         uint64_t ret_ref = tag_ptr(ret_copy, true);
33850         return ret_ref;
33851 }
33852
33853 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
33854         LDKUnsignedChannelAnnouncement a_conv;
33855         a_conv.inner = untag_ptr(a);
33856         a_conv.is_owned = ptr_is_owned(a);
33857         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33858         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
33859         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33860         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
33861         uint64_t ret_ref = tag_ptr(ret_copy, true);
33862         return ret_ref;
33863 }
33864
33865 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
33866         LDKUnsignedChannelUpdate a_conv;
33867         a_conv.inner = untag_ptr(a);
33868         a_conv.is_owned = ptr_is_owned(a);
33869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33870         a_conv = UnsignedChannelUpdate_clone(&a_conv);
33871         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33872         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
33873         uint64_t ret_ref = tag_ptr(ret_copy, true);
33874         return ret_ref;
33875 }
33876
33877 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
33878         LDKUnsignedNodeAnnouncement a_conv;
33879         a_conv.inner = untag_ptr(a);
33880         a_conv.is_owned = ptr_is_owned(a);
33881         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33882         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
33883         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33884         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
33885         uint64_t ret_ref = tag_ptr(ret_copy, true);
33886         return ret_ref;
33887 }
33888
33889 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
33890         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
33891         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
33892         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33893         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33894         CVec_u8Z_free(ret_var);
33895         return ret_arr;
33896 }
33897
33898 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
33899         LDKUnsignedNodeAnnouncement this_obj_conv;
33900         this_obj_conv.inner = untag_ptr(this_obj);
33901         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33903         UnsignedNodeAnnouncement_free(this_obj_conv);
33904 }
33905
33906 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
33907         LDKUnsignedNodeAnnouncement this_ptr_conv;
33908         this_ptr_conv.inner = untag_ptr(this_ptr);
33909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33911         this_ptr_conv.is_owned = false;
33912         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33913         uint64_t ret_ref = 0;
33914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33916         return ret_ref;
33917 }
33918
33919 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
33920         LDKUnsignedNodeAnnouncement this_ptr_conv;
33921         this_ptr_conv.inner = untag_ptr(this_ptr);
33922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33924         this_ptr_conv.is_owned = false;
33925         LDKNodeFeatures val_conv;
33926         val_conv.inner = untag_ptr(val);
33927         val_conv.is_owned = ptr_is_owned(val);
33928         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33929         val_conv = NodeFeatures_clone(&val_conv);
33930         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33931 }
33932
33933 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
33934         LDKUnsignedNodeAnnouncement this_ptr_conv;
33935         this_ptr_conv.inner = untag_ptr(this_ptr);
33936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33938         this_ptr_conv.is_owned = false;
33939         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33940         return ret_conv;
33941 }
33942
33943 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
33944         LDKUnsignedNodeAnnouncement this_ptr_conv;
33945         this_ptr_conv.inner = untag_ptr(this_ptr);
33946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33948         this_ptr_conv.is_owned = false;
33949         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33950 }
33951
33952 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
33953         LDKUnsignedNodeAnnouncement this_ptr_conv;
33954         this_ptr_conv.inner = untag_ptr(this_ptr);
33955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33957         this_ptr_conv.is_owned = false;
33958         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
33959         uint64_t ret_ref = 0;
33960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33962         return ret_ref;
33963 }
33964
33965 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
33966         LDKUnsignedNodeAnnouncement this_ptr_conv;
33967         this_ptr_conv.inner = untag_ptr(this_ptr);
33968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33970         this_ptr_conv.is_owned = false;
33971         LDKNodeId val_conv;
33972         val_conv.inner = untag_ptr(val);
33973         val_conv.is_owned = ptr_is_owned(val);
33974         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33975         val_conv = NodeId_clone(&val_conv);
33976         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
33977 }
33978
33979 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
33980         LDKUnsignedNodeAnnouncement this_ptr_conv;
33981         this_ptr_conv.inner = untag_ptr(this_ptr);
33982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33984         this_ptr_conv.is_owned = false;
33985         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
33986         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
33987         return ret_arr;
33988 }
33989
33990 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
33991         LDKUnsignedNodeAnnouncement this_ptr_conv;
33992         this_ptr_conv.inner = untag_ptr(this_ptr);
33993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33995         this_ptr_conv.is_owned = false;
33996         LDKThreeBytes val_ref;
33997         CHECK(val->arr_len == 3);
33998         memcpy(val_ref.data, val->elems, 3); FREE(val);
33999         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
34000 }
34001
34002 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
34003         LDKUnsignedNodeAnnouncement this_ptr_conv;
34004         this_ptr_conv.inner = untag_ptr(this_ptr);
34005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34007         this_ptr_conv.is_owned = false;
34008         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
34009         uint64_t ret_ref = 0;
34010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34012         return ret_ref;
34013 }
34014
34015 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
34016         LDKUnsignedNodeAnnouncement this_ptr_conv;
34017         this_ptr_conv.inner = untag_ptr(this_ptr);
34018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34020         this_ptr_conv.is_owned = false;
34021         LDKNodeAlias val_conv;
34022         val_conv.inner = untag_ptr(val);
34023         val_conv.is_owned = ptr_is_owned(val);
34024         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34025         val_conv = NodeAlias_clone(&val_conv);
34026         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
34027 }
34028
34029 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
34030         LDKUnsignedNodeAnnouncement this_ptr_conv;
34031         this_ptr_conv.inner = untag_ptr(this_ptr);
34032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34034         this_ptr_conv.is_owned = false;
34035         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
34036         uint64_tArray ret_arr = NULL;
34037         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34038         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34039         for (size_t m = 0; m < ret_var.datalen; m++) {
34040                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34041                 *ret_conv_12_copy = ret_var.data[m];
34042                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
34043                 ret_arr_ptr[m] = ret_conv_12_ref;
34044         }
34045         
34046         FREE(ret_var.data);
34047         return ret_arr;
34048 }
34049
34050 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
34051         LDKUnsignedNodeAnnouncement this_ptr_conv;
34052         this_ptr_conv.inner = untag_ptr(this_ptr);
34053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34055         this_ptr_conv.is_owned = false;
34056         LDKCVec_NetAddressZ val_constr;
34057         val_constr.datalen = val->arr_len;
34058         if (val_constr.datalen > 0)
34059                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
34060         else
34061                 val_constr.data = NULL;
34062         uint64_t* val_vals = val->elems;
34063         for (size_t m = 0; m < val_constr.datalen; m++) {
34064                 uint64_t val_conv_12 = val_vals[m];
34065                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
34066                 CHECK_ACCESS(val_conv_12_ptr);
34067                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
34068                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
34069                 val_constr.data[m] = val_conv_12_conv;
34070         }
34071         FREE(val);
34072         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
34073 }
34074
34075 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
34076         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
34077         uint64_t ret_ref = 0;
34078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34080         return ret_ref;
34081 }
34082 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
34083         LDKUnsignedNodeAnnouncement arg_conv;
34084         arg_conv.inner = untag_ptr(arg);
34085         arg_conv.is_owned = ptr_is_owned(arg);
34086         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34087         arg_conv.is_owned = false;
34088         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
34089         return ret_conv;
34090 }
34091
34092 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
34093         LDKUnsignedNodeAnnouncement orig_conv;
34094         orig_conv.inner = untag_ptr(orig);
34095         orig_conv.is_owned = ptr_is_owned(orig);
34096         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34097         orig_conv.is_owned = false;
34098         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34099         uint64_t ret_ref = 0;
34100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34102         return ret_ref;
34103 }
34104
34105 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
34106         LDKUnsignedNodeAnnouncement a_conv;
34107         a_conv.inner = untag_ptr(a);
34108         a_conv.is_owned = ptr_is_owned(a);
34109         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34110         a_conv.is_owned = false;
34111         LDKUnsignedNodeAnnouncement b_conv;
34112         b_conv.inner = untag_ptr(b);
34113         b_conv.is_owned = ptr_is_owned(b);
34114         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34115         b_conv.is_owned = false;
34116         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
34117         return ret_conv;
34118 }
34119
34120 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
34121         LDKNodeAnnouncement this_obj_conv;
34122         this_obj_conv.inner = untag_ptr(this_obj);
34123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34125         NodeAnnouncement_free(this_obj_conv);
34126 }
34127
34128 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
34129         LDKNodeAnnouncement this_ptr_conv;
34130         this_ptr_conv.inner = untag_ptr(this_ptr);
34131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34133         this_ptr_conv.is_owned = false;
34134         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34135         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
34136         return ret_arr;
34137 }
34138
34139 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
34140         LDKNodeAnnouncement this_ptr_conv;
34141         this_ptr_conv.inner = untag_ptr(this_ptr);
34142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34144         this_ptr_conv.is_owned = false;
34145         LDKSignature val_ref;
34146         CHECK(val->arr_len == 64);
34147         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34148         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34149 }
34150
34151 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
34152         LDKNodeAnnouncement this_ptr_conv;
34153         this_ptr_conv.inner = untag_ptr(this_ptr);
34154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34156         this_ptr_conv.is_owned = false;
34157         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34158         uint64_t ret_ref = 0;
34159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34161         return ret_ref;
34162 }
34163
34164 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34165         LDKNodeAnnouncement this_ptr_conv;
34166         this_ptr_conv.inner = untag_ptr(this_ptr);
34167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34169         this_ptr_conv.is_owned = false;
34170         LDKUnsignedNodeAnnouncement val_conv;
34171         val_conv.inner = untag_ptr(val);
34172         val_conv.is_owned = ptr_is_owned(val);
34173         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34174         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34175         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34176 }
34177
34178 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
34179         LDKSignature signature_arg_ref;
34180         CHECK(signature_arg->arr_len == 64);
34181         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34182         LDKUnsignedNodeAnnouncement contents_arg_conv;
34183         contents_arg_conv.inner = untag_ptr(contents_arg);
34184         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34185         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34186         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34187         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34188         uint64_t ret_ref = 0;
34189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34191         return ret_ref;
34192 }
34193
34194 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34195         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34196         uint64_t ret_ref = 0;
34197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34199         return ret_ref;
34200 }
34201 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
34202         LDKNodeAnnouncement arg_conv;
34203         arg_conv.inner = untag_ptr(arg);
34204         arg_conv.is_owned = ptr_is_owned(arg);
34205         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34206         arg_conv.is_owned = false;
34207         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34208         return ret_conv;
34209 }
34210
34211 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
34212         LDKNodeAnnouncement orig_conv;
34213         orig_conv.inner = untag_ptr(orig);
34214         orig_conv.is_owned = ptr_is_owned(orig);
34215         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34216         orig_conv.is_owned = false;
34217         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34218         uint64_t ret_ref = 0;
34219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34221         return ret_ref;
34222 }
34223
34224 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
34225         LDKNodeAnnouncement a_conv;
34226         a_conv.inner = untag_ptr(a);
34227         a_conv.is_owned = ptr_is_owned(a);
34228         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34229         a_conv.is_owned = false;
34230         LDKNodeAnnouncement b_conv;
34231         b_conv.inner = untag_ptr(b);
34232         b_conv.is_owned = ptr_is_owned(b);
34233         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34234         b_conv.is_owned = false;
34235         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
34236         return ret_conv;
34237 }
34238
34239 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
34240         LDKUnsignedChannelAnnouncement this_obj_conv;
34241         this_obj_conv.inner = untag_ptr(this_obj);
34242         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34244         UnsignedChannelAnnouncement_free(this_obj_conv);
34245 }
34246
34247 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
34248         LDKUnsignedChannelAnnouncement this_ptr_conv;
34249         this_ptr_conv.inner = untag_ptr(this_ptr);
34250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34252         this_ptr_conv.is_owned = false;
34253         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34254         uint64_t ret_ref = 0;
34255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34257         return ret_ref;
34258 }
34259
34260 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
34261         LDKUnsignedChannelAnnouncement this_ptr_conv;
34262         this_ptr_conv.inner = untag_ptr(this_ptr);
34263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34265         this_ptr_conv.is_owned = false;
34266         LDKChannelFeatures val_conv;
34267         val_conv.inner = untag_ptr(val);
34268         val_conv.is_owned = ptr_is_owned(val);
34269         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34270         val_conv = ChannelFeatures_clone(&val_conv);
34271         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34272 }
34273
34274 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
34275         LDKUnsignedChannelAnnouncement this_ptr_conv;
34276         this_ptr_conv.inner = untag_ptr(this_ptr);
34277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34279         this_ptr_conv.is_owned = false;
34280         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34281         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
34282         return ret_arr;
34283 }
34284
34285 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34286         LDKUnsignedChannelAnnouncement this_ptr_conv;
34287         this_ptr_conv.inner = untag_ptr(this_ptr);
34288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34290         this_ptr_conv.is_owned = false;
34291         LDKThirtyTwoBytes val_ref;
34292         CHECK(val->arr_len == 32);
34293         memcpy(val_ref.data, val->elems, 32); FREE(val);
34294         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34295 }
34296
34297 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
34298         LDKUnsignedChannelAnnouncement this_ptr_conv;
34299         this_ptr_conv.inner = untag_ptr(this_ptr);
34300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34302         this_ptr_conv.is_owned = false;
34303         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34304         return ret_conv;
34305 }
34306
34307 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34308         LDKUnsignedChannelAnnouncement this_ptr_conv;
34309         this_ptr_conv.inner = untag_ptr(this_ptr);
34310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34312         this_ptr_conv.is_owned = false;
34313         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34314 }
34315
34316 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
34317         LDKUnsignedChannelAnnouncement this_ptr_conv;
34318         this_ptr_conv.inner = untag_ptr(this_ptr);
34319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34321         this_ptr_conv.is_owned = false;
34322         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
34323         uint64_t ret_ref = 0;
34324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34326         return ret_ref;
34327 }
34328
34329 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
34330         LDKUnsignedChannelAnnouncement this_ptr_conv;
34331         this_ptr_conv.inner = untag_ptr(this_ptr);
34332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34334         this_ptr_conv.is_owned = false;
34335         LDKNodeId val_conv;
34336         val_conv.inner = untag_ptr(val);
34337         val_conv.is_owned = ptr_is_owned(val);
34338         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34339         val_conv = NodeId_clone(&val_conv);
34340         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
34341 }
34342
34343 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
34344         LDKUnsignedChannelAnnouncement this_ptr_conv;
34345         this_ptr_conv.inner = untag_ptr(this_ptr);
34346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34348         this_ptr_conv.is_owned = false;
34349         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
34350         uint64_t ret_ref = 0;
34351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34353         return ret_ref;
34354 }
34355
34356 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
34357         LDKUnsignedChannelAnnouncement this_ptr_conv;
34358         this_ptr_conv.inner = untag_ptr(this_ptr);
34359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34361         this_ptr_conv.is_owned = false;
34362         LDKNodeId val_conv;
34363         val_conv.inner = untag_ptr(val);
34364         val_conv.is_owned = ptr_is_owned(val);
34365         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34366         val_conv = NodeId_clone(&val_conv);
34367         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
34368 }
34369
34370 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
34371         LDKUnsignedChannelAnnouncement this_ptr_conv;
34372         this_ptr_conv.inner = untag_ptr(this_ptr);
34373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34375         this_ptr_conv.is_owned = false;
34376         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
34377         uint64_t ret_ref = 0;
34378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34380         return ret_ref;
34381 }
34382
34383 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
34384         LDKUnsignedChannelAnnouncement this_ptr_conv;
34385         this_ptr_conv.inner = untag_ptr(this_ptr);
34386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34388         this_ptr_conv.is_owned = false;
34389         LDKNodeId val_conv;
34390         val_conv.inner = untag_ptr(val);
34391         val_conv.is_owned = ptr_is_owned(val);
34392         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34393         val_conv = NodeId_clone(&val_conv);
34394         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
34395 }
34396
34397 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
34398         LDKUnsignedChannelAnnouncement this_ptr_conv;
34399         this_ptr_conv.inner = untag_ptr(this_ptr);
34400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34402         this_ptr_conv.is_owned = false;
34403         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
34404         uint64_t ret_ref = 0;
34405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34407         return ret_ref;
34408 }
34409
34410 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
34411         LDKUnsignedChannelAnnouncement this_ptr_conv;
34412         this_ptr_conv.inner = untag_ptr(this_ptr);
34413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34415         this_ptr_conv.is_owned = false;
34416         LDKNodeId val_conv;
34417         val_conv.inner = untag_ptr(val);
34418         val_conv.is_owned = ptr_is_owned(val);
34419         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34420         val_conv = NodeId_clone(&val_conv);
34421         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
34422 }
34423
34424 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34425         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34426         uint64_t ret_ref = 0;
34427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34429         return ret_ref;
34430 }
34431 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
34432         LDKUnsignedChannelAnnouncement arg_conv;
34433         arg_conv.inner = untag_ptr(arg);
34434         arg_conv.is_owned = ptr_is_owned(arg);
34435         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34436         arg_conv.is_owned = false;
34437         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34438         return ret_conv;
34439 }
34440
34441 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
34442         LDKUnsignedChannelAnnouncement orig_conv;
34443         orig_conv.inner = untag_ptr(orig);
34444         orig_conv.is_owned = ptr_is_owned(orig);
34445         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34446         orig_conv.is_owned = false;
34447         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34448         uint64_t ret_ref = 0;
34449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34451         return ret_ref;
34452 }
34453
34454 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34455         LDKUnsignedChannelAnnouncement a_conv;
34456         a_conv.inner = untag_ptr(a);
34457         a_conv.is_owned = ptr_is_owned(a);
34458         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34459         a_conv.is_owned = false;
34460         LDKUnsignedChannelAnnouncement b_conv;
34461         b_conv.inner = untag_ptr(b);
34462         b_conv.is_owned = ptr_is_owned(b);
34463         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34464         b_conv.is_owned = false;
34465         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
34466         return ret_conv;
34467 }
34468
34469 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
34470         LDKChannelAnnouncement this_obj_conv;
34471         this_obj_conv.inner = untag_ptr(this_obj);
34472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34474         ChannelAnnouncement_free(this_obj_conv);
34475 }
34476
34477 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
34478         LDKChannelAnnouncement this_ptr_conv;
34479         this_ptr_conv.inner = untag_ptr(this_ptr);
34480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34482         this_ptr_conv.is_owned = false;
34483         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34484         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
34485         return ret_arr;
34486 }
34487
34488 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
34489         LDKChannelAnnouncement this_ptr_conv;
34490         this_ptr_conv.inner = untag_ptr(this_ptr);
34491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34493         this_ptr_conv.is_owned = false;
34494         LDKSignature val_ref;
34495         CHECK(val->arr_len == 64);
34496         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34497         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34498 }
34499
34500 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
34501         LDKChannelAnnouncement this_ptr_conv;
34502         this_ptr_conv.inner = untag_ptr(this_ptr);
34503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34505         this_ptr_conv.is_owned = false;
34506         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34507         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
34508         return ret_arr;
34509 }
34510
34511 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
34512         LDKChannelAnnouncement this_ptr_conv;
34513         this_ptr_conv.inner = untag_ptr(this_ptr);
34514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34516         this_ptr_conv.is_owned = false;
34517         LDKSignature val_ref;
34518         CHECK(val->arr_len == 64);
34519         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34520         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34521 }
34522
34523 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
34524         LDKChannelAnnouncement this_ptr_conv;
34525         this_ptr_conv.inner = untag_ptr(this_ptr);
34526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34528         this_ptr_conv.is_owned = false;
34529         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34530         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
34531         return ret_arr;
34532 }
34533
34534 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
34535         LDKChannelAnnouncement this_ptr_conv;
34536         this_ptr_conv.inner = untag_ptr(this_ptr);
34537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34539         this_ptr_conv.is_owned = false;
34540         LDKSignature val_ref;
34541         CHECK(val->arr_len == 64);
34542         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34543         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34544 }
34545
34546 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
34547         LDKChannelAnnouncement this_ptr_conv;
34548         this_ptr_conv.inner = untag_ptr(this_ptr);
34549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34551         this_ptr_conv.is_owned = false;
34552         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34553         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
34554         return ret_arr;
34555 }
34556
34557 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
34558         LDKChannelAnnouncement this_ptr_conv;
34559         this_ptr_conv.inner = untag_ptr(this_ptr);
34560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34562         this_ptr_conv.is_owned = false;
34563         LDKSignature val_ref;
34564         CHECK(val->arr_len == 64);
34565         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34566         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34567 }
34568
34569 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
34570         LDKChannelAnnouncement this_ptr_conv;
34571         this_ptr_conv.inner = untag_ptr(this_ptr);
34572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34574         this_ptr_conv.is_owned = false;
34575         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34576         uint64_t ret_ref = 0;
34577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34579         return ret_ref;
34580 }
34581
34582 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34583         LDKChannelAnnouncement this_ptr_conv;
34584         this_ptr_conv.inner = untag_ptr(this_ptr);
34585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34587         this_ptr_conv.is_owned = false;
34588         LDKUnsignedChannelAnnouncement val_conv;
34589         val_conv.inner = untag_ptr(val);
34590         val_conv.is_owned = ptr_is_owned(val);
34591         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34592         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34593         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34594 }
34595
34596 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) {
34597         LDKSignature node_signature_1_arg_ref;
34598         CHECK(node_signature_1_arg->arr_len == 64);
34599         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
34600         LDKSignature node_signature_2_arg_ref;
34601         CHECK(node_signature_2_arg->arr_len == 64);
34602         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
34603         LDKSignature bitcoin_signature_1_arg_ref;
34604         CHECK(bitcoin_signature_1_arg->arr_len == 64);
34605         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
34606         LDKSignature bitcoin_signature_2_arg_ref;
34607         CHECK(bitcoin_signature_2_arg->arr_len == 64);
34608         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
34609         LDKUnsignedChannelAnnouncement contents_arg_conv;
34610         contents_arg_conv.inner = untag_ptr(contents_arg);
34611         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34612         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34613         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34614         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);
34615         uint64_t ret_ref = 0;
34616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34618         return ret_ref;
34619 }
34620
34621 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34622         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34623         uint64_t ret_ref = 0;
34624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34626         return ret_ref;
34627 }
34628 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
34629         LDKChannelAnnouncement arg_conv;
34630         arg_conv.inner = untag_ptr(arg);
34631         arg_conv.is_owned = ptr_is_owned(arg);
34632         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34633         arg_conv.is_owned = false;
34634         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34635         return ret_conv;
34636 }
34637
34638 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
34639         LDKChannelAnnouncement orig_conv;
34640         orig_conv.inner = untag_ptr(orig);
34641         orig_conv.is_owned = ptr_is_owned(orig);
34642         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34643         orig_conv.is_owned = false;
34644         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34645         uint64_t ret_ref = 0;
34646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34648         return ret_ref;
34649 }
34650
34651 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34652         LDKChannelAnnouncement a_conv;
34653         a_conv.inner = untag_ptr(a);
34654         a_conv.is_owned = ptr_is_owned(a);
34655         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34656         a_conv.is_owned = false;
34657         LDKChannelAnnouncement b_conv;
34658         b_conv.inner = untag_ptr(b);
34659         b_conv.is_owned = ptr_is_owned(b);
34660         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34661         b_conv.is_owned = false;
34662         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
34663         return ret_conv;
34664 }
34665
34666 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
34667         LDKUnsignedChannelUpdate this_obj_conv;
34668         this_obj_conv.inner = untag_ptr(this_obj);
34669         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34671         UnsignedChannelUpdate_free(this_obj_conv);
34672 }
34673
34674 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
34675         LDKUnsignedChannelUpdate this_ptr_conv;
34676         this_ptr_conv.inner = untag_ptr(this_ptr);
34677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34679         this_ptr_conv.is_owned = false;
34680         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34681         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
34682         return ret_arr;
34683 }
34684
34685 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34686         LDKUnsignedChannelUpdate this_ptr_conv;
34687         this_ptr_conv.inner = untag_ptr(this_ptr);
34688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34690         this_ptr_conv.is_owned = false;
34691         LDKThirtyTwoBytes val_ref;
34692         CHECK(val->arr_len == 32);
34693         memcpy(val_ref.data, val->elems, 32); FREE(val);
34694         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34695 }
34696
34697 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
34698         LDKUnsignedChannelUpdate this_ptr_conv;
34699         this_ptr_conv.inner = untag_ptr(this_ptr);
34700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34702         this_ptr_conv.is_owned = false;
34703         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34704         return ret_conv;
34705 }
34706
34707 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34708         LDKUnsignedChannelUpdate this_ptr_conv;
34709         this_ptr_conv.inner = untag_ptr(this_ptr);
34710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34712         this_ptr_conv.is_owned = false;
34713         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34714 }
34715
34716 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
34717         LDKUnsignedChannelUpdate this_ptr_conv;
34718         this_ptr_conv.inner = untag_ptr(this_ptr);
34719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34721         this_ptr_conv.is_owned = false;
34722         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34723         return ret_conv;
34724 }
34725
34726 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
34727         LDKUnsignedChannelUpdate this_ptr_conv;
34728         this_ptr_conv.inner = untag_ptr(this_ptr);
34729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34731         this_ptr_conv.is_owned = false;
34732         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34733 }
34734
34735 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
34736         LDKUnsignedChannelUpdate this_ptr_conv;
34737         this_ptr_conv.inner = untag_ptr(this_ptr);
34738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34740         this_ptr_conv.is_owned = false;
34741         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34742         return ret_conv;
34743 }
34744
34745 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
34746         LDKUnsignedChannelUpdate this_ptr_conv;
34747         this_ptr_conv.inner = untag_ptr(this_ptr);
34748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34750         this_ptr_conv.is_owned = false;
34751         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34752 }
34753
34754 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
34755         LDKUnsignedChannelUpdate this_ptr_conv;
34756         this_ptr_conv.inner = untag_ptr(this_ptr);
34757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34759         this_ptr_conv.is_owned = false;
34760         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34761         return ret_conv;
34762 }
34763
34764 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
34765         LDKUnsignedChannelUpdate this_ptr_conv;
34766         this_ptr_conv.inner = untag_ptr(this_ptr);
34767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34769         this_ptr_conv.is_owned = false;
34770         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34771 }
34772
34773 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
34774         LDKUnsignedChannelUpdate this_ptr_conv;
34775         this_ptr_conv.inner = untag_ptr(this_ptr);
34776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34778         this_ptr_conv.is_owned = false;
34779         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34780         return ret_conv;
34781 }
34782
34783 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34784         LDKUnsignedChannelUpdate this_ptr_conv;
34785         this_ptr_conv.inner = untag_ptr(this_ptr);
34786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34788         this_ptr_conv.is_owned = false;
34789         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34790 }
34791
34792 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
34793         LDKUnsignedChannelUpdate this_ptr_conv;
34794         this_ptr_conv.inner = untag_ptr(this_ptr);
34795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34797         this_ptr_conv.is_owned = false;
34798         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34799         return ret_conv;
34800 }
34801
34802 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
34803         LDKUnsignedChannelUpdate this_ptr_conv;
34804         this_ptr_conv.inner = untag_ptr(this_ptr);
34805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34807         this_ptr_conv.is_owned = false;
34808         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34809 }
34810
34811 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
34812         LDKUnsignedChannelUpdate this_ptr_conv;
34813         this_ptr_conv.inner = untag_ptr(this_ptr);
34814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34816         this_ptr_conv.is_owned = false;
34817         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34818         return ret_conv;
34819 }
34820
34821 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
34822         LDKUnsignedChannelUpdate this_ptr_conv;
34823         this_ptr_conv.inner = untag_ptr(this_ptr);
34824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34826         this_ptr_conv.is_owned = false;
34827         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34828 }
34829
34830 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
34831         LDKUnsignedChannelUpdate this_ptr_conv;
34832         this_ptr_conv.inner = untag_ptr(this_ptr);
34833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34835         this_ptr_conv.is_owned = false;
34836         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34837         return ret_conv;
34838 }
34839
34840 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
34841         LDKUnsignedChannelUpdate this_ptr_conv;
34842         this_ptr_conv.inner = untag_ptr(this_ptr);
34843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34845         this_ptr_conv.is_owned = false;
34846         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34847 }
34848
34849 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
34850         LDKUnsignedChannelUpdate this_ptr_conv;
34851         this_ptr_conv.inner = untag_ptr(this_ptr);
34852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34854         this_ptr_conv.is_owned = false;
34855         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34856         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34857         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34858         CVec_u8Z_free(ret_var);
34859         return ret_arr;
34860 }
34861
34862 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
34863         LDKUnsignedChannelUpdate this_ptr_conv;
34864         this_ptr_conv.inner = untag_ptr(this_ptr);
34865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34867         this_ptr_conv.is_owned = false;
34868         LDKCVec_u8Z val_ref;
34869         val_ref.datalen = val->arr_len;
34870         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34871         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34872         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34873 }
34874
34875 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) {
34876         LDKThirtyTwoBytes chain_hash_arg_ref;
34877         CHECK(chain_hash_arg->arr_len == 32);
34878         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34879         LDKCVec_u8Z excess_data_arg_ref;
34880         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
34881         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34882         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
34883         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);
34884         uint64_t ret_ref = 0;
34885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34887         return ret_ref;
34888 }
34889
34890 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34891         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34892         uint64_t ret_ref = 0;
34893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34895         return ret_ref;
34896 }
34897 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
34898         LDKUnsignedChannelUpdate arg_conv;
34899         arg_conv.inner = untag_ptr(arg);
34900         arg_conv.is_owned = ptr_is_owned(arg);
34901         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34902         arg_conv.is_owned = false;
34903         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34904         return ret_conv;
34905 }
34906
34907 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
34908         LDKUnsignedChannelUpdate orig_conv;
34909         orig_conv.inner = untag_ptr(orig);
34910         orig_conv.is_owned = ptr_is_owned(orig);
34911         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34912         orig_conv.is_owned = false;
34913         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34914         uint64_t ret_ref = 0;
34915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34917         return ret_ref;
34918 }
34919
34920 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
34921         LDKUnsignedChannelUpdate a_conv;
34922         a_conv.inner = untag_ptr(a);
34923         a_conv.is_owned = ptr_is_owned(a);
34924         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34925         a_conv.is_owned = false;
34926         LDKUnsignedChannelUpdate b_conv;
34927         b_conv.inner = untag_ptr(b);
34928         b_conv.is_owned = ptr_is_owned(b);
34929         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34930         b_conv.is_owned = false;
34931         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
34932         return ret_conv;
34933 }
34934
34935 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
34936         LDKChannelUpdate this_obj_conv;
34937         this_obj_conv.inner = untag_ptr(this_obj);
34938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34940         ChannelUpdate_free(this_obj_conv);
34941 }
34942
34943 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
34944         LDKChannelUpdate this_ptr_conv;
34945         this_ptr_conv.inner = untag_ptr(this_ptr);
34946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34948         this_ptr_conv.is_owned = false;
34949         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34950         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
34951         return ret_arr;
34952 }
34953
34954 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
34955         LDKChannelUpdate this_ptr_conv;
34956         this_ptr_conv.inner = untag_ptr(this_ptr);
34957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34959         this_ptr_conv.is_owned = false;
34960         LDKSignature val_ref;
34961         CHECK(val->arr_len == 64);
34962         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34963         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34964 }
34965
34966 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
34967         LDKChannelUpdate this_ptr_conv;
34968         this_ptr_conv.inner = untag_ptr(this_ptr);
34969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34971         this_ptr_conv.is_owned = false;
34972         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34973         uint64_t ret_ref = 0;
34974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34976         return ret_ref;
34977 }
34978
34979 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
34980         LDKChannelUpdate this_ptr_conv;
34981         this_ptr_conv.inner = untag_ptr(this_ptr);
34982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34984         this_ptr_conv.is_owned = false;
34985         LDKUnsignedChannelUpdate val_conv;
34986         val_conv.inner = untag_ptr(val);
34987         val_conv.is_owned = ptr_is_owned(val);
34988         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34989         val_conv = UnsignedChannelUpdate_clone(&val_conv);
34990         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34991 }
34992
34993 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
34994         LDKSignature signature_arg_ref;
34995         CHECK(signature_arg->arr_len == 64);
34996         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34997         LDKUnsignedChannelUpdate contents_arg_conv;
34998         contents_arg_conv.inner = untag_ptr(contents_arg);
34999         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
35000         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35001         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
35002         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
35003         uint64_t ret_ref = 0;
35004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35006         return ret_ref;
35007 }
35008
35009 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
35010         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
35011         uint64_t ret_ref = 0;
35012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35014         return ret_ref;
35015 }
35016 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
35017         LDKChannelUpdate arg_conv;
35018         arg_conv.inner = untag_ptr(arg);
35019         arg_conv.is_owned = ptr_is_owned(arg);
35020         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35021         arg_conv.is_owned = false;
35022         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
35023         return ret_conv;
35024 }
35025
35026 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
35027         LDKChannelUpdate orig_conv;
35028         orig_conv.inner = untag_ptr(orig);
35029         orig_conv.is_owned = ptr_is_owned(orig);
35030         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35031         orig_conv.is_owned = false;
35032         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
35033         uint64_t ret_ref = 0;
35034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35036         return ret_ref;
35037 }
35038
35039 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
35040         LDKChannelUpdate a_conv;
35041         a_conv.inner = untag_ptr(a);
35042         a_conv.is_owned = ptr_is_owned(a);
35043         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35044         a_conv.is_owned = false;
35045         LDKChannelUpdate b_conv;
35046         b_conv.inner = untag_ptr(b);
35047         b_conv.is_owned = ptr_is_owned(b);
35048         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35049         b_conv.is_owned = false;
35050         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
35051         return ret_conv;
35052 }
35053
35054 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
35055         LDKQueryChannelRange this_obj_conv;
35056         this_obj_conv.inner = untag_ptr(this_obj);
35057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35059         QueryChannelRange_free(this_obj_conv);
35060 }
35061
35062 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
35063         LDKQueryChannelRange this_ptr_conv;
35064         this_ptr_conv.inner = untag_ptr(this_ptr);
35065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35067         this_ptr_conv.is_owned = false;
35068         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35069         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
35070         return ret_arr;
35071 }
35072
35073 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35074         LDKQueryChannelRange this_ptr_conv;
35075         this_ptr_conv.inner = untag_ptr(this_ptr);
35076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35078         this_ptr_conv.is_owned = false;
35079         LDKThirtyTwoBytes val_ref;
35080         CHECK(val->arr_len == 32);
35081         memcpy(val_ref.data, val->elems, 32); FREE(val);
35082         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35083 }
35084
35085 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
35086         LDKQueryChannelRange this_ptr_conv;
35087         this_ptr_conv.inner = untag_ptr(this_ptr);
35088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35090         this_ptr_conv.is_owned = false;
35091         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
35092         return ret_conv;
35093 }
35094
35095 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35096         LDKQueryChannelRange this_ptr_conv;
35097         this_ptr_conv.inner = untag_ptr(this_ptr);
35098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35100         this_ptr_conv.is_owned = false;
35101         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
35102 }
35103
35104 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35105         LDKQueryChannelRange this_ptr_conv;
35106         this_ptr_conv.inner = untag_ptr(this_ptr);
35107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35109         this_ptr_conv.is_owned = false;
35110         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
35111         return ret_conv;
35112 }
35113
35114 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35115         LDKQueryChannelRange this_ptr_conv;
35116         this_ptr_conv.inner = untag_ptr(this_ptr);
35117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35119         this_ptr_conv.is_owned = false;
35120         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35121 }
35122
35123 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) {
35124         LDKThirtyTwoBytes chain_hash_arg_ref;
35125         CHECK(chain_hash_arg->arr_len == 32);
35126         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35127         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
35128         uint64_t ret_ref = 0;
35129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35131         return ret_ref;
35132 }
35133
35134 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
35135         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
35136         uint64_t ret_ref = 0;
35137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35139         return ret_ref;
35140 }
35141 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
35142         LDKQueryChannelRange arg_conv;
35143         arg_conv.inner = untag_ptr(arg);
35144         arg_conv.is_owned = ptr_is_owned(arg);
35145         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35146         arg_conv.is_owned = false;
35147         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
35148         return ret_conv;
35149 }
35150
35151 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
35152         LDKQueryChannelRange orig_conv;
35153         orig_conv.inner = untag_ptr(orig);
35154         orig_conv.is_owned = ptr_is_owned(orig);
35155         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35156         orig_conv.is_owned = false;
35157         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
35158         uint64_t ret_ref = 0;
35159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35161         return ret_ref;
35162 }
35163
35164 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
35165         LDKQueryChannelRange a_conv;
35166         a_conv.inner = untag_ptr(a);
35167         a_conv.is_owned = ptr_is_owned(a);
35168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35169         a_conv.is_owned = false;
35170         LDKQueryChannelRange b_conv;
35171         b_conv.inner = untag_ptr(b);
35172         b_conv.is_owned = ptr_is_owned(b);
35173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35174         b_conv.is_owned = false;
35175         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
35176         return ret_conv;
35177 }
35178
35179 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
35180         LDKReplyChannelRange this_obj_conv;
35181         this_obj_conv.inner = untag_ptr(this_obj);
35182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35184         ReplyChannelRange_free(this_obj_conv);
35185 }
35186
35187 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
35188         LDKReplyChannelRange this_ptr_conv;
35189         this_ptr_conv.inner = untag_ptr(this_ptr);
35190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35192         this_ptr_conv.is_owned = false;
35193         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35194         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
35195         return ret_arr;
35196 }
35197
35198 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35199         LDKReplyChannelRange this_ptr_conv;
35200         this_ptr_conv.inner = untag_ptr(this_ptr);
35201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35203         this_ptr_conv.is_owned = false;
35204         LDKThirtyTwoBytes val_ref;
35205         CHECK(val->arr_len == 32);
35206         memcpy(val_ref.data, val->elems, 32); FREE(val);
35207         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35208 }
35209
35210 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
35211         LDKReplyChannelRange this_ptr_conv;
35212         this_ptr_conv.inner = untag_ptr(this_ptr);
35213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35215         this_ptr_conv.is_owned = false;
35216         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35217         return ret_conv;
35218 }
35219
35220 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35221         LDKReplyChannelRange this_ptr_conv;
35222         this_ptr_conv.inner = untag_ptr(this_ptr);
35223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35225         this_ptr_conv.is_owned = false;
35226         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35227 }
35228
35229 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35230         LDKReplyChannelRange this_ptr_conv;
35231         this_ptr_conv.inner = untag_ptr(this_ptr);
35232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35234         this_ptr_conv.is_owned = false;
35235         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35236         return ret_conv;
35237 }
35238
35239 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35240         LDKReplyChannelRange this_ptr_conv;
35241         this_ptr_conv.inner = untag_ptr(this_ptr);
35242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35244         this_ptr_conv.is_owned = false;
35245         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35246 }
35247
35248 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
35249         LDKReplyChannelRange this_ptr_conv;
35250         this_ptr_conv.inner = untag_ptr(this_ptr);
35251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35253         this_ptr_conv.is_owned = false;
35254         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35255         return ret_conv;
35256 }
35257
35258 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
35259         LDKReplyChannelRange this_ptr_conv;
35260         this_ptr_conv.inner = untag_ptr(this_ptr);
35261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35263         this_ptr_conv.is_owned = false;
35264         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35265 }
35266
35267 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
35268         LDKReplyChannelRange this_ptr_conv;
35269         this_ptr_conv.inner = untag_ptr(this_ptr);
35270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35272         this_ptr_conv.is_owned = false;
35273         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
35274         int64_tArray ret_arr = NULL;
35275         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35276         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35277         for (size_t i = 0; i < ret_var.datalen; i++) {
35278                 int64_t ret_conv_8_conv = ret_var.data[i];
35279                 ret_arr_ptr[i] = ret_conv_8_conv;
35280         }
35281         
35282         FREE(ret_var.data);
35283         return ret_arr;
35284 }
35285
35286 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35287         LDKReplyChannelRange this_ptr_conv;
35288         this_ptr_conv.inner = untag_ptr(this_ptr);
35289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35291         this_ptr_conv.is_owned = false;
35292         LDKCVec_u64Z val_constr;
35293         val_constr.datalen = val->arr_len;
35294         if (val_constr.datalen > 0)
35295                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35296         else
35297                 val_constr.data = NULL;
35298         int64_t* val_vals = val->elems;
35299         for (size_t i = 0; i < val_constr.datalen; i++) {
35300                 int64_t val_conv_8 = val_vals[i];
35301                 val_constr.data[i] = val_conv_8;
35302         }
35303         FREE(val);
35304         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35305 }
35306
35307 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) {
35308         LDKThirtyTwoBytes chain_hash_arg_ref;
35309         CHECK(chain_hash_arg->arr_len == 32);
35310         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35311         LDKCVec_u64Z short_channel_ids_arg_constr;
35312         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35313         if (short_channel_ids_arg_constr.datalen > 0)
35314                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35315         else
35316                 short_channel_ids_arg_constr.data = NULL;
35317         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35318         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35319                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35320                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35321         }
35322         FREE(short_channel_ids_arg);
35323         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35324         uint64_t ret_ref = 0;
35325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35327         return ret_ref;
35328 }
35329
35330 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35331         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35332         uint64_t ret_ref = 0;
35333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35335         return ret_ref;
35336 }
35337 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
35338         LDKReplyChannelRange arg_conv;
35339         arg_conv.inner = untag_ptr(arg);
35340         arg_conv.is_owned = ptr_is_owned(arg);
35341         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35342         arg_conv.is_owned = false;
35343         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35344         return ret_conv;
35345 }
35346
35347 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
35348         LDKReplyChannelRange orig_conv;
35349         orig_conv.inner = untag_ptr(orig);
35350         orig_conv.is_owned = ptr_is_owned(orig);
35351         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35352         orig_conv.is_owned = false;
35353         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35354         uint64_t ret_ref = 0;
35355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35357         return ret_ref;
35358 }
35359
35360 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
35361         LDKReplyChannelRange a_conv;
35362         a_conv.inner = untag_ptr(a);
35363         a_conv.is_owned = ptr_is_owned(a);
35364         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35365         a_conv.is_owned = false;
35366         LDKReplyChannelRange b_conv;
35367         b_conv.inner = untag_ptr(b);
35368         b_conv.is_owned = ptr_is_owned(b);
35369         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35370         b_conv.is_owned = false;
35371         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
35372         return ret_conv;
35373 }
35374
35375 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
35376         LDKQueryShortChannelIds this_obj_conv;
35377         this_obj_conv.inner = untag_ptr(this_obj);
35378         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35380         QueryShortChannelIds_free(this_obj_conv);
35381 }
35382
35383 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
35384         LDKQueryShortChannelIds this_ptr_conv;
35385         this_ptr_conv.inner = untag_ptr(this_ptr);
35386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35388         this_ptr_conv.is_owned = false;
35389         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35390         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
35391         return ret_arr;
35392 }
35393
35394 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35395         LDKQueryShortChannelIds this_ptr_conv;
35396         this_ptr_conv.inner = untag_ptr(this_ptr);
35397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35399         this_ptr_conv.is_owned = false;
35400         LDKThirtyTwoBytes val_ref;
35401         CHECK(val->arr_len == 32);
35402         memcpy(val_ref.data, val->elems, 32); FREE(val);
35403         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35404 }
35405
35406 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
35407         LDKQueryShortChannelIds this_ptr_conv;
35408         this_ptr_conv.inner = untag_ptr(this_ptr);
35409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35411         this_ptr_conv.is_owned = false;
35412         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
35413         int64_tArray ret_arr = NULL;
35414         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35415         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35416         for (size_t i = 0; i < ret_var.datalen; i++) {
35417                 int64_t ret_conv_8_conv = ret_var.data[i];
35418                 ret_arr_ptr[i] = ret_conv_8_conv;
35419         }
35420         
35421         FREE(ret_var.data);
35422         return ret_arr;
35423 }
35424
35425 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35426         LDKQueryShortChannelIds this_ptr_conv;
35427         this_ptr_conv.inner = untag_ptr(this_ptr);
35428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35430         this_ptr_conv.is_owned = false;
35431         LDKCVec_u64Z val_constr;
35432         val_constr.datalen = val->arr_len;
35433         if (val_constr.datalen > 0)
35434                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35435         else
35436                 val_constr.data = NULL;
35437         int64_t* val_vals = val->elems;
35438         for (size_t i = 0; i < val_constr.datalen; i++) {
35439                 int64_t val_conv_8 = val_vals[i];
35440                 val_constr.data[i] = val_conv_8;
35441         }
35442         FREE(val);
35443         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35444 }
35445
35446 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
35447         LDKThirtyTwoBytes chain_hash_arg_ref;
35448         CHECK(chain_hash_arg->arr_len == 32);
35449         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35450         LDKCVec_u64Z short_channel_ids_arg_constr;
35451         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35452         if (short_channel_ids_arg_constr.datalen > 0)
35453                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35454         else
35455                 short_channel_ids_arg_constr.data = NULL;
35456         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35457         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35458                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35459                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35460         }
35461         FREE(short_channel_ids_arg);
35462         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35463         uint64_t ret_ref = 0;
35464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35466         return ret_ref;
35467 }
35468
35469 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35470         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35471         uint64_t ret_ref = 0;
35472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35474         return ret_ref;
35475 }
35476 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
35477         LDKQueryShortChannelIds arg_conv;
35478         arg_conv.inner = untag_ptr(arg);
35479         arg_conv.is_owned = ptr_is_owned(arg);
35480         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35481         arg_conv.is_owned = false;
35482         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35483         return ret_conv;
35484 }
35485
35486 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
35487         LDKQueryShortChannelIds orig_conv;
35488         orig_conv.inner = untag_ptr(orig);
35489         orig_conv.is_owned = ptr_is_owned(orig);
35490         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35491         orig_conv.is_owned = false;
35492         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35493         uint64_t ret_ref = 0;
35494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35496         return ret_ref;
35497 }
35498
35499 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
35500         LDKQueryShortChannelIds a_conv;
35501         a_conv.inner = untag_ptr(a);
35502         a_conv.is_owned = ptr_is_owned(a);
35503         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35504         a_conv.is_owned = false;
35505         LDKQueryShortChannelIds b_conv;
35506         b_conv.inner = untag_ptr(b);
35507         b_conv.is_owned = ptr_is_owned(b);
35508         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35509         b_conv.is_owned = false;
35510         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
35511         return ret_conv;
35512 }
35513
35514 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
35515         LDKReplyShortChannelIdsEnd this_obj_conv;
35516         this_obj_conv.inner = untag_ptr(this_obj);
35517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35519         ReplyShortChannelIdsEnd_free(this_obj_conv);
35520 }
35521
35522 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
35523         LDKReplyShortChannelIdsEnd this_ptr_conv;
35524         this_ptr_conv.inner = untag_ptr(this_ptr);
35525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35527         this_ptr_conv.is_owned = false;
35528         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35529         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
35530         return ret_arr;
35531 }
35532
35533 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35534         LDKReplyShortChannelIdsEnd this_ptr_conv;
35535         this_ptr_conv.inner = untag_ptr(this_ptr);
35536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35538         this_ptr_conv.is_owned = false;
35539         LDKThirtyTwoBytes val_ref;
35540         CHECK(val->arr_len == 32);
35541         memcpy(val_ref.data, val->elems, 32); FREE(val);
35542         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35543 }
35544
35545 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
35546         LDKReplyShortChannelIdsEnd this_ptr_conv;
35547         this_ptr_conv.inner = untag_ptr(this_ptr);
35548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35550         this_ptr_conv.is_owned = false;
35551         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35552         return ret_conv;
35553 }
35554
35555 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
35556         LDKReplyShortChannelIdsEnd this_ptr_conv;
35557         this_ptr_conv.inner = untag_ptr(this_ptr);
35558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35560         this_ptr_conv.is_owned = false;
35561         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35562 }
35563
35564 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
35565         LDKThirtyTwoBytes chain_hash_arg_ref;
35566         CHECK(chain_hash_arg->arr_len == 32);
35567         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35568         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35569         uint64_t ret_ref = 0;
35570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35572         return ret_ref;
35573 }
35574
35575 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35576         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35577         uint64_t ret_ref = 0;
35578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35580         return ret_ref;
35581 }
35582 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
35583         LDKReplyShortChannelIdsEnd arg_conv;
35584         arg_conv.inner = untag_ptr(arg);
35585         arg_conv.is_owned = ptr_is_owned(arg);
35586         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35587         arg_conv.is_owned = false;
35588         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35589         return ret_conv;
35590 }
35591
35592 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
35593         LDKReplyShortChannelIdsEnd orig_conv;
35594         orig_conv.inner = untag_ptr(orig);
35595         orig_conv.is_owned = ptr_is_owned(orig);
35596         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35597         orig_conv.is_owned = false;
35598         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35599         uint64_t ret_ref = 0;
35600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35602         return ret_ref;
35603 }
35604
35605 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
35606         LDKReplyShortChannelIdsEnd a_conv;
35607         a_conv.inner = untag_ptr(a);
35608         a_conv.is_owned = ptr_is_owned(a);
35609         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35610         a_conv.is_owned = false;
35611         LDKReplyShortChannelIdsEnd b_conv;
35612         b_conv.inner = untag_ptr(b);
35613         b_conv.is_owned = ptr_is_owned(b);
35614         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35615         b_conv.is_owned = false;
35616         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
35617         return ret_conv;
35618 }
35619
35620 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
35621         LDKGossipTimestampFilter this_obj_conv;
35622         this_obj_conv.inner = untag_ptr(this_obj);
35623         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35625         GossipTimestampFilter_free(this_obj_conv);
35626 }
35627
35628 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
35629         LDKGossipTimestampFilter this_ptr_conv;
35630         this_ptr_conv.inner = untag_ptr(this_ptr);
35631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35633         this_ptr_conv.is_owned = false;
35634         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35635         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
35636         return ret_arr;
35637 }
35638
35639 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35640         LDKGossipTimestampFilter this_ptr_conv;
35641         this_ptr_conv.inner = untag_ptr(this_ptr);
35642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35644         this_ptr_conv.is_owned = false;
35645         LDKThirtyTwoBytes val_ref;
35646         CHECK(val->arr_len == 32);
35647         memcpy(val_ref.data, val->elems, 32); FREE(val);
35648         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35649 }
35650
35651 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
35652         LDKGossipTimestampFilter this_ptr_conv;
35653         this_ptr_conv.inner = untag_ptr(this_ptr);
35654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35656         this_ptr_conv.is_owned = false;
35657         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35658         return ret_conv;
35659 }
35660
35661 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
35662         LDKGossipTimestampFilter this_ptr_conv;
35663         this_ptr_conv.inner = untag_ptr(this_ptr);
35664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35666         this_ptr_conv.is_owned = false;
35667         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35668 }
35669
35670 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
35671         LDKGossipTimestampFilter this_ptr_conv;
35672         this_ptr_conv.inner = untag_ptr(this_ptr);
35673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35675         this_ptr_conv.is_owned = false;
35676         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35677         return ret_conv;
35678 }
35679
35680 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
35681         LDKGossipTimestampFilter this_ptr_conv;
35682         this_ptr_conv.inner = untag_ptr(this_ptr);
35683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35685         this_ptr_conv.is_owned = false;
35686         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35687 }
35688
35689 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) {
35690         LDKThirtyTwoBytes chain_hash_arg_ref;
35691         CHECK(chain_hash_arg->arr_len == 32);
35692         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35693         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35694         uint64_t ret_ref = 0;
35695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35697         return ret_ref;
35698 }
35699
35700 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35701         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35702         uint64_t ret_ref = 0;
35703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35705         return ret_ref;
35706 }
35707 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
35708         LDKGossipTimestampFilter arg_conv;
35709         arg_conv.inner = untag_ptr(arg);
35710         arg_conv.is_owned = ptr_is_owned(arg);
35711         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35712         arg_conv.is_owned = false;
35713         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35714         return ret_conv;
35715 }
35716
35717 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
35718         LDKGossipTimestampFilter orig_conv;
35719         orig_conv.inner = untag_ptr(orig);
35720         orig_conv.is_owned = ptr_is_owned(orig);
35721         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35722         orig_conv.is_owned = false;
35723         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35724         uint64_t ret_ref = 0;
35725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35727         return ret_ref;
35728 }
35729
35730 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
35731         LDKGossipTimestampFilter a_conv;
35732         a_conv.inner = untag_ptr(a);
35733         a_conv.is_owned = ptr_is_owned(a);
35734         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35735         a_conv.is_owned = false;
35736         LDKGossipTimestampFilter b_conv;
35737         b_conv.inner = untag_ptr(b);
35738         b_conv.is_owned = ptr_is_owned(b);
35739         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35740         b_conv.is_owned = false;
35741         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
35742         return ret_conv;
35743 }
35744
35745 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
35746         if (!ptr_is_owned(this_ptr)) return;
35747         void* this_ptr_ptr = untag_ptr(this_ptr);
35748         CHECK_ACCESS(this_ptr_ptr);
35749         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35750         FREE(untag_ptr(this_ptr));
35751         ErrorAction_free(this_ptr_conv);
35752 }
35753
35754 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35755         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35756         *ret_copy = ErrorAction_clone(arg);
35757         uint64_t ret_ref = tag_ptr(ret_copy, true);
35758         return ret_ref;
35759 }
35760 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
35761         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35762         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35763         return ret_conv;
35764 }
35765
35766 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
35767         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35768         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35769         *ret_copy = ErrorAction_clone(orig_conv);
35770         uint64_t ret_ref = tag_ptr(ret_copy, true);
35771         return ret_ref;
35772 }
35773
35774 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
35775         LDKErrorMessage msg_conv;
35776         msg_conv.inner = untag_ptr(msg);
35777         msg_conv.is_owned = ptr_is_owned(msg);
35778         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35779         msg_conv = ErrorMessage_clone(&msg_conv);
35780         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35781         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35782         uint64_t ret_ref = tag_ptr(ret_copy, true);
35783         return ret_ref;
35784 }
35785
35786 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
35787         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35788         *ret_copy = ErrorAction_ignore_error();
35789         uint64_t ret_ref = tag_ptr(ret_copy, true);
35790         return ret_ref;
35791 }
35792
35793 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
35794         LDKLevel a_conv = LDKLevel_from_js(a);
35795         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35796         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35797         uint64_t ret_ref = tag_ptr(ret_copy, true);
35798         return ret_ref;
35799 }
35800
35801 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
35802         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35803         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35804         uint64_t ret_ref = tag_ptr(ret_copy, true);
35805         return ret_ref;
35806 }
35807
35808 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
35809         LDKErrorMessage msg_conv;
35810         msg_conv.inner = untag_ptr(msg);
35811         msg_conv.is_owned = ptr_is_owned(msg);
35812         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35813         msg_conv = ErrorMessage_clone(&msg_conv);
35814         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35815         *ret_copy = ErrorAction_send_error_message(msg_conv);
35816         uint64_t ret_ref = tag_ptr(ret_copy, true);
35817         return ret_ref;
35818 }
35819
35820 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
35821         LDKWarningMessage msg_conv;
35822         msg_conv.inner = untag_ptr(msg);
35823         msg_conv.is_owned = ptr_is_owned(msg);
35824         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35825         msg_conv = WarningMessage_clone(&msg_conv);
35826         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
35827         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35828         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35829         uint64_t ret_ref = tag_ptr(ret_copy, true);
35830         return ret_ref;
35831 }
35832
35833 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
35834         LDKLightningError this_obj_conv;
35835         this_obj_conv.inner = untag_ptr(this_obj);
35836         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35838         LightningError_free(this_obj_conv);
35839 }
35840
35841 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
35842         LDKLightningError this_ptr_conv;
35843         this_ptr_conv.inner = untag_ptr(this_ptr);
35844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35846         this_ptr_conv.is_owned = false;
35847         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35848         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35849         Str_free(ret_str);
35850         return ret_conv;
35851 }
35852
35853 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
35854         LDKLightningError this_ptr_conv;
35855         this_ptr_conv.inner = untag_ptr(this_ptr);
35856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35858         this_ptr_conv.is_owned = false;
35859         LDKStr val_conv = str_ref_to_owned_c(val);
35860         LightningError_set_err(&this_ptr_conv, val_conv);
35861 }
35862
35863 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
35864         LDKLightningError this_ptr_conv;
35865         this_ptr_conv.inner = untag_ptr(this_ptr);
35866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35868         this_ptr_conv.is_owned = false;
35869         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35870         *ret_copy = LightningError_get_action(&this_ptr_conv);
35871         uint64_t ret_ref = tag_ptr(ret_copy, true);
35872         return ret_ref;
35873 }
35874
35875 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
35876         LDKLightningError this_ptr_conv;
35877         this_ptr_conv.inner = untag_ptr(this_ptr);
35878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35880         this_ptr_conv.is_owned = false;
35881         void* val_ptr = untag_ptr(val);
35882         CHECK_ACCESS(val_ptr);
35883         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35884         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35885         LightningError_set_action(&this_ptr_conv, val_conv);
35886 }
35887
35888 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
35889         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
35890         void* action_arg_ptr = untag_ptr(action_arg);
35891         CHECK_ACCESS(action_arg_ptr);
35892         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35893         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
35894         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35895         uint64_t ret_ref = 0;
35896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35898         return ret_ref;
35899 }
35900
35901 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35902         LDKLightningError ret_var = LightningError_clone(arg);
35903         uint64_t ret_ref = 0;
35904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35906         return ret_ref;
35907 }
35908 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
35909         LDKLightningError arg_conv;
35910         arg_conv.inner = untag_ptr(arg);
35911         arg_conv.is_owned = ptr_is_owned(arg);
35912         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35913         arg_conv.is_owned = false;
35914         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35915         return ret_conv;
35916 }
35917
35918 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
35919         LDKLightningError orig_conv;
35920         orig_conv.inner = untag_ptr(orig);
35921         orig_conv.is_owned = ptr_is_owned(orig);
35922         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35923         orig_conv.is_owned = false;
35924         LDKLightningError ret_var = LightningError_clone(&orig_conv);
35925         uint64_t ret_ref = 0;
35926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35928         return ret_ref;
35929 }
35930
35931 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
35932         LDKCommitmentUpdate this_obj_conv;
35933         this_obj_conv.inner = untag_ptr(this_obj);
35934         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35936         CommitmentUpdate_free(this_obj_conv);
35937 }
35938
35939 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
35940         LDKCommitmentUpdate this_ptr_conv;
35941         this_ptr_conv.inner = untag_ptr(this_ptr);
35942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35944         this_ptr_conv.is_owned = false;
35945         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35946         uint64_tArray ret_arr = NULL;
35947         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35948         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35949         for (size_t p = 0; p < ret_var.datalen; p++) {
35950                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35951                 uint64_t ret_conv_15_ref = 0;
35952                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35953                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
35954                 ret_arr_ptr[p] = ret_conv_15_ref;
35955         }
35956         
35957         FREE(ret_var.data);
35958         return ret_arr;
35959 }
35960
35961 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
35962         LDKCommitmentUpdate this_ptr_conv;
35963         this_ptr_conv.inner = untag_ptr(this_ptr);
35964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35966         this_ptr_conv.is_owned = false;
35967         LDKCVec_UpdateAddHTLCZ val_constr;
35968         val_constr.datalen = val->arr_len;
35969         if (val_constr.datalen > 0)
35970                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35971         else
35972                 val_constr.data = NULL;
35973         uint64_t* val_vals = val->elems;
35974         for (size_t p = 0; p < val_constr.datalen; p++) {
35975                 uint64_t val_conv_15 = val_vals[p];
35976                 LDKUpdateAddHTLC val_conv_15_conv;
35977                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
35978                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
35979                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35980                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35981                 val_constr.data[p] = val_conv_15_conv;
35982         }
35983         FREE(val);
35984         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
35985 }
35986
35987 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
35988         LDKCommitmentUpdate this_ptr_conv;
35989         this_ptr_conv.inner = untag_ptr(this_ptr);
35990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35992         this_ptr_conv.is_owned = false;
35993         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35994         uint64_tArray ret_arr = NULL;
35995         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35996         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35997         for (size_t t = 0; t < ret_var.datalen; t++) {
35998                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35999                 uint64_t ret_conv_19_ref = 0;
36000                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
36001                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
36002                 ret_arr_ptr[t] = ret_conv_19_ref;
36003         }
36004         
36005         FREE(ret_var.data);
36006         return ret_arr;
36007 }
36008
36009 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
36010         LDKCommitmentUpdate this_ptr_conv;
36011         this_ptr_conv.inner = untag_ptr(this_ptr);
36012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36014         this_ptr_conv.is_owned = false;
36015         LDKCVec_UpdateFulfillHTLCZ val_constr;
36016         val_constr.datalen = val->arr_len;
36017         if (val_constr.datalen > 0)
36018                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36019         else
36020                 val_constr.data = NULL;
36021         uint64_t* val_vals = val->elems;
36022         for (size_t t = 0; t < val_constr.datalen; t++) {
36023                 uint64_t val_conv_19 = val_vals[t];
36024                 LDKUpdateFulfillHTLC val_conv_19_conv;
36025                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
36026                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
36027                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
36028                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
36029                 val_constr.data[t] = val_conv_19_conv;
36030         }
36031         FREE(val);
36032         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
36033 }
36034
36035 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
36036         LDKCommitmentUpdate this_ptr_conv;
36037         this_ptr_conv.inner = untag_ptr(this_ptr);
36038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36040         this_ptr_conv.is_owned = false;
36041         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
36042         uint64_tArray ret_arr = NULL;
36043         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36044         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36045         for (size_t q = 0; q < ret_var.datalen; q++) {
36046                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
36047                 uint64_t ret_conv_16_ref = 0;
36048                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
36049                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
36050                 ret_arr_ptr[q] = ret_conv_16_ref;
36051         }
36052         
36053         FREE(ret_var.data);
36054         return ret_arr;
36055 }
36056
36057 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
36058         LDKCommitmentUpdate this_ptr_conv;
36059         this_ptr_conv.inner = untag_ptr(this_ptr);
36060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36062         this_ptr_conv.is_owned = false;
36063         LDKCVec_UpdateFailHTLCZ val_constr;
36064         val_constr.datalen = val->arr_len;
36065         if (val_constr.datalen > 0)
36066                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36067         else
36068                 val_constr.data = NULL;
36069         uint64_t* val_vals = val->elems;
36070         for (size_t q = 0; q < val_constr.datalen; q++) {
36071                 uint64_t val_conv_16 = val_vals[q];
36072                 LDKUpdateFailHTLC val_conv_16_conv;
36073                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
36074                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
36075                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
36076                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
36077                 val_constr.data[q] = val_conv_16_conv;
36078         }
36079         FREE(val);
36080         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
36081 }
36082
36083 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
36084         LDKCommitmentUpdate this_ptr_conv;
36085         this_ptr_conv.inner = untag_ptr(this_ptr);
36086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36088         this_ptr_conv.is_owned = false;
36089         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
36090         uint64_tArray ret_arr = NULL;
36091         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36092         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36093         for (size_t z = 0; z < ret_var.datalen; z++) {
36094                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
36095                 uint64_t ret_conv_25_ref = 0;
36096                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
36097                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
36098                 ret_arr_ptr[z] = ret_conv_25_ref;
36099         }
36100         
36101         FREE(ret_var.data);
36102         return ret_arr;
36103 }
36104
36105 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) {
36106         LDKCommitmentUpdate this_ptr_conv;
36107         this_ptr_conv.inner = untag_ptr(this_ptr);
36108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36110         this_ptr_conv.is_owned = false;
36111         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
36112         val_constr.datalen = val->arr_len;
36113         if (val_constr.datalen > 0)
36114                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36115         else
36116                 val_constr.data = NULL;
36117         uint64_t* val_vals = val->elems;
36118         for (size_t z = 0; z < val_constr.datalen; z++) {
36119                 uint64_t val_conv_25 = val_vals[z];
36120                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
36121                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
36122                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
36123                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
36124                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
36125                 val_constr.data[z] = val_conv_25_conv;
36126         }
36127         FREE(val);
36128         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
36129 }
36130
36131 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
36132         LDKCommitmentUpdate this_ptr_conv;
36133         this_ptr_conv.inner = untag_ptr(this_ptr);
36134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36136         this_ptr_conv.is_owned = false;
36137         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
36138         uint64_t ret_ref = 0;
36139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36141         return ret_ref;
36142 }
36143
36144 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
36145         LDKCommitmentUpdate this_ptr_conv;
36146         this_ptr_conv.inner = untag_ptr(this_ptr);
36147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36149         this_ptr_conv.is_owned = false;
36150         LDKUpdateFee val_conv;
36151         val_conv.inner = untag_ptr(val);
36152         val_conv.is_owned = ptr_is_owned(val);
36153         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36154         val_conv = UpdateFee_clone(&val_conv);
36155         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
36156 }
36157
36158 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
36159         LDKCommitmentUpdate this_ptr_conv;
36160         this_ptr_conv.inner = untag_ptr(this_ptr);
36161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36163         this_ptr_conv.is_owned = false;
36164         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
36165         uint64_t ret_ref = 0;
36166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36168         return ret_ref;
36169 }
36170
36171 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
36172         LDKCommitmentUpdate this_ptr_conv;
36173         this_ptr_conv.inner = untag_ptr(this_ptr);
36174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36176         this_ptr_conv.is_owned = false;
36177         LDKCommitmentSigned val_conv;
36178         val_conv.inner = untag_ptr(val);
36179         val_conv.is_owned = ptr_is_owned(val);
36180         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36181         val_conv = CommitmentSigned_clone(&val_conv);
36182         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
36183 }
36184
36185 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) {
36186         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
36187         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
36188         if (update_add_htlcs_arg_constr.datalen > 0)
36189                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36190         else
36191                 update_add_htlcs_arg_constr.data = NULL;
36192         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
36193         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
36194                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
36195                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
36196                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
36197                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
36198                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
36199                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
36200                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
36201         }
36202         FREE(update_add_htlcs_arg);
36203         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
36204         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
36205         if (update_fulfill_htlcs_arg_constr.datalen > 0)
36206                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36207         else
36208                 update_fulfill_htlcs_arg_constr.data = NULL;
36209         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
36210         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
36211                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
36212                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
36213                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
36214                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
36215                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
36216                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
36217                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
36218         }
36219         FREE(update_fulfill_htlcs_arg);
36220         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
36221         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
36222         if (update_fail_htlcs_arg_constr.datalen > 0)
36223                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36224         else
36225                 update_fail_htlcs_arg_constr.data = NULL;
36226         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
36227         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
36228                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
36229                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
36230                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
36231                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
36232                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
36233                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
36234                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
36235         }
36236         FREE(update_fail_htlcs_arg);
36237         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
36238         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
36239         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
36240                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36241         else
36242                 update_fail_malformed_htlcs_arg_constr.data = NULL;
36243         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
36244         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
36245                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
36246                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
36247                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
36248                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
36249                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
36250                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
36251                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
36252         }
36253         FREE(update_fail_malformed_htlcs_arg);
36254         LDKUpdateFee update_fee_arg_conv;
36255         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
36256         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
36257         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
36258         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
36259         LDKCommitmentSigned commitment_signed_arg_conv;
36260         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
36261         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
36262         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
36263         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
36264         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);
36265         uint64_t ret_ref = 0;
36266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36268         return ret_ref;
36269 }
36270
36271 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36272         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36273         uint64_t ret_ref = 0;
36274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36276         return ret_ref;
36277 }
36278 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
36279         LDKCommitmentUpdate arg_conv;
36280         arg_conv.inner = untag_ptr(arg);
36281         arg_conv.is_owned = ptr_is_owned(arg);
36282         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36283         arg_conv.is_owned = false;
36284         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36285         return ret_conv;
36286 }
36287
36288 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
36289         LDKCommitmentUpdate orig_conv;
36290         orig_conv.inner = untag_ptr(orig);
36291         orig_conv.is_owned = ptr_is_owned(orig);
36292         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36293         orig_conv.is_owned = false;
36294         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36295         uint64_t ret_ref = 0;
36296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36298         return ret_ref;
36299 }
36300
36301 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
36302         LDKCommitmentUpdate a_conv;
36303         a_conv.inner = untag_ptr(a);
36304         a_conv.is_owned = ptr_is_owned(a);
36305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36306         a_conv.is_owned = false;
36307         LDKCommitmentUpdate b_conv;
36308         b_conv.inner = untag_ptr(b);
36309         b_conv.is_owned = ptr_is_owned(b);
36310         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36311         b_conv.is_owned = false;
36312         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
36313         return ret_conv;
36314 }
36315
36316 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
36317         if (!ptr_is_owned(this_ptr)) return;
36318         void* this_ptr_ptr = untag_ptr(this_ptr);
36319         CHECK_ACCESS(this_ptr_ptr);
36320         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36321         FREE(untag_ptr(this_ptr));
36322         ChannelMessageHandler_free(this_ptr_conv);
36323 }
36324
36325 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
36326         if (!ptr_is_owned(this_ptr)) return;
36327         void* this_ptr_ptr = untag_ptr(this_ptr);
36328         CHECK_ACCESS(this_ptr_ptr);
36329         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36330         FREE(untag_ptr(this_ptr));
36331         RoutingMessageHandler_free(this_ptr_conv);
36332 }
36333
36334 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
36335         if (!ptr_is_owned(this_ptr)) return;
36336         void* this_ptr_ptr = untag_ptr(this_ptr);
36337         CHECK_ACCESS(this_ptr_ptr);
36338         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
36339         FREE(untag_ptr(this_ptr));
36340         OnionMessageHandler_free(this_ptr_conv);
36341 }
36342
36343 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
36344         LDKAcceptChannel obj_conv;
36345         obj_conv.inner = untag_ptr(obj);
36346         obj_conv.is_owned = ptr_is_owned(obj);
36347         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36348         obj_conv.is_owned = false;
36349         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36350         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36351         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36352         CVec_u8Z_free(ret_var);
36353         return ret_arr;
36354 }
36355
36356 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
36357         LDKu8slice ser_ref;
36358         ser_ref.datalen = ser->arr_len;
36359         ser_ref.data = ser->elems;
36360         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36361         *ret_conv = AcceptChannel_read(ser_ref);
36362         FREE(ser);
36363         return tag_ptr(ret_conv, true);
36364 }
36365
36366 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
36367         LDKAnnouncementSignatures obj_conv;
36368         obj_conv.inner = untag_ptr(obj);
36369         obj_conv.is_owned = ptr_is_owned(obj);
36370         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36371         obj_conv.is_owned = false;
36372         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36373         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36374         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36375         CVec_u8Z_free(ret_var);
36376         return ret_arr;
36377 }
36378
36379 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
36380         LDKu8slice ser_ref;
36381         ser_ref.datalen = ser->arr_len;
36382         ser_ref.data = ser->elems;
36383         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36384         *ret_conv = AnnouncementSignatures_read(ser_ref);
36385         FREE(ser);
36386         return tag_ptr(ret_conv, true);
36387 }
36388
36389 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
36390         LDKChannelReestablish obj_conv;
36391         obj_conv.inner = untag_ptr(obj);
36392         obj_conv.is_owned = ptr_is_owned(obj);
36393         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36394         obj_conv.is_owned = false;
36395         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36396         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36397         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36398         CVec_u8Z_free(ret_var);
36399         return ret_arr;
36400 }
36401
36402 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
36403         LDKu8slice ser_ref;
36404         ser_ref.datalen = ser->arr_len;
36405         ser_ref.data = ser->elems;
36406         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36407         *ret_conv = ChannelReestablish_read(ser_ref);
36408         FREE(ser);
36409         return tag_ptr(ret_conv, true);
36410 }
36411
36412 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
36413         LDKClosingSigned obj_conv;
36414         obj_conv.inner = untag_ptr(obj);
36415         obj_conv.is_owned = ptr_is_owned(obj);
36416         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36417         obj_conv.is_owned = false;
36418         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36419         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36420         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36421         CVec_u8Z_free(ret_var);
36422         return ret_arr;
36423 }
36424
36425 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
36426         LDKu8slice ser_ref;
36427         ser_ref.datalen = ser->arr_len;
36428         ser_ref.data = ser->elems;
36429         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36430         *ret_conv = ClosingSigned_read(ser_ref);
36431         FREE(ser);
36432         return tag_ptr(ret_conv, true);
36433 }
36434
36435 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
36436         LDKClosingSignedFeeRange obj_conv;
36437         obj_conv.inner = untag_ptr(obj);
36438         obj_conv.is_owned = ptr_is_owned(obj);
36439         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36440         obj_conv.is_owned = false;
36441         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36442         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36443         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36444         CVec_u8Z_free(ret_var);
36445         return ret_arr;
36446 }
36447
36448 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
36449         LDKu8slice ser_ref;
36450         ser_ref.datalen = ser->arr_len;
36451         ser_ref.data = ser->elems;
36452         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36453         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36454         FREE(ser);
36455         return tag_ptr(ret_conv, true);
36456 }
36457
36458 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
36459         LDKCommitmentSigned obj_conv;
36460         obj_conv.inner = untag_ptr(obj);
36461         obj_conv.is_owned = ptr_is_owned(obj);
36462         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36463         obj_conv.is_owned = false;
36464         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36465         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36466         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36467         CVec_u8Z_free(ret_var);
36468         return ret_arr;
36469 }
36470
36471 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
36472         LDKu8slice ser_ref;
36473         ser_ref.datalen = ser->arr_len;
36474         ser_ref.data = ser->elems;
36475         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36476         *ret_conv = CommitmentSigned_read(ser_ref);
36477         FREE(ser);
36478         return tag_ptr(ret_conv, true);
36479 }
36480
36481 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
36482         LDKFundingCreated obj_conv;
36483         obj_conv.inner = untag_ptr(obj);
36484         obj_conv.is_owned = ptr_is_owned(obj);
36485         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36486         obj_conv.is_owned = false;
36487         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36488         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36489         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36490         CVec_u8Z_free(ret_var);
36491         return ret_arr;
36492 }
36493
36494 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
36495         LDKu8slice ser_ref;
36496         ser_ref.datalen = ser->arr_len;
36497         ser_ref.data = ser->elems;
36498         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36499         *ret_conv = FundingCreated_read(ser_ref);
36500         FREE(ser);
36501         return tag_ptr(ret_conv, true);
36502 }
36503
36504 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
36505         LDKFundingSigned obj_conv;
36506         obj_conv.inner = untag_ptr(obj);
36507         obj_conv.is_owned = ptr_is_owned(obj);
36508         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36509         obj_conv.is_owned = false;
36510         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36511         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36512         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36513         CVec_u8Z_free(ret_var);
36514         return ret_arr;
36515 }
36516
36517 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
36518         LDKu8slice ser_ref;
36519         ser_ref.datalen = ser->arr_len;
36520         ser_ref.data = ser->elems;
36521         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36522         *ret_conv = FundingSigned_read(ser_ref);
36523         FREE(ser);
36524         return tag_ptr(ret_conv, true);
36525 }
36526
36527 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
36528         LDKChannelReady obj_conv;
36529         obj_conv.inner = untag_ptr(obj);
36530         obj_conv.is_owned = ptr_is_owned(obj);
36531         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36532         obj_conv.is_owned = false;
36533         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36534         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36535         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36536         CVec_u8Z_free(ret_var);
36537         return ret_arr;
36538 }
36539
36540 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
36541         LDKu8slice ser_ref;
36542         ser_ref.datalen = ser->arr_len;
36543         ser_ref.data = ser->elems;
36544         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36545         *ret_conv = ChannelReady_read(ser_ref);
36546         FREE(ser);
36547         return tag_ptr(ret_conv, true);
36548 }
36549
36550 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
36551         LDKInit obj_conv;
36552         obj_conv.inner = untag_ptr(obj);
36553         obj_conv.is_owned = ptr_is_owned(obj);
36554         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36555         obj_conv.is_owned = false;
36556         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36557         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36558         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36559         CVec_u8Z_free(ret_var);
36560         return ret_arr;
36561 }
36562
36563 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
36564         LDKu8slice ser_ref;
36565         ser_ref.datalen = ser->arr_len;
36566         ser_ref.data = ser->elems;
36567         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36568         *ret_conv = Init_read(ser_ref);
36569         FREE(ser);
36570         return tag_ptr(ret_conv, true);
36571 }
36572
36573 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
36574         LDKOpenChannel obj_conv;
36575         obj_conv.inner = untag_ptr(obj);
36576         obj_conv.is_owned = ptr_is_owned(obj);
36577         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36578         obj_conv.is_owned = false;
36579         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36580         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36581         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36582         CVec_u8Z_free(ret_var);
36583         return ret_arr;
36584 }
36585
36586 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
36587         LDKu8slice ser_ref;
36588         ser_ref.datalen = ser->arr_len;
36589         ser_ref.data = ser->elems;
36590         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36591         *ret_conv = OpenChannel_read(ser_ref);
36592         FREE(ser);
36593         return tag_ptr(ret_conv, true);
36594 }
36595
36596 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
36597         LDKRevokeAndACK obj_conv;
36598         obj_conv.inner = untag_ptr(obj);
36599         obj_conv.is_owned = ptr_is_owned(obj);
36600         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36601         obj_conv.is_owned = false;
36602         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36603         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36604         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36605         CVec_u8Z_free(ret_var);
36606         return ret_arr;
36607 }
36608
36609 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
36610         LDKu8slice ser_ref;
36611         ser_ref.datalen = ser->arr_len;
36612         ser_ref.data = ser->elems;
36613         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36614         *ret_conv = RevokeAndACK_read(ser_ref);
36615         FREE(ser);
36616         return tag_ptr(ret_conv, true);
36617 }
36618
36619 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
36620         LDKShutdown obj_conv;
36621         obj_conv.inner = untag_ptr(obj);
36622         obj_conv.is_owned = ptr_is_owned(obj);
36623         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36624         obj_conv.is_owned = false;
36625         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36626         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36627         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36628         CVec_u8Z_free(ret_var);
36629         return ret_arr;
36630 }
36631
36632 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
36633         LDKu8slice ser_ref;
36634         ser_ref.datalen = ser->arr_len;
36635         ser_ref.data = ser->elems;
36636         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36637         *ret_conv = Shutdown_read(ser_ref);
36638         FREE(ser);
36639         return tag_ptr(ret_conv, true);
36640 }
36641
36642 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
36643         LDKUpdateFailHTLC obj_conv;
36644         obj_conv.inner = untag_ptr(obj);
36645         obj_conv.is_owned = ptr_is_owned(obj);
36646         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36647         obj_conv.is_owned = false;
36648         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36649         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36650         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36651         CVec_u8Z_free(ret_var);
36652         return ret_arr;
36653 }
36654
36655 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
36656         LDKu8slice ser_ref;
36657         ser_ref.datalen = ser->arr_len;
36658         ser_ref.data = ser->elems;
36659         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36660         *ret_conv = UpdateFailHTLC_read(ser_ref);
36661         FREE(ser);
36662         return tag_ptr(ret_conv, true);
36663 }
36664
36665 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
36666         LDKUpdateFailMalformedHTLC obj_conv;
36667         obj_conv.inner = untag_ptr(obj);
36668         obj_conv.is_owned = ptr_is_owned(obj);
36669         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36670         obj_conv.is_owned = false;
36671         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36672         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36673         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36674         CVec_u8Z_free(ret_var);
36675         return ret_arr;
36676 }
36677
36678 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
36679         LDKu8slice ser_ref;
36680         ser_ref.datalen = ser->arr_len;
36681         ser_ref.data = ser->elems;
36682         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36683         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36684         FREE(ser);
36685         return tag_ptr(ret_conv, true);
36686 }
36687
36688 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
36689         LDKUpdateFee obj_conv;
36690         obj_conv.inner = untag_ptr(obj);
36691         obj_conv.is_owned = ptr_is_owned(obj);
36692         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36693         obj_conv.is_owned = false;
36694         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36695         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36696         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36697         CVec_u8Z_free(ret_var);
36698         return ret_arr;
36699 }
36700
36701 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
36702         LDKu8slice ser_ref;
36703         ser_ref.datalen = ser->arr_len;
36704         ser_ref.data = ser->elems;
36705         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36706         *ret_conv = UpdateFee_read(ser_ref);
36707         FREE(ser);
36708         return tag_ptr(ret_conv, true);
36709 }
36710
36711 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
36712         LDKUpdateFulfillHTLC obj_conv;
36713         obj_conv.inner = untag_ptr(obj);
36714         obj_conv.is_owned = ptr_is_owned(obj);
36715         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36716         obj_conv.is_owned = false;
36717         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36718         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36719         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36720         CVec_u8Z_free(ret_var);
36721         return ret_arr;
36722 }
36723
36724 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
36725         LDKu8slice ser_ref;
36726         ser_ref.datalen = ser->arr_len;
36727         ser_ref.data = ser->elems;
36728         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36729         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36730         FREE(ser);
36731         return tag_ptr(ret_conv, true);
36732 }
36733
36734 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
36735         LDKUpdateAddHTLC obj_conv;
36736         obj_conv.inner = untag_ptr(obj);
36737         obj_conv.is_owned = ptr_is_owned(obj);
36738         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36739         obj_conv.is_owned = false;
36740         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36741         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36742         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36743         CVec_u8Z_free(ret_var);
36744         return ret_arr;
36745 }
36746
36747 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
36748         LDKu8slice ser_ref;
36749         ser_ref.datalen = ser->arr_len;
36750         ser_ref.data = ser->elems;
36751         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36752         *ret_conv = UpdateAddHTLC_read(ser_ref);
36753         FREE(ser);
36754         return tag_ptr(ret_conv, true);
36755 }
36756
36757 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
36758         LDKu8slice ser_ref;
36759         ser_ref.datalen = ser->arr_len;
36760         ser_ref.data = ser->elems;
36761         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
36762         *ret_conv = OnionMessage_read(ser_ref);
36763         FREE(ser);
36764         return tag_ptr(ret_conv, true);
36765 }
36766
36767 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
36768         LDKOnionMessage obj_conv;
36769         obj_conv.inner = untag_ptr(obj);
36770         obj_conv.is_owned = ptr_is_owned(obj);
36771         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36772         obj_conv.is_owned = false;
36773         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
36774         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36775         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36776         CVec_u8Z_free(ret_var);
36777         return ret_arr;
36778 }
36779
36780 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
36781         LDKPing obj_conv;
36782         obj_conv.inner = untag_ptr(obj);
36783         obj_conv.is_owned = ptr_is_owned(obj);
36784         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36785         obj_conv.is_owned = false;
36786         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36787         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36788         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36789         CVec_u8Z_free(ret_var);
36790         return ret_arr;
36791 }
36792
36793 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
36794         LDKu8slice ser_ref;
36795         ser_ref.datalen = ser->arr_len;
36796         ser_ref.data = ser->elems;
36797         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36798         *ret_conv = Ping_read(ser_ref);
36799         FREE(ser);
36800         return tag_ptr(ret_conv, true);
36801 }
36802
36803 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
36804         LDKPong obj_conv;
36805         obj_conv.inner = untag_ptr(obj);
36806         obj_conv.is_owned = ptr_is_owned(obj);
36807         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36808         obj_conv.is_owned = false;
36809         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36810         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36811         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36812         CVec_u8Z_free(ret_var);
36813         return ret_arr;
36814 }
36815
36816 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
36817         LDKu8slice ser_ref;
36818         ser_ref.datalen = ser->arr_len;
36819         ser_ref.data = ser->elems;
36820         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36821         *ret_conv = Pong_read(ser_ref);
36822         FREE(ser);
36823         return tag_ptr(ret_conv, true);
36824 }
36825
36826 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
36827         LDKUnsignedChannelAnnouncement obj_conv;
36828         obj_conv.inner = untag_ptr(obj);
36829         obj_conv.is_owned = ptr_is_owned(obj);
36830         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36831         obj_conv.is_owned = false;
36832         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36833         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36834         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36835         CVec_u8Z_free(ret_var);
36836         return ret_arr;
36837 }
36838
36839 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
36840         LDKu8slice ser_ref;
36841         ser_ref.datalen = ser->arr_len;
36842         ser_ref.data = ser->elems;
36843         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36844         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36845         FREE(ser);
36846         return tag_ptr(ret_conv, true);
36847 }
36848
36849 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
36850         LDKChannelAnnouncement obj_conv;
36851         obj_conv.inner = untag_ptr(obj);
36852         obj_conv.is_owned = ptr_is_owned(obj);
36853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36854         obj_conv.is_owned = false;
36855         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36856         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36857         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36858         CVec_u8Z_free(ret_var);
36859         return ret_arr;
36860 }
36861
36862 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
36863         LDKu8slice ser_ref;
36864         ser_ref.datalen = ser->arr_len;
36865         ser_ref.data = ser->elems;
36866         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36867         *ret_conv = ChannelAnnouncement_read(ser_ref);
36868         FREE(ser);
36869         return tag_ptr(ret_conv, true);
36870 }
36871
36872 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
36873         LDKUnsignedChannelUpdate obj_conv;
36874         obj_conv.inner = untag_ptr(obj);
36875         obj_conv.is_owned = ptr_is_owned(obj);
36876         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36877         obj_conv.is_owned = false;
36878         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36879         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36880         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36881         CVec_u8Z_free(ret_var);
36882         return ret_arr;
36883 }
36884
36885 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
36886         LDKu8slice ser_ref;
36887         ser_ref.datalen = ser->arr_len;
36888         ser_ref.data = ser->elems;
36889         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36890         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36891         FREE(ser);
36892         return tag_ptr(ret_conv, true);
36893 }
36894
36895 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
36896         LDKChannelUpdate obj_conv;
36897         obj_conv.inner = untag_ptr(obj);
36898         obj_conv.is_owned = ptr_is_owned(obj);
36899         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36900         obj_conv.is_owned = false;
36901         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36902         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36903         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36904         CVec_u8Z_free(ret_var);
36905         return ret_arr;
36906 }
36907
36908 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
36909         LDKu8slice ser_ref;
36910         ser_ref.datalen = ser->arr_len;
36911         ser_ref.data = ser->elems;
36912         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36913         *ret_conv = ChannelUpdate_read(ser_ref);
36914         FREE(ser);
36915         return tag_ptr(ret_conv, true);
36916 }
36917
36918 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
36919         LDKErrorMessage obj_conv;
36920         obj_conv.inner = untag_ptr(obj);
36921         obj_conv.is_owned = ptr_is_owned(obj);
36922         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36923         obj_conv.is_owned = false;
36924         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36925         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36926         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36927         CVec_u8Z_free(ret_var);
36928         return ret_arr;
36929 }
36930
36931 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
36932         LDKu8slice ser_ref;
36933         ser_ref.datalen = ser->arr_len;
36934         ser_ref.data = ser->elems;
36935         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36936         *ret_conv = ErrorMessage_read(ser_ref);
36937         FREE(ser);
36938         return tag_ptr(ret_conv, true);
36939 }
36940
36941 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
36942         LDKWarningMessage obj_conv;
36943         obj_conv.inner = untag_ptr(obj);
36944         obj_conv.is_owned = ptr_is_owned(obj);
36945         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36946         obj_conv.is_owned = false;
36947         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36948         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36949         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36950         CVec_u8Z_free(ret_var);
36951         return ret_arr;
36952 }
36953
36954 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
36955         LDKu8slice ser_ref;
36956         ser_ref.datalen = ser->arr_len;
36957         ser_ref.data = ser->elems;
36958         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36959         *ret_conv = WarningMessage_read(ser_ref);
36960         FREE(ser);
36961         return tag_ptr(ret_conv, true);
36962 }
36963
36964 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
36965         LDKUnsignedNodeAnnouncement obj_conv;
36966         obj_conv.inner = untag_ptr(obj);
36967         obj_conv.is_owned = ptr_is_owned(obj);
36968         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36969         obj_conv.is_owned = false;
36970         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36971         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36972         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36973         CVec_u8Z_free(ret_var);
36974         return ret_arr;
36975 }
36976
36977 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
36978         LDKu8slice ser_ref;
36979         ser_ref.datalen = ser->arr_len;
36980         ser_ref.data = ser->elems;
36981         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
36982         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
36983         FREE(ser);
36984         return tag_ptr(ret_conv, true);
36985 }
36986
36987 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
36988         LDKNodeAnnouncement obj_conv;
36989         obj_conv.inner = untag_ptr(obj);
36990         obj_conv.is_owned = ptr_is_owned(obj);
36991         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36992         obj_conv.is_owned = false;
36993         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
36994         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36995         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36996         CVec_u8Z_free(ret_var);
36997         return ret_arr;
36998 }
36999
37000 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
37001         LDKu8slice ser_ref;
37002         ser_ref.datalen = ser->arr_len;
37003         ser_ref.data = ser->elems;
37004         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
37005         *ret_conv = NodeAnnouncement_read(ser_ref);
37006         FREE(ser);
37007         return tag_ptr(ret_conv, true);
37008 }
37009
37010 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
37011         LDKu8slice ser_ref;
37012         ser_ref.datalen = ser->arr_len;
37013         ser_ref.data = ser->elems;
37014         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
37015         *ret_conv = QueryShortChannelIds_read(ser_ref);
37016         FREE(ser);
37017         return tag_ptr(ret_conv, true);
37018 }
37019
37020 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
37021         LDKQueryShortChannelIds obj_conv;
37022         obj_conv.inner = untag_ptr(obj);
37023         obj_conv.is_owned = ptr_is_owned(obj);
37024         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37025         obj_conv.is_owned = false;
37026         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
37027         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37028         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37029         CVec_u8Z_free(ret_var);
37030         return ret_arr;
37031 }
37032
37033 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
37034         LDKReplyShortChannelIdsEnd obj_conv;
37035         obj_conv.inner = untag_ptr(obj);
37036         obj_conv.is_owned = ptr_is_owned(obj);
37037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37038         obj_conv.is_owned = false;
37039         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
37040         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37041         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37042         CVec_u8Z_free(ret_var);
37043         return ret_arr;
37044 }
37045
37046 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
37047         LDKu8slice ser_ref;
37048         ser_ref.datalen = ser->arr_len;
37049         ser_ref.data = ser->elems;
37050         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
37051         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
37052         FREE(ser);
37053         return tag_ptr(ret_conv, true);
37054 }
37055
37056 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
37057         LDKQueryChannelRange this_arg_conv;
37058         this_arg_conv.inner = untag_ptr(this_arg);
37059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37061         this_arg_conv.is_owned = false;
37062         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
37063         return ret_conv;
37064 }
37065
37066 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
37067         LDKQueryChannelRange obj_conv;
37068         obj_conv.inner = untag_ptr(obj);
37069         obj_conv.is_owned = ptr_is_owned(obj);
37070         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37071         obj_conv.is_owned = false;
37072         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
37073         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37074         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37075         CVec_u8Z_free(ret_var);
37076         return ret_arr;
37077 }
37078
37079 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
37080         LDKu8slice ser_ref;
37081         ser_ref.datalen = ser->arr_len;
37082         ser_ref.data = ser->elems;
37083         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
37084         *ret_conv = QueryChannelRange_read(ser_ref);
37085         FREE(ser);
37086         return tag_ptr(ret_conv, true);
37087 }
37088
37089 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
37090         LDKu8slice ser_ref;
37091         ser_ref.datalen = ser->arr_len;
37092         ser_ref.data = ser->elems;
37093         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
37094         *ret_conv = ReplyChannelRange_read(ser_ref);
37095         FREE(ser);
37096         return tag_ptr(ret_conv, true);
37097 }
37098
37099 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
37100         LDKReplyChannelRange obj_conv;
37101         obj_conv.inner = untag_ptr(obj);
37102         obj_conv.is_owned = ptr_is_owned(obj);
37103         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37104         obj_conv.is_owned = false;
37105         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
37106         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37107         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37108         CVec_u8Z_free(ret_var);
37109         return ret_arr;
37110 }
37111
37112 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
37113         LDKGossipTimestampFilter obj_conv;
37114         obj_conv.inner = untag_ptr(obj);
37115         obj_conv.is_owned = ptr_is_owned(obj);
37116         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37117         obj_conv.is_owned = false;
37118         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
37119         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37120         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37121         CVec_u8Z_free(ret_var);
37122         return ret_arr;
37123 }
37124
37125 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
37126         LDKu8slice ser_ref;
37127         ser_ref.datalen = ser->arr_len;
37128         ser_ref.data = ser->elems;
37129         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
37130         *ret_conv = GossipTimestampFilter_read(ser_ref);
37131         FREE(ser);
37132         return tag_ptr(ret_conv, true);
37133 }
37134
37135 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
37136         if (!ptr_is_owned(this_ptr)) return;
37137         void* this_ptr_ptr = untag_ptr(this_ptr);
37138         CHECK_ACCESS(this_ptr_ptr);
37139         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
37140         FREE(untag_ptr(this_ptr));
37141         CustomMessageHandler_free(this_ptr_conv);
37142 }
37143
37144 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
37145         LDKIgnoringMessageHandler this_obj_conv;
37146         this_obj_conv.inner = untag_ptr(this_obj);
37147         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37149         IgnoringMessageHandler_free(this_obj_conv);
37150 }
37151
37152 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
37153         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
37154         uint64_t ret_ref = 0;
37155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37157         return ret_ref;
37158 }
37159
37160 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37161         LDKIgnoringMessageHandler this_arg_conv;
37162         this_arg_conv.inner = untag_ptr(this_arg);
37163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37165         this_arg_conv.is_owned = false;
37166         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37167         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37168         return tag_ptr(ret_ret, true);
37169 }
37170
37171 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
37172         LDKIgnoringMessageHandler this_arg_conv;
37173         this_arg_conv.inner = untag_ptr(this_arg);
37174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37176         this_arg_conv.is_owned = false;
37177         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37178         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
37179         return tag_ptr(ret_ret, true);
37180 }
37181
37182 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
37183         LDKIgnoringMessageHandler this_arg_conv;
37184         this_arg_conv.inner = untag_ptr(this_arg);
37185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37187         this_arg_conv.is_owned = false;
37188         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
37189         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
37190         return tag_ptr(ret_ret, true);
37191 }
37192
37193 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
37194         LDKIgnoringMessageHandler this_arg_conv;
37195         this_arg_conv.inner = untag_ptr(this_arg);
37196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37198         this_arg_conv.is_owned = false;
37199         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
37200         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
37201         return tag_ptr(ret_ret, true);
37202 }
37203
37204 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
37205         LDKIgnoringMessageHandler this_arg_conv;
37206         this_arg_conv.inner = untag_ptr(this_arg);
37207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37209         this_arg_conv.is_owned = false;
37210         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
37211         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
37212         return tag_ptr(ret_ret, true);
37213 }
37214
37215 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
37216         LDKIgnoringMessageHandler this_arg_conv;
37217         this_arg_conv.inner = untag_ptr(this_arg);
37218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37220         this_arg_conv.is_owned = false;
37221         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
37222         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
37223         return tag_ptr(ret_ret, true);
37224 }
37225
37226 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
37227         LDKIgnoringMessageHandler this_arg_conv;
37228         this_arg_conv.inner = untag_ptr(this_arg);
37229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37231         this_arg_conv.is_owned = false;
37232         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
37233         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
37234         return tag_ptr(ret_ret, true);
37235 }
37236
37237 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
37238         LDKErroringMessageHandler this_obj_conv;
37239         this_obj_conv.inner = untag_ptr(this_obj);
37240         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37242         ErroringMessageHandler_free(this_obj_conv);
37243 }
37244
37245 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
37246         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
37247         uint64_t ret_ref = 0;
37248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37250         return ret_ref;
37251 }
37252
37253 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37254         LDKErroringMessageHandler this_arg_conv;
37255         this_arg_conv.inner = untag_ptr(this_arg);
37256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37258         this_arg_conv.is_owned = false;
37259         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37260         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37261         return tag_ptr(ret_ret, true);
37262 }
37263
37264 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
37265         LDKErroringMessageHandler this_arg_conv;
37266         this_arg_conv.inner = untag_ptr(this_arg);
37267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37269         this_arg_conv.is_owned = false;
37270         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
37271         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
37272         return tag_ptr(ret_ret, true);
37273 }
37274
37275 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
37276         LDKMessageHandler this_obj_conv;
37277         this_obj_conv.inner = untag_ptr(this_obj);
37278         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37280         MessageHandler_free(this_obj_conv);
37281 }
37282
37283 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
37284         LDKMessageHandler this_ptr_conv;
37285         this_ptr_conv.inner = untag_ptr(this_ptr);
37286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37288         this_ptr_conv.is_owned = false;
37289         // WARNING: This object doesn't live past this scope, needs clone!
37290         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
37291         return ret_ret;
37292 }
37293
37294 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
37295         LDKMessageHandler this_ptr_conv;
37296         this_ptr_conv.inner = untag_ptr(this_ptr);
37297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37299         this_ptr_conv.is_owned = false;
37300         void* val_ptr = untag_ptr(val);
37301         CHECK_ACCESS(val_ptr);
37302         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
37303         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
37304                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37305                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
37306         }
37307         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
37308 }
37309
37310 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
37311         LDKMessageHandler this_ptr_conv;
37312         this_ptr_conv.inner = untag_ptr(this_ptr);
37313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37315         this_ptr_conv.is_owned = false;
37316         // WARNING: This object doesn't live past this scope, needs clone!
37317         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
37318         return ret_ret;
37319 }
37320
37321 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
37322         LDKMessageHandler this_ptr_conv;
37323         this_ptr_conv.inner = untag_ptr(this_ptr);
37324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37326         this_ptr_conv.is_owned = false;
37327         void* val_ptr = untag_ptr(val);
37328         CHECK_ACCESS(val_ptr);
37329         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
37330         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37331                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37332                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
37333         }
37334         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
37335 }
37336
37337 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
37338         LDKMessageHandler this_ptr_conv;
37339         this_ptr_conv.inner = untag_ptr(this_ptr);
37340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37342         this_ptr_conv.is_owned = false;
37343         // WARNING: This object doesn't live past this scope, needs clone!
37344         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
37345         return ret_ret;
37346 }
37347
37348 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
37349         LDKMessageHandler this_ptr_conv;
37350         this_ptr_conv.inner = untag_ptr(this_ptr);
37351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37353         this_ptr_conv.is_owned = false;
37354         void* val_ptr = untag_ptr(val);
37355         CHECK_ACCESS(val_ptr);
37356         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
37357         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
37358                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37359                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
37360         }
37361         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
37362 }
37363
37364 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) {
37365         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
37366         CHECK_ACCESS(chan_handler_arg_ptr);
37367         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
37368         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
37369                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37370                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
37371         }
37372         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
37373         CHECK_ACCESS(route_handler_arg_ptr);
37374         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
37375         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37376                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37377                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37378         }
37379         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
37380         CHECK_ACCESS(onion_message_handler_arg_ptr);
37381         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
37382         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
37383                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37384                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
37385         }
37386         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
37387         uint64_t ret_ref = 0;
37388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37390         return ret_ref;
37391 }
37392
37393 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37394         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37395         *ret_ret = SocketDescriptor_clone(arg);
37396         return tag_ptr(ret_ret, true);
37397 }
37398 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
37399         void* arg_ptr = untag_ptr(arg);
37400         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37401         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37402         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37403         return ret_conv;
37404 }
37405
37406 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
37407         void* orig_ptr = untag_ptr(orig);
37408         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37409         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37410         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37411         *ret_ret = SocketDescriptor_clone(orig_conv);
37412         return tag_ptr(ret_ret, true);
37413 }
37414
37415 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
37416         if (!ptr_is_owned(this_ptr)) return;
37417         void* this_ptr_ptr = untag_ptr(this_ptr);
37418         CHECK_ACCESS(this_ptr_ptr);
37419         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37420         FREE(untag_ptr(this_ptr));
37421         SocketDescriptor_free(this_ptr_conv);
37422 }
37423
37424 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
37425         LDKPeerHandleError this_obj_conv;
37426         this_obj_conv.inner = untag_ptr(this_obj);
37427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37429         PeerHandleError_free(this_obj_conv);
37430 }
37431
37432 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
37433         LDKPeerHandleError ret_var = PeerHandleError_new();
37434         uint64_t ret_ref = 0;
37435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37437         return ret_ref;
37438 }
37439
37440 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37441         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37442         uint64_t ret_ref = 0;
37443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37445         return ret_ref;
37446 }
37447 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
37448         LDKPeerHandleError arg_conv;
37449         arg_conv.inner = untag_ptr(arg);
37450         arg_conv.is_owned = ptr_is_owned(arg);
37451         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37452         arg_conv.is_owned = false;
37453         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37454         return ret_conv;
37455 }
37456
37457 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
37458         LDKPeerHandleError orig_conv;
37459         orig_conv.inner = untag_ptr(orig);
37460         orig_conv.is_owned = ptr_is_owned(orig);
37461         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37462         orig_conv.is_owned = false;
37463         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37464         uint64_t ret_ref = 0;
37465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37467         return ret_ref;
37468 }
37469
37470 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
37471         LDKPeerManager this_obj_conv;
37472         this_obj_conv.inner = untag_ptr(this_obj);
37473         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37475         PeerManager_free(this_obj_conv);
37476 }
37477
37478 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) {
37479         LDKMessageHandler message_handler_conv;
37480         message_handler_conv.inner = untag_ptr(message_handler);
37481         message_handler_conv.is_owned = ptr_is_owned(message_handler);
37482         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37483         // WARNING: we need a move here but no clone is available for LDKMessageHandler
37484         
37485         uint8_t ephemeral_random_data_arr[32];
37486         CHECK(ephemeral_random_data->arr_len == 32);
37487         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
37488         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37489         void* logger_ptr = untag_ptr(logger);
37490         CHECK_ACCESS(logger_ptr);
37491         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37492         if (logger_conv.free == LDKLogger_JCalls_free) {
37493                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37494                 LDKLogger_JCalls_cloned(&logger_conv);
37495         }
37496         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
37497         CHECK_ACCESS(custom_message_handler_ptr);
37498         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37499         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37500                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37501                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37502         }
37503         void* node_signer_ptr = untag_ptr(node_signer);
37504         CHECK_ACCESS(node_signer_ptr);
37505         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
37506         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
37507                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37508                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
37509         }
37510         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_conv);
37511         uint64_t ret_ref = 0;
37512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37514         return ret_ref;
37515 }
37516
37517 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
37518         LDKPeerManager this_arg_conv;
37519         this_arg_conv.inner = untag_ptr(this_arg);
37520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37522         this_arg_conv.is_owned = false;
37523         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37524         uint64_tArray ret_arr = NULL;
37525         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
37526         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
37527         for (size_t o = 0; o < ret_var.datalen; o++) {
37528                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
37529                 *ret_conv_40_conv = ret_var.data[o];
37530                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
37531         }
37532         
37533         FREE(ret_var.data);
37534         return ret_arr;
37535 }
37536
37537 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) {
37538         LDKPeerManager this_arg_conv;
37539         this_arg_conv.inner = untag_ptr(this_arg);
37540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37542         this_arg_conv.is_owned = false;
37543         LDKPublicKey their_node_id_ref;
37544         CHECK(their_node_id->arr_len == 33);
37545         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
37546         void* descriptor_ptr = untag_ptr(descriptor);
37547         CHECK_ACCESS(descriptor_ptr);
37548         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37549         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37550                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37551                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37552         }
37553         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37554         CHECK_ACCESS(remote_network_address_ptr);
37555         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37556         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37557         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37558         return tag_ptr(ret_conv, true);
37559 }
37560
37561 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) {
37562         LDKPeerManager this_arg_conv;
37563         this_arg_conv.inner = untag_ptr(this_arg);
37564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37566         this_arg_conv.is_owned = false;
37567         void* descriptor_ptr = untag_ptr(descriptor);
37568         CHECK_ACCESS(descriptor_ptr);
37569         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37570         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37571                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37572                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37573         }
37574         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37575         CHECK_ACCESS(remote_network_address_ptr);
37576         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37577         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37578         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37579         return tag_ptr(ret_conv, true);
37580 }
37581
37582 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
37583         LDKPeerManager this_arg_conv;
37584         this_arg_conv.inner = untag_ptr(this_arg);
37585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37587         this_arg_conv.is_owned = false;
37588         void* descriptor_ptr = untag_ptr(descriptor);
37589         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37590         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37591         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37592         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37593         return tag_ptr(ret_conv, true);
37594 }
37595
37596 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
37597         LDKPeerManager this_arg_conv;
37598         this_arg_conv.inner = untag_ptr(this_arg);
37599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37601         this_arg_conv.is_owned = false;
37602         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
37603         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
37604         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37605         LDKu8slice data_ref;
37606         data_ref.datalen = data->arr_len;
37607         data_ref.data = data->elems;
37608         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37609         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37610         FREE(data);
37611         return tag_ptr(ret_conv, true);
37612 }
37613
37614 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
37615         LDKPeerManager this_arg_conv;
37616         this_arg_conv.inner = untag_ptr(this_arg);
37617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37619         this_arg_conv.is_owned = false;
37620         PeerManager_process_events(&this_arg_conv);
37621 }
37622
37623 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
37624         LDKPeerManager this_arg_conv;
37625         this_arg_conv.inner = untag_ptr(this_arg);
37626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37628         this_arg_conv.is_owned = false;
37629         void* descriptor_ptr = untag_ptr(descriptor);
37630         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37631         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37632         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37633 }
37634
37635 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
37636         LDKPeerManager this_arg_conv;
37637         this_arg_conv.inner = untag_ptr(this_arg);
37638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37640         this_arg_conv.is_owned = false;
37641         LDKPublicKey node_id_ref;
37642         CHECK(node_id->arr_len == 33);
37643         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
37644         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
37645 }
37646
37647 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
37648         LDKPeerManager this_arg_conv;
37649         this_arg_conv.inner = untag_ptr(this_arg);
37650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37652         this_arg_conv.is_owned = false;
37653         PeerManager_disconnect_all_peers(&this_arg_conv);
37654 }
37655
37656 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
37657         LDKPeerManager this_arg_conv;
37658         this_arg_conv.inner = untag_ptr(this_arg);
37659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37661         this_arg_conv.is_owned = false;
37662         PeerManager_timer_tick_occurred(&this_arg_conv);
37663 }
37664
37665 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) {
37666         LDKPeerManager this_arg_conv;
37667         this_arg_conv.inner = untag_ptr(this_arg);
37668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37670         this_arg_conv.is_owned = false;
37671         LDKThreeBytes rgb_ref;
37672         CHECK(rgb->arr_len == 3);
37673         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
37674         LDKThirtyTwoBytes alias_ref;
37675         CHECK(alias->arr_len == 32);
37676         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
37677         LDKCVec_NetAddressZ addresses_constr;
37678         addresses_constr.datalen = addresses->arr_len;
37679         if (addresses_constr.datalen > 0)
37680                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
37681         else
37682                 addresses_constr.data = NULL;
37683         uint64_t* addresses_vals = addresses->elems;
37684         for (size_t m = 0; m < addresses_constr.datalen; m++) {
37685                 uint64_t addresses_conv_12 = addresses_vals[m];
37686                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
37687                 CHECK_ACCESS(addresses_conv_12_ptr);
37688                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
37689                 addresses_constr.data[m] = addresses_conv_12_conv;
37690         }
37691         FREE(addresses);
37692         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
37693 }
37694
37695 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
37696         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37697         return ret_conv;
37698 }
37699
37700 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
37701         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37702         return ret_conv;
37703 }
37704
37705 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
37706         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
37707         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
37708         return ret_conv;
37709 }
37710
37711 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
37712         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
37713         return ret_conv;
37714 }
37715
37716 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
37717         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
37718         return ret_conv;
37719 }
37720
37721 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
37722         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
37723         return ret_conv;
37724 }
37725
37726 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
37727         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
37728         return ret_conv;
37729 }
37730
37731 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
37732         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
37733         return ret_conv;
37734 }
37735
37736 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
37737         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
37738         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
37739         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
37740         return ret_conv;
37741 }
37742
37743 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
37744         LDKWitness witness_ref;
37745         witness_ref.datalen = witness->arr_len;
37746         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
37747         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
37748         witness_ref.data_is_owned = true;
37749         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37750         *ret_copy = HTLCClaim_from_witness(witness_ref);
37751         uint64_t ret_ref = tag_ptr(ret_copy, true);
37752         return ret_ref;
37753 }
37754
37755 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
37756         uint8_t commitment_seed_arr[32];
37757         CHECK(commitment_seed->arr_len == 32);
37758         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
37759         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
37760         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37761         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
37762         return ret_arr;
37763 }
37764
37765 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) {
37766         LDKCVec_u8Z to_holder_script_ref;
37767         to_holder_script_ref.datalen = to_holder_script->arr_len;
37768         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37769         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37770         LDKCVec_u8Z to_counterparty_script_ref;
37771         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37772         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37773         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37774         LDKOutPoint funding_outpoint_conv;
37775         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37776         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37777         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37778         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37779         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);
37780         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37781         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37782         Transaction_free(ret_var);
37783         return ret_arr;
37784 }
37785
37786 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
37787         LDKCounterpartyCommitmentSecrets this_obj_conv;
37788         this_obj_conv.inner = untag_ptr(this_obj);
37789         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37791         CounterpartyCommitmentSecrets_free(this_obj_conv);
37792 }
37793
37794 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37795         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37796         uint64_t ret_ref = 0;
37797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37799         return ret_ref;
37800 }
37801 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
37802         LDKCounterpartyCommitmentSecrets arg_conv;
37803         arg_conv.inner = untag_ptr(arg);
37804         arg_conv.is_owned = ptr_is_owned(arg);
37805         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37806         arg_conv.is_owned = false;
37807         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37808         return ret_conv;
37809 }
37810
37811 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
37812         LDKCounterpartyCommitmentSecrets orig_conv;
37813         orig_conv.inner = untag_ptr(orig);
37814         orig_conv.is_owned = ptr_is_owned(orig);
37815         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37816         orig_conv.is_owned = false;
37817         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37818         uint64_t ret_ref = 0;
37819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37821         return ret_ref;
37822 }
37823
37824 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
37825         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37826         uint64_t ret_ref = 0;
37827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37829         return ret_ref;
37830 }
37831
37832 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
37833         LDKCounterpartyCommitmentSecrets this_arg_conv;
37834         this_arg_conv.inner = untag_ptr(this_arg);
37835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37837         this_arg_conv.is_owned = false;
37838         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37839         return ret_conv;
37840 }
37841
37842 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
37843         LDKCounterpartyCommitmentSecrets this_arg_conv;
37844         this_arg_conv.inner = untag_ptr(this_arg);
37845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37847         this_arg_conv.is_owned = false;
37848         LDKThirtyTwoBytes secret_ref;
37849         CHECK(secret->arr_len == 32);
37850         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
37851         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37852         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37853         return tag_ptr(ret_conv, true);
37854 }
37855
37856 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
37857         LDKCounterpartyCommitmentSecrets this_arg_conv;
37858         this_arg_conv.inner = untag_ptr(this_arg);
37859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37861         this_arg_conv.is_owned = false;
37862         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37863         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
37864         return ret_arr;
37865 }
37866
37867 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
37868         LDKCounterpartyCommitmentSecrets obj_conv;
37869         obj_conv.inner = untag_ptr(obj);
37870         obj_conv.is_owned = ptr_is_owned(obj);
37871         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37872         obj_conv.is_owned = false;
37873         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37874         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37875         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37876         CVec_u8Z_free(ret_var);
37877         return ret_arr;
37878 }
37879
37880 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
37881         LDKu8slice ser_ref;
37882         ser_ref.datalen = ser->arr_len;
37883         ser_ref.data = ser->elems;
37884         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37885         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37886         FREE(ser);
37887         return tag_ptr(ret_conv, true);
37888 }
37889
37890 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
37891         LDKPublicKey per_commitment_point_ref;
37892         CHECK(per_commitment_point->arr_len == 33);
37893         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37894         uint8_t base_secret_arr[32];
37895         CHECK(base_secret->arr_len == 32);
37896         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
37897         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
37898         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37899         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
37900         return ret_arr;
37901 }
37902
37903 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
37904         LDKPublicKey per_commitment_point_ref;
37905         CHECK(per_commitment_point->arr_len == 33);
37906         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37907         LDKPublicKey base_point_ref;
37908         CHECK(base_point->arr_len == 33);
37909         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
37910         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37911         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
37912         return ret_arr;
37913 }
37914
37915 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) {
37916         uint8_t per_commitment_secret_arr[32];
37917         CHECK(per_commitment_secret->arr_len == 32);
37918         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
37919         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37920         uint8_t countersignatory_revocation_base_secret_arr[32];
37921         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
37922         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
37923         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37924         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37925         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
37926         return ret_arr;
37927 }
37928
37929 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) {
37930         LDKPublicKey per_commitment_point_ref;
37931         CHECK(per_commitment_point->arr_len == 33);
37932         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37933         LDKPublicKey countersignatory_revocation_base_point_ref;
37934         CHECK(countersignatory_revocation_base_point->arr_len == 33);
37935         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
37936         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37937         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
37938         return ret_arr;
37939 }
37940
37941 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
37942         LDKTxCreationKeys this_obj_conv;
37943         this_obj_conv.inner = untag_ptr(this_obj);
37944         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37946         TxCreationKeys_free(this_obj_conv);
37947 }
37948
37949 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
37950         LDKTxCreationKeys this_ptr_conv;
37951         this_ptr_conv.inner = untag_ptr(this_ptr);
37952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37954         this_ptr_conv.is_owned = false;
37955         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37956         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37957         return ret_arr;
37958 }
37959
37960 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
37961         LDKTxCreationKeys this_ptr_conv;
37962         this_ptr_conv.inner = untag_ptr(this_ptr);
37963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37965         this_ptr_conv.is_owned = false;
37966         LDKPublicKey val_ref;
37967         CHECK(val->arr_len == 33);
37968         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37969         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37970 }
37971
37972 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
37973         LDKTxCreationKeys this_ptr_conv;
37974         this_ptr_conv.inner = untag_ptr(this_ptr);
37975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37977         this_ptr_conv.is_owned = false;
37978         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37979         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
37980         return ret_arr;
37981 }
37982
37983 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
37984         LDKTxCreationKeys this_ptr_conv;
37985         this_ptr_conv.inner = untag_ptr(this_ptr);
37986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37988         this_ptr_conv.is_owned = false;
37989         LDKPublicKey val_ref;
37990         CHECK(val->arr_len == 33);
37991         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37992         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
37993 }
37994
37995 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
37996         LDKTxCreationKeys this_ptr_conv;
37997         this_ptr_conv.inner = untag_ptr(this_ptr);
37998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38000         this_ptr_conv.is_owned = false;
38001         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38002         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
38003         return ret_arr;
38004 }
38005
38006 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
38007         LDKTxCreationKeys this_ptr_conv;
38008         this_ptr_conv.inner = untag_ptr(this_ptr);
38009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38011         this_ptr_conv.is_owned = false;
38012         LDKPublicKey val_ref;
38013         CHECK(val->arr_len == 33);
38014         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38015         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
38016 }
38017
38018 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
38019         LDKTxCreationKeys this_ptr_conv;
38020         this_ptr_conv.inner = untag_ptr(this_ptr);
38021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38023         this_ptr_conv.is_owned = false;
38024         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38025         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
38026         return ret_arr;
38027 }
38028
38029 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
38030         LDKTxCreationKeys this_ptr_conv;
38031         this_ptr_conv.inner = untag_ptr(this_ptr);
38032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38034         this_ptr_conv.is_owned = false;
38035         LDKPublicKey val_ref;
38036         CHECK(val->arr_len == 33);
38037         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38038         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
38039 }
38040
38041 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
38042         LDKTxCreationKeys this_ptr_conv;
38043         this_ptr_conv.inner = untag_ptr(this_ptr);
38044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38046         this_ptr_conv.is_owned = false;
38047         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38048         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
38049         return ret_arr;
38050 }
38051
38052 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) {
38053         LDKTxCreationKeys this_ptr_conv;
38054         this_ptr_conv.inner = untag_ptr(this_ptr);
38055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38057         this_ptr_conv.is_owned = false;
38058         LDKPublicKey val_ref;
38059         CHECK(val->arr_len == 33);
38060         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38061         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
38062 }
38063
38064 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) {
38065         LDKPublicKey per_commitment_point_arg_ref;
38066         CHECK(per_commitment_point_arg->arr_len == 33);
38067         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
38068         LDKPublicKey revocation_key_arg_ref;
38069         CHECK(revocation_key_arg->arr_len == 33);
38070         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
38071         LDKPublicKey broadcaster_htlc_key_arg_ref;
38072         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
38073         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
38074         LDKPublicKey countersignatory_htlc_key_arg_ref;
38075         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
38076         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
38077         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
38078         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
38079         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
38080         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);
38081         uint64_t ret_ref = 0;
38082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38084         return ret_ref;
38085 }
38086
38087 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
38088         LDKTxCreationKeys a_conv;
38089         a_conv.inner = untag_ptr(a);
38090         a_conv.is_owned = ptr_is_owned(a);
38091         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38092         a_conv.is_owned = false;
38093         LDKTxCreationKeys b_conv;
38094         b_conv.inner = untag_ptr(b);
38095         b_conv.is_owned = ptr_is_owned(b);
38096         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38097         b_conv.is_owned = false;
38098         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
38099         return ret_conv;
38100 }
38101
38102 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
38103         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
38104         uint64_t ret_ref = 0;
38105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38107         return ret_ref;
38108 }
38109 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
38110         LDKTxCreationKeys arg_conv;
38111         arg_conv.inner = untag_ptr(arg);
38112         arg_conv.is_owned = ptr_is_owned(arg);
38113         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38114         arg_conv.is_owned = false;
38115         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
38116         return ret_conv;
38117 }
38118
38119 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
38120         LDKTxCreationKeys orig_conv;
38121         orig_conv.inner = untag_ptr(orig);
38122         orig_conv.is_owned = ptr_is_owned(orig);
38123         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38124         orig_conv.is_owned = false;
38125         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
38126         uint64_t ret_ref = 0;
38127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38129         return ret_ref;
38130 }
38131
38132 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
38133         LDKTxCreationKeys obj_conv;
38134         obj_conv.inner = untag_ptr(obj);
38135         obj_conv.is_owned = ptr_is_owned(obj);
38136         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38137         obj_conv.is_owned = false;
38138         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
38139         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38140         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38141         CVec_u8Z_free(ret_var);
38142         return ret_arr;
38143 }
38144
38145 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
38146         LDKu8slice ser_ref;
38147         ser_ref.datalen = ser->arr_len;
38148         ser_ref.data = ser->elems;
38149         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
38150         *ret_conv = TxCreationKeys_read(ser_ref);
38151         FREE(ser);
38152         return tag_ptr(ret_conv, true);
38153 }
38154
38155 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
38156         LDKChannelPublicKeys this_obj_conv;
38157         this_obj_conv.inner = untag_ptr(this_obj);
38158         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38160         ChannelPublicKeys_free(this_obj_conv);
38161 }
38162
38163 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
38164         LDKChannelPublicKeys this_ptr_conv;
38165         this_ptr_conv.inner = untag_ptr(this_ptr);
38166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38168         this_ptr_conv.is_owned = false;
38169         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38170         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38171         return ret_arr;
38172 }
38173
38174 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38175         LDKChannelPublicKeys this_ptr_conv;
38176         this_ptr_conv.inner = untag_ptr(this_ptr);
38177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38179         this_ptr_conv.is_owned = false;
38180         LDKPublicKey val_ref;
38181         CHECK(val->arr_len == 33);
38182         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38183         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
38184 }
38185
38186 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
38187         LDKChannelPublicKeys this_ptr_conv;
38188         this_ptr_conv.inner = untag_ptr(this_ptr);
38189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38191         this_ptr_conv.is_owned = false;
38192         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38193         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38194         return ret_arr;
38195 }
38196
38197 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38198         LDKChannelPublicKeys this_ptr_conv;
38199         this_ptr_conv.inner = untag_ptr(this_ptr);
38200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38202         this_ptr_conv.is_owned = false;
38203         LDKPublicKey val_ref;
38204         CHECK(val->arr_len == 33);
38205         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38206         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
38207 }
38208
38209 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
38210         LDKChannelPublicKeys this_ptr_conv;
38211         this_ptr_conv.inner = untag_ptr(this_ptr);
38212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38214         this_ptr_conv.is_owned = false;
38215         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38216         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
38217         return ret_arr;
38218 }
38219
38220 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38221         LDKChannelPublicKeys this_ptr_conv;
38222         this_ptr_conv.inner = untag_ptr(this_ptr);
38223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38225         this_ptr_conv.is_owned = false;
38226         LDKPublicKey val_ref;
38227         CHECK(val->arr_len == 33);
38228         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38229         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
38230 }
38231
38232 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
38233         LDKChannelPublicKeys this_ptr_conv;
38234         this_ptr_conv.inner = untag_ptr(this_ptr);
38235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38237         this_ptr_conv.is_owned = false;
38238         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38239         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38240         return ret_arr;
38241 }
38242
38243 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38244         LDKChannelPublicKeys this_ptr_conv;
38245         this_ptr_conv.inner = untag_ptr(this_ptr);
38246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38248         this_ptr_conv.is_owned = false;
38249         LDKPublicKey val_ref;
38250         CHECK(val->arr_len == 33);
38251         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38252         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38253 }
38254
38255 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
38256         LDKChannelPublicKeys this_ptr_conv;
38257         this_ptr_conv.inner = untag_ptr(this_ptr);
38258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38260         this_ptr_conv.is_owned = false;
38261         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38262         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38263         return ret_arr;
38264 }
38265
38266 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38267         LDKChannelPublicKeys this_ptr_conv;
38268         this_ptr_conv.inner = untag_ptr(this_ptr);
38269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38271         this_ptr_conv.is_owned = false;
38272         LDKPublicKey val_ref;
38273         CHECK(val->arr_len == 33);
38274         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38275         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
38276 }
38277
38278 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) {
38279         LDKPublicKey funding_pubkey_arg_ref;
38280         CHECK(funding_pubkey_arg->arr_len == 33);
38281         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38282         LDKPublicKey revocation_basepoint_arg_ref;
38283         CHECK(revocation_basepoint_arg->arr_len == 33);
38284         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38285         LDKPublicKey payment_point_arg_ref;
38286         CHECK(payment_point_arg->arr_len == 33);
38287         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38288         LDKPublicKey delayed_payment_basepoint_arg_ref;
38289         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38290         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38291         LDKPublicKey htlc_basepoint_arg_ref;
38292         CHECK(htlc_basepoint_arg->arr_len == 33);
38293         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38294         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);
38295         uint64_t ret_ref = 0;
38296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38298         return ret_ref;
38299 }
38300
38301 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
38302         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
38303         uint64_t ret_ref = 0;
38304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38306         return ret_ref;
38307 }
38308 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
38309         LDKChannelPublicKeys arg_conv;
38310         arg_conv.inner = untag_ptr(arg);
38311         arg_conv.is_owned = ptr_is_owned(arg);
38312         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38313         arg_conv.is_owned = false;
38314         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
38315         return ret_conv;
38316 }
38317
38318 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
38319         LDKChannelPublicKeys orig_conv;
38320         orig_conv.inner = untag_ptr(orig);
38321         orig_conv.is_owned = ptr_is_owned(orig);
38322         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38323         orig_conv.is_owned = false;
38324         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
38325         uint64_t ret_ref = 0;
38326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38328         return ret_ref;
38329 }
38330
38331 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
38332         LDKChannelPublicKeys a_conv;
38333         a_conv.inner = untag_ptr(a);
38334         a_conv.is_owned = ptr_is_owned(a);
38335         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38336         a_conv.is_owned = false;
38337         LDKChannelPublicKeys b_conv;
38338         b_conv.inner = untag_ptr(b);
38339         b_conv.is_owned = ptr_is_owned(b);
38340         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38341         b_conv.is_owned = false;
38342         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
38343         return ret_conv;
38344 }
38345
38346 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
38347         LDKChannelPublicKeys obj_conv;
38348         obj_conv.inner = untag_ptr(obj);
38349         obj_conv.is_owned = ptr_is_owned(obj);
38350         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38351         obj_conv.is_owned = false;
38352         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
38353         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38354         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38355         CVec_u8Z_free(ret_var);
38356         return ret_arr;
38357 }
38358
38359 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
38360         LDKu8slice ser_ref;
38361         ser_ref.datalen = ser->arr_len;
38362         ser_ref.data = ser->elems;
38363         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
38364         *ret_conv = ChannelPublicKeys_read(ser_ref);
38365         FREE(ser);
38366         return tag_ptr(ret_conv, true);
38367 }
38368
38369 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) {
38370         LDKPublicKey per_commitment_point_ref;
38371         CHECK(per_commitment_point->arr_len == 33);
38372         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38373         LDKPublicKey broadcaster_delayed_payment_base_ref;
38374         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
38375         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
38376         LDKPublicKey broadcaster_htlc_base_ref;
38377         CHECK(broadcaster_htlc_base->arr_len == 33);
38378         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
38379         LDKPublicKey countersignatory_revocation_base_ref;
38380         CHECK(countersignatory_revocation_base->arr_len == 33);
38381         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
38382         LDKPublicKey countersignatory_htlc_base_ref;
38383         CHECK(countersignatory_htlc_base->arr_len == 33);
38384         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
38385         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);
38386         uint64_t ret_ref = 0;
38387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38389         return ret_ref;
38390 }
38391
38392 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) {
38393         LDKPublicKey per_commitment_point_ref;
38394         CHECK(per_commitment_point->arr_len == 33);
38395         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38396         LDKChannelPublicKeys broadcaster_keys_conv;
38397         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
38398         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
38399         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38400         broadcaster_keys_conv.is_owned = false;
38401         LDKChannelPublicKeys countersignatory_keys_conv;
38402         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
38403         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
38404         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38405         countersignatory_keys_conv.is_owned = false;
38406         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
38407         uint64_t ret_ref = 0;
38408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38410         return ret_ref;
38411 }
38412
38413 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) {
38414         LDKPublicKey revocation_key_ref;
38415         CHECK(revocation_key->arr_len == 33);
38416         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38417         LDKPublicKey broadcaster_delayed_payment_key_ref;
38418         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38419         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38420         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
38421         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38422         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38423         CVec_u8Z_free(ret_var);
38424         return ret_arr;
38425 }
38426
38427 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
38428         LDKHTLCOutputInCommitment this_obj_conv;
38429         this_obj_conv.inner = untag_ptr(this_obj);
38430         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38432         HTLCOutputInCommitment_free(this_obj_conv);
38433 }
38434
38435 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
38436         LDKHTLCOutputInCommitment this_ptr_conv;
38437         this_ptr_conv.inner = untag_ptr(this_ptr);
38438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38440         this_ptr_conv.is_owned = false;
38441         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
38442         return ret_conv;
38443 }
38444
38445 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
38446         LDKHTLCOutputInCommitment this_ptr_conv;
38447         this_ptr_conv.inner = untag_ptr(this_ptr);
38448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38450         this_ptr_conv.is_owned = false;
38451         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
38452 }
38453
38454 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
38455         LDKHTLCOutputInCommitment this_ptr_conv;
38456         this_ptr_conv.inner = untag_ptr(this_ptr);
38457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38459         this_ptr_conv.is_owned = false;
38460         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
38461         return ret_conv;
38462 }
38463
38464 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
38465         LDKHTLCOutputInCommitment this_ptr_conv;
38466         this_ptr_conv.inner = untag_ptr(this_ptr);
38467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38469         this_ptr_conv.is_owned = false;
38470         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
38471 }
38472
38473 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
38474         LDKHTLCOutputInCommitment this_ptr_conv;
38475         this_ptr_conv.inner = untag_ptr(this_ptr);
38476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38478         this_ptr_conv.is_owned = false;
38479         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
38480         return ret_conv;
38481 }
38482
38483 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
38484         LDKHTLCOutputInCommitment this_ptr_conv;
38485         this_ptr_conv.inner = untag_ptr(this_ptr);
38486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38488         this_ptr_conv.is_owned = false;
38489         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38490 }
38491
38492 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
38493         LDKHTLCOutputInCommitment this_ptr_conv;
38494         this_ptr_conv.inner = untag_ptr(this_ptr);
38495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38497         this_ptr_conv.is_owned = false;
38498         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38499         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
38500         return ret_arr;
38501 }
38502
38503 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
38504         LDKHTLCOutputInCommitment this_ptr_conv;
38505         this_ptr_conv.inner = untag_ptr(this_ptr);
38506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38508         this_ptr_conv.is_owned = false;
38509         LDKThirtyTwoBytes val_ref;
38510         CHECK(val->arr_len == 32);
38511         memcpy(val_ref.data, val->elems, 32); FREE(val);
38512         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38513 }
38514
38515 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
38516         LDKHTLCOutputInCommitment this_ptr_conv;
38517         this_ptr_conv.inner = untag_ptr(this_ptr);
38518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38520         this_ptr_conv.is_owned = false;
38521         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38522         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38523         uint64_t ret_ref = tag_ptr(ret_copy, true);
38524         return ret_ref;
38525 }
38526
38527 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
38528         LDKHTLCOutputInCommitment this_ptr_conv;
38529         this_ptr_conv.inner = untag_ptr(this_ptr);
38530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38532         this_ptr_conv.is_owned = false;
38533         void* val_ptr = untag_ptr(val);
38534         CHECK_ACCESS(val_ptr);
38535         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38536         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38537         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38538 }
38539
38540 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) {
38541         LDKThirtyTwoBytes payment_hash_arg_ref;
38542         CHECK(payment_hash_arg->arr_len == 32);
38543         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
38544         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
38545         CHECK_ACCESS(transaction_output_index_arg_ptr);
38546         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38547         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
38548         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38549         uint64_t ret_ref = 0;
38550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38552         return ret_ref;
38553 }
38554
38555 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38556         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38557         uint64_t ret_ref = 0;
38558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38560         return ret_ref;
38561 }
38562 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
38563         LDKHTLCOutputInCommitment arg_conv;
38564         arg_conv.inner = untag_ptr(arg);
38565         arg_conv.is_owned = ptr_is_owned(arg);
38566         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38567         arg_conv.is_owned = false;
38568         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38569         return ret_conv;
38570 }
38571
38572 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
38573         LDKHTLCOutputInCommitment orig_conv;
38574         orig_conv.inner = untag_ptr(orig);
38575         orig_conv.is_owned = ptr_is_owned(orig);
38576         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38577         orig_conv.is_owned = false;
38578         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38579         uint64_t ret_ref = 0;
38580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38582         return ret_ref;
38583 }
38584
38585 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
38586         LDKHTLCOutputInCommitment a_conv;
38587         a_conv.inner = untag_ptr(a);
38588         a_conv.is_owned = ptr_is_owned(a);
38589         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38590         a_conv.is_owned = false;
38591         LDKHTLCOutputInCommitment b_conv;
38592         b_conv.inner = untag_ptr(b);
38593         b_conv.is_owned = ptr_is_owned(b);
38594         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38595         b_conv.is_owned = false;
38596         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
38597         return ret_conv;
38598 }
38599
38600 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
38601         LDKHTLCOutputInCommitment obj_conv;
38602         obj_conv.inner = untag_ptr(obj);
38603         obj_conv.is_owned = ptr_is_owned(obj);
38604         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38605         obj_conv.is_owned = false;
38606         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38607         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38608         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38609         CVec_u8Z_free(ret_var);
38610         return ret_arr;
38611 }
38612
38613 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
38614         LDKu8slice ser_ref;
38615         ser_ref.datalen = ser->arr_len;
38616         ser_ref.data = ser->elems;
38617         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38618         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38619         FREE(ser);
38620         return tag_ptr(ret_conv, true);
38621 }
38622
38623 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
38624         LDKHTLCOutputInCommitment htlc_conv;
38625         htlc_conv.inner = untag_ptr(htlc);
38626         htlc_conv.is_owned = ptr_is_owned(htlc);
38627         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38628         htlc_conv.is_owned = false;
38629         LDKTxCreationKeys keys_conv;
38630         keys_conv.inner = untag_ptr(keys);
38631         keys_conv.is_owned = ptr_is_owned(keys);
38632         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38633         keys_conv.is_owned = false;
38634         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38635         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38636         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38637         CVec_u8Z_free(ret_var);
38638         return ret_arr;
38639 }
38640
38641 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
38642         LDKPublicKey broadcaster_ref;
38643         CHECK(broadcaster->arr_len == 33);
38644         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
38645         LDKPublicKey countersignatory_ref;
38646         CHECK(countersignatory->arr_len == 33);
38647         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
38648         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38649         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38650         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38651         CVec_u8Z_free(ret_var);
38652         return ret_arr;
38653 }
38654
38655 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) {
38656         uint8_t commitment_txid_arr[32];
38657         CHECK(commitment_txid->arr_len == 32);
38658         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
38659         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
38660         LDKHTLCOutputInCommitment htlc_conv;
38661         htlc_conv.inner = untag_ptr(htlc);
38662         htlc_conv.is_owned = ptr_is_owned(htlc);
38663         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38664         htlc_conv.is_owned = false;
38665         LDKPublicKey broadcaster_delayed_payment_key_ref;
38666         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38667         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38668         LDKPublicKey revocation_key_ref;
38669         CHECK(revocation_key->arr_len == 33);
38670         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38671         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);
38672         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38673         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38674         Transaction_free(ret_var);
38675         return ret_arr;
38676 }
38677
38678 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) {
38679         LDKSignature local_sig_ref;
38680         CHECK(local_sig->arr_len == 64);
38681         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
38682         LDKSignature remote_sig_ref;
38683         CHECK(remote_sig->arr_len == 64);
38684         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
38685         LDKThirtyTwoBytes preimage_ref;
38686         CHECK(preimage->arr_len == 32);
38687         memcpy(preimage_ref.data, preimage->elems, 32); FREE(preimage);
38688         LDKu8slice redeem_script_ref;
38689         redeem_script_ref.datalen = redeem_script->arr_len;
38690         redeem_script_ref.data = redeem_script->elems;
38691         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors);
38692         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38693         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38694         Witness_free(ret_var);
38695         FREE(redeem_script);
38696         return ret_arr;
38697 }
38698
38699 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
38700         LDKPublicKey payment_point_ref;
38701         CHECK(payment_point->arr_len == 33);
38702         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
38703         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
38704         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38705         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38706         CVec_u8Z_free(ret_var);
38707         return ret_arr;
38708 }
38709
38710 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
38711         LDKPublicKey funding_pubkey_ref;
38712         CHECK(funding_pubkey->arr_len == 33);
38713         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
38714         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38715         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38716         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38717         CVec_u8Z_free(ret_var);
38718         return ret_arr;
38719 }
38720
38721 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
38722         LDKPublicKey funding_key_ref;
38723         CHECK(funding_key->arr_len == 33);
38724         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
38725         LDKSignature funding_sig_ref;
38726         CHECK(funding_sig->arr_len == 64);
38727         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
38728         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
38729         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38730         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38731         Witness_free(ret_var);
38732         return ret_arr;
38733 }
38734
38735 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
38736         LDKChannelTransactionParameters this_obj_conv;
38737         this_obj_conv.inner = untag_ptr(this_obj);
38738         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38740         ChannelTransactionParameters_free(this_obj_conv);
38741 }
38742
38743 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
38744         LDKChannelTransactionParameters this_ptr_conv;
38745         this_ptr_conv.inner = untag_ptr(this_ptr);
38746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38748         this_ptr_conv.is_owned = false;
38749         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38750         uint64_t ret_ref = 0;
38751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38753         return ret_ref;
38754 }
38755
38756 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
38757         LDKChannelTransactionParameters this_ptr_conv;
38758         this_ptr_conv.inner = untag_ptr(this_ptr);
38759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38761         this_ptr_conv.is_owned = false;
38762         LDKChannelPublicKeys val_conv;
38763         val_conv.inner = untag_ptr(val);
38764         val_conv.is_owned = ptr_is_owned(val);
38765         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38766         val_conv = ChannelPublicKeys_clone(&val_conv);
38767         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38768 }
38769
38770 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
38771         LDKChannelTransactionParameters this_ptr_conv;
38772         this_ptr_conv.inner = untag_ptr(this_ptr);
38773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38775         this_ptr_conv.is_owned = false;
38776         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38777         return ret_conv;
38778 }
38779
38780 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) {
38781         LDKChannelTransactionParameters this_ptr_conv;
38782         this_ptr_conv.inner = untag_ptr(this_ptr);
38783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38785         this_ptr_conv.is_owned = false;
38786         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38787 }
38788
38789 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
38790         LDKChannelTransactionParameters this_ptr_conv;
38791         this_ptr_conv.inner = untag_ptr(this_ptr);
38792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38794         this_ptr_conv.is_owned = false;
38795         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38796         return ret_conv;
38797 }
38798
38799 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
38800         LDKChannelTransactionParameters this_ptr_conv;
38801         this_ptr_conv.inner = untag_ptr(this_ptr);
38802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38804         this_ptr_conv.is_owned = false;
38805         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38806 }
38807
38808 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
38809         LDKChannelTransactionParameters this_ptr_conv;
38810         this_ptr_conv.inner = untag_ptr(this_ptr);
38811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38813         this_ptr_conv.is_owned = false;
38814         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38815         uint64_t ret_ref = 0;
38816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38818         return ret_ref;
38819 }
38820
38821 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
38822         LDKChannelTransactionParameters this_ptr_conv;
38823         this_ptr_conv.inner = untag_ptr(this_ptr);
38824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38826         this_ptr_conv.is_owned = false;
38827         LDKCounterpartyChannelTransactionParameters val_conv;
38828         val_conv.inner = untag_ptr(val);
38829         val_conv.is_owned = ptr_is_owned(val);
38830         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38831         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38832         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38833 }
38834
38835 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
38836         LDKChannelTransactionParameters this_ptr_conv;
38837         this_ptr_conv.inner = untag_ptr(this_ptr);
38838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38840         this_ptr_conv.is_owned = false;
38841         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38842         uint64_t ret_ref = 0;
38843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38845         return ret_ref;
38846 }
38847
38848 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
38849         LDKChannelTransactionParameters this_ptr_conv;
38850         this_ptr_conv.inner = untag_ptr(this_ptr);
38851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38853         this_ptr_conv.is_owned = false;
38854         LDKOutPoint val_conv;
38855         val_conv.inner = untag_ptr(val);
38856         val_conv.is_owned = ptr_is_owned(val);
38857         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38858         val_conv = OutPoint_clone(&val_conv);
38859         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38860 }
38861
38862 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
38863         LDKChannelTransactionParameters this_ptr_conv;
38864         this_ptr_conv.inner = untag_ptr(this_ptr);
38865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38867         this_ptr_conv.is_owned = false;
38868         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38869         return ret_conv;
38870 }
38871
38872 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
38873         LDKChannelTransactionParameters this_ptr_conv;
38874         this_ptr_conv.inner = untag_ptr(this_ptr);
38875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38877         this_ptr_conv.is_owned = false;
38878         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38879         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38880 }
38881
38882 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) {
38883         LDKChannelTransactionParameters this_ptr_conv;
38884         this_ptr_conv.inner = untag_ptr(this_ptr);
38885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38887         this_ptr_conv.is_owned = false;
38888         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_non_zero_fee_anchors(&this_ptr_conv));
38889         return ret_conv;
38890 }
38891
38892 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) {
38893         LDKChannelTransactionParameters this_ptr_conv;
38894         this_ptr_conv.inner = untag_ptr(this_ptr);
38895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38897         this_ptr_conv.is_owned = false;
38898         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38899         ChannelTransactionParameters_set_opt_non_zero_fee_anchors(&this_ptr_conv, val_conv);
38900 }
38901
38902 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) {
38903         LDKChannelPublicKeys holder_pubkeys_arg_conv;
38904         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
38905         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
38906         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38907         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38908         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38909         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
38910         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
38911         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38912         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38913         LDKOutPoint funding_outpoint_arg_conv;
38914         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
38915         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
38916         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38917         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38918         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
38919         LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_non_zero_fee_anchors_arg);
38920         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);
38921         uint64_t ret_ref = 0;
38922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38924         return ret_ref;
38925 }
38926
38927 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38928         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38929         uint64_t ret_ref = 0;
38930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38932         return ret_ref;
38933 }
38934 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
38935         LDKChannelTransactionParameters arg_conv;
38936         arg_conv.inner = untag_ptr(arg);
38937         arg_conv.is_owned = ptr_is_owned(arg);
38938         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38939         arg_conv.is_owned = false;
38940         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38941         return ret_conv;
38942 }
38943
38944 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
38945         LDKChannelTransactionParameters orig_conv;
38946         orig_conv.inner = untag_ptr(orig);
38947         orig_conv.is_owned = ptr_is_owned(orig);
38948         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38949         orig_conv.is_owned = false;
38950         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38951         uint64_t ret_ref = 0;
38952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38954         return ret_ref;
38955 }
38956
38957 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
38958         LDKChannelTransactionParameters a_conv;
38959         a_conv.inner = untag_ptr(a);
38960         a_conv.is_owned = ptr_is_owned(a);
38961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38962         a_conv.is_owned = false;
38963         LDKChannelTransactionParameters b_conv;
38964         b_conv.inner = untag_ptr(b);
38965         b_conv.is_owned = ptr_is_owned(b);
38966         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38967         b_conv.is_owned = false;
38968         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
38969         return ret_conv;
38970 }
38971
38972 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
38973         LDKCounterpartyChannelTransactionParameters this_obj_conv;
38974         this_obj_conv.inner = untag_ptr(this_obj);
38975         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38977         CounterpartyChannelTransactionParameters_free(this_obj_conv);
38978 }
38979
38980 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
38981         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38982         this_ptr_conv.inner = untag_ptr(this_ptr);
38983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38985         this_ptr_conv.is_owned = false;
38986         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
38987         uint64_t ret_ref = 0;
38988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38990         return ret_ref;
38991 }
38992
38993 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
38994         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38995         this_ptr_conv.inner = untag_ptr(this_ptr);
38996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38998         this_ptr_conv.is_owned = false;
38999         LDKChannelPublicKeys val_conv;
39000         val_conv.inner = untag_ptr(val);
39001         val_conv.is_owned = ptr_is_owned(val);
39002         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39003         val_conv = ChannelPublicKeys_clone(&val_conv);
39004         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
39005 }
39006
39007 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
39008         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39009         this_ptr_conv.inner = untag_ptr(this_ptr);
39010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39012         this_ptr_conv.is_owned = false;
39013         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
39014         return ret_conv;
39015 }
39016
39017 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
39018         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39019         this_ptr_conv.inner = untag_ptr(this_ptr);
39020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39022         this_ptr_conv.is_owned = false;
39023         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
39024 }
39025
39026 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
39027         LDKChannelPublicKeys pubkeys_arg_conv;
39028         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
39029         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
39030         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
39031         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
39032         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
39033         uint64_t ret_ref = 0;
39034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39036         return ret_ref;
39037 }
39038
39039 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
39040         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
39041         uint64_t ret_ref = 0;
39042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39044         return ret_ref;
39045 }
39046 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
39047         LDKCounterpartyChannelTransactionParameters arg_conv;
39048         arg_conv.inner = untag_ptr(arg);
39049         arg_conv.is_owned = ptr_is_owned(arg);
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39051         arg_conv.is_owned = false;
39052         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
39053         return ret_conv;
39054 }
39055
39056 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
39057         LDKCounterpartyChannelTransactionParameters orig_conv;
39058         orig_conv.inner = untag_ptr(orig);
39059         orig_conv.is_owned = ptr_is_owned(orig);
39060         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39061         orig_conv.is_owned = false;
39062         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
39063         uint64_t ret_ref = 0;
39064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39066         return ret_ref;
39067 }
39068
39069 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
39070         LDKCounterpartyChannelTransactionParameters a_conv;
39071         a_conv.inner = untag_ptr(a);
39072         a_conv.is_owned = ptr_is_owned(a);
39073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39074         a_conv.is_owned = false;
39075         LDKCounterpartyChannelTransactionParameters b_conv;
39076         b_conv.inner = untag_ptr(b);
39077         b_conv.is_owned = ptr_is_owned(b);
39078         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39079         b_conv.is_owned = false;
39080         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
39081         return ret_conv;
39082 }
39083
39084 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
39085         LDKChannelTransactionParameters this_arg_conv;
39086         this_arg_conv.inner = untag_ptr(this_arg);
39087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39089         this_arg_conv.is_owned = false;
39090         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
39091         return ret_conv;
39092 }
39093
39094 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
39095         LDKChannelTransactionParameters this_arg_conv;
39096         this_arg_conv.inner = untag_ptr(this_arg);
39097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39099         this_arg_conv.is_owned = false;
39100         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
39101         uint64_t ret_ref = 0;
39102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39104         return ret_ref;
39105 }
39106
39107 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
39108         LDKChannelTransactionParameters this_arg_conv;
39109         this_arg_conv.inner = untag_ptr(this_arg);
39110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39112         this_arg_conv.is_owned = false;
39113         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
39114         uint64_t ret_ref = 0;
39115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39117         return ret_ref;
39118 }
39119
39120 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
39121         LDKCounterpartyChannelTransactionParameters obj_conv;
39122         obj_conv.inner = untag_ptr(obj);
39123         obj_conv.is_owned = ptr_is_owned(obj);
39124         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39125         obj_conv.is_owned = false;
39126         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
39127         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39128         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39129         CVec_u8Z_free(ret_var);
39130         return ret_arr;
39131 }
39132
39133 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
39134         LDKu8slice ser_ref;
39135         ser_ref.datalen = ser->arr_len;
39136         ser_ref.data = ser->elems;
39137         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
39138         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
39139         FREE(ser);
39140         return tag_ptr(ret_conv, true);
39141 }
39142
39143 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
39144         LDKChannelTransactionParameters obj_conv;
39145         obj_conv.inner = untag_ptr(obj);
39146         obj_conv.is_owned = ptr_is_owned(obj);
39147         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39148         obj_conv.is_owned = false;
39149         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
39150         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39151         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39152         CVec_u8Z_free(ret_var);
39153         return ret_arr;
39154 }
39155
39156 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
39157         LDKu8slice ser_ref;
39158         ser_ref.datalen = ser->arr_len;
39159         ser_ref.data = ser->elems;
39160         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
39161         *ret_conv = ChannelTransactionParameters_read(ser_ref);
39162         FREE(ser);
39163         return tag_ptr(ret_conv, true);
39164 }
39165
39166 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
39167         LDKDirectedChannelTransactionParameters this_obj_conv;
39168         this_obj_conv.inner = untag_ptr(this_obj);
39169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39171         DirectedChannelTransactionParameters_free(this_obj_conv);
39172 }
39173
39174 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
39175         LDKDirectedChannelTransactionParameters this_arg_conv;
39176         this_arg_conv.inner = untag_ptr(this_arg);
39177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39179         this_arg_conv.is_owned = false;
39180         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
39181         uint64_t ret_ref = 0;
39182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39184         return ret_ref;
39185 }
39186
39187 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
39188         LDKDirectedChannelTransactionParameters this_arg_conv;
39189         this_arg_conv.inner = untag_ptr(this_arg);
39190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39192         this_arg_conv.is_owned = false;
39193         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
39194         uint64_t ret_ref = 0;
39195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39197         return ret_ref;
39198 }
39199
39200 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
39201         LDKDirectedChannelTransactionParameters this_arg_conv;
39202         this_arg_conv.inner = untag_ptr(this_arg);
39203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39205         this_arg_conv.is_owned = false;
39206         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
39207         return ret_conv;
39208 }
39209
39210 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
39211         LDKDirectedChannelTransactionParameters this_arg_conv;
39212         this_arg_conv.inner = untag_ptr(this_arg);
39213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39215         this_arg_conv.is_owned = false;
39216         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
39217         return ret_conv;
39218 }
39219
39220 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
39221         LDKDirectedChannelTransactionParameters this_arg_conv;
39222         this_arg_conv.inner = untag_ptr(this_arg);
39223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39225         this_arg_conv.is_owned = false;
39226         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
39227         uint64_t ret_ref = 0;
39228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39230         return ret_ref;
39231 }
39232
39233 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
39234         LDKDirectedChannelTransactionParameters this_arg_conv;
39235         this_arg_conv.inner = untag_ptr(this_arg);
39236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39238         this_arg_conv.is_owned = false;
39239         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
39240         return ret_conv;
39241 }
39242
39243 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
39244         LDKHolderCommitmentTransaction this_obj_conv;
39245         this_obj_conv.inner = untag_ptr(this_obj);
39246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39248         HolderCommitmentTransaction_free(this_obj_conv);
39249 }
39250
39251 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
39252         LDKHolderCommitmentTransaction this_ptr_conv;
39253         this_ptr_conv.inner = untag_ptr(this_ptr);
39254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39256         this_ptr_conv.is_owned = false;
39257         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39258         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
39259         return ret_arr;
39260 }
39261
39262 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
39263         LDKHolderCommitmentTransaction this_ptr_conv;
39264         this_ptr_conv.inner = untag_ptr(this_ptr);
39265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39267         this_ptr_conv.is_owned = false;
39268         LDKSignature val_ref;
39269         CHECK(val->arr_len == 64);
39270         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39271         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
39272 }
39273
39274 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
39275         LDKHolderCommitmentTransaction this_ptr_conv;
39276         this_ptr_conv.inner = untag_ptr(this_ptr);
39277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39279         this_ptr_conv.is_owned = false;
39280         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
39281         ptrArray ret_arr = NULL;
39282         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39283         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39284         for (size_t m = 0; m < ret_var.datalen; m++) {
39285                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
39286                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
39287                 ret_arr_ptr[m] = ret_conv_12_arr;
39288         }
39289         
39290         FREE(ret_var.data);
39291         return ret_arr;
39292 }
39293
39294 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
39295         LDKHolderCommitmentTransaction this_ptr_conv;
39296         this_ptr_conv.inner = untag_ptr(this_ptr);
39297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39299         this_ptr_conv.is_owned = false;
39300         LDKCVec_SignatureZ val_constr;
39301         val_constr.datalen = val->arr_len;
39302         if (val_constr.datalen > 0)
39303                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39304         else
39305                 val_constr.data = NULL;
39306         int8_tArray* val_vals = (void*) val->elems;
39307         for (size_t m = 0; m < val_constr.datalen; m++) {
39308                 int8_tArray val_conv_12 = val_vals[m];
39309                 LDKSignature val_conv_12_ref;
39310                 CHECK(val_conv_12->arr_len == 64);
39311                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
39312                 val_constr.data[m] = val_conv_12_ref;
39313         }
39314         FREE(val);
39315         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
39316 }
39317
39318 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
39319         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
39320         uint64_t ret_ref = 0;
39321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39323         return ret_ref;
39324 }
39325 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
39326         LDKHolderCommitmentTransaction arg_conv;
39327         arg_conv.inner = untag_ptr(arg);
39328         arg_conv.is_owned = ptr_is_owned(arg);
39329         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39330         arg_conv.is_owned = false;
39331         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
39332         return ret_conv;
39333 }
39334
39335 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
39336         LDKHolderCommitmentTransaction orig_conv;
39337         orig_conv.inner = untag_ptr(orig);
39338         orig_conv.is_owned = ptr_is_owned(orig);
39339         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39340         orig_conv.is_owned = false;
39341         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
39342         uint64_t ret_ref = 0;
39343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39345         return ret_ref;
39346 }
39347
39348 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
39349         LDKHolderCommitmentTransaction obj_conv;
39350         obj_conv.inner = untag_ptr(obj);
39351         obj_conv.is_owned = ptr_is_owned(obj);
39352         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39353         obj_conv.is_owned = false;
39354         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
39355         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39356         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39357         CVec_u8Z_free(ret_var);
39358         return ret_arr;
39359 }
39360
39361 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
39362         LDKu8slice ser_ref;
39363         ser_ref.datalen = ser->arr_len;
39364         ser_ref.data = ser->elems;
39365         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
39366         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
39367         FREE(ser);
39368         return tag_ptr(ret_conv, true);
39369 }
39370
39371 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) {
39372         LDKCommitmentTransaction commitment_tx_conv;
39373         commitment_tx_conv.inner = untag_ptr(commitment_tx);
39374         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
39375         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
39376         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
39377         LDKSignature counterparty_sig_ref;
39378         CHECK(counterparty_sig->arr_len == 64);
39379         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
39380         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
39381         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
39382         if (counterparty_htlc_sigs_constr.datalen > 0)
39383                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39384         else
39385                 counterparty_htlc_sigs_constr.data = NULL;
39386         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
39387         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
39388                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
39389                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
39390                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
39391                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
39392                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
39393         }
39394         FREE(counterparty_htlc_sigs);
39395         LDKPublicKey holder_funding_key_ref;
39396         CHECK(holder_funding_key->arr_len == 33);
39397         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
39398         LDKPublicKey counterparty_funding_key_ref;
39399         CHECK(counterparty_funding_key->arr_len == 33);
39400         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
39401         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
39402         uint64_t ret_ref = 0;
39403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39405         return ret_ref;
39406 }
39407
39408 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
39409         LDKBuiltCommitmentTransaction this_obj_conv;
39410         this_obj_conv.inner = untag_ptr(this_obj);
39411         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39413         BuiltCommitmentTransaction_free(this_obj_conv);
39414 }
39415
39416 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
39417         LDKBuiltCommitmentTransaction this_ptr_conv;
39418         this_ptr_conv.inner = untag_ptr(this_ptr);
39419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39421         this_ptr_conv.is_owned = false;
39422         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
39423         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39424         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39425         Transaction_free(ret_var);
39426         return ret_arr;
39427 }
39428
39429 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
39430         LDKBuiltCommitmentTransaction this_ptr_conv;
39431         this_ptr_conv.inner = untag_ptr(this_ptr);
39432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39434         this_ptr_conv.is_owned = false;
39435         LDKTransaction val_ref;
39436         val_ref.datalen = val->arr_len;
39437         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
39438         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39439         val_ref.data_is_owned = true;
39440         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
39441 }
39442
39443 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
39444         LDKBuiltCommitmentTransaction this_ptr_conv;
39445         this_ptr_conv.inner = untag_ptr(this_ptr);
39446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39448         this_ptr_conv.is_owned = false;
39449         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39450         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
39451         return ret_arr;
39452 }
39453
39454 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
39455         LDKBuiltCommitmentTransaction this_ptr_conv;
39456         this_ptr_conv.inner = untag_ptr(this_ptr);
39457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39459         this_ptr_conv.is_owned = false;
39460         LDKThirtyTwoBytes val_ref;
39461         CHECK(val->arr_len == 32);
39462         memcpy(val_ref.data, val->elems, 32); FREE(val);
39463         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
39464 }
39465
39466 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
39467         LDKTransaction transaction_arg_ref;
39468         transaction_arg_ref.datalen = transaction_arg->arr_len;
39469         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
39470         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
39471         transaction_arg_ref.data_is_owned = true;
39472         LDKThirtyTwoBytes txid_arg_ref;
39473         CHECK(txid_arg->arr_len == 32);
39474         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
39475         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
39476         uint64_t ret_ref = 0;
39477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39479         return ret_ref;
39480 }
39481
39482 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
39483         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
39484         uint64_t ret_ref = 0;
39485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39487         return ret_ref;
39488 }
39489 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
39490         LDKBuiltCommitmentTransaction arg_conv;
39491         arg_conv.inner = untag_ptr(arg);
39492         arg_conv.is_owned = ptr_is_owned(arg);
39493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39494         arg_conv.is_owned = false;
39495         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
39496         return ret_conv;
39497 }
39498
39499 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
39500         LDKBuiltCommitmentTransaction orig_conv;
39501         orig_conv.inner = untag_ptr(orig);
39502         orig_conv.is_owned = ptr_is_owned(orig);
39503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39504         orig_conv.is_owned = false;
39505         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
39506         uint64_t ret_ref = 0;
39507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39509         return ret_ref;
39510 }
39511
39512 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
39513         LDKBuiltCommitmentTransaction obj_conv;
39514         obj_conv.inner = untag_ptr(obj);
39515         obj_conv.is_owned = ptr_is_owned(obj);
39516         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39517         obj_conv.is_owned = false;
39518         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
39519         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39520         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39521         CVec_u8Z_free(ret_var);
39522         return ret_arr;
39523 }
39524
39525 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
39526         LDKu8slice ser_ref;
39527         ser_ref.datalen = ser->arr_len;
39528         ser_ref.data = ser->elems;
39529         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
39530         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
39531         FREE(ser);
39532         return tag_ptr(ret_conv, true);
39533 }
39534
39535 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) {
39536         LDKBuiltCommitmentTransaction this_arg_conv;
39537         this_arg_conv.inner = untag_ptr(this_arg);
39538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39540         this_arg_conv.is_owned = false;
39541         LDKu8slice funding_redeemscript_ref;
39542         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39543         funding_redeemscript_ref.data = funding_redeemscript->elems;
39544         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39545         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39546         FREE(funding_redeemscript);
39547         return ret_arr;
39548 }
39549
39550 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) {
39551         LDKBuiltCommitmentTransaction this_arg_conv;
39552         this_arg_conv.inner = untag_ptr(this_arg);
39553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39555         this_arg_conv.is_owned = false;
39556         uint8_t funding_key_arr[32];
39557         CHECK(funding_key->arr_len == 32);
39558         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39559         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39560         LDKu8slice funding_redeemscript_ref;
39561         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39562         funding_redeemscript_ref.data = funding_redeemscript->elems;
39563         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39564         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39565         FREE(funding_redeemscript);
39566         return ret_arr;
39567 }
39568
39569 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) {
39570         LDKBuiltCommitmentTransaction this_arg_conv;
39571         this_arg_conv.inner = untag_ptr(this_arg);
39572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39574         this_arg_conv.is_owned = false;
39575         uint8_t funding_key_arr[32];
39576         CHECK(funding_key->arr_len == 32);
39577         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39578         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39579         LDKu8slice funding_redeemscript_ref;
39580         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39581         funding_redeemscript_ref.data = funding_redeemscript->elems;
39582         void* entropy_source_ptr = untag_ptr(entropy_source);
39583         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
39584         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
39585         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39586         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);
39587         FREE(funding_redeemscript);
39588         return ret_arr;
39589 }
39590
39591 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
39592         LDKClosingTransaction this_obj_conv;
39593         this_obj_conv.inner = untag_ptr(this_obj);
39594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39596         ClosingTransaction_free(this_obj_conv);
39597 }
39598
39599 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
39600         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
39601         uint64_t ret_ref = 0;
39602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39604         return ret_ref;
39605 }
39606 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
39607         LDKClosingTransaction arg_conv;
39608         arg_conv.inner = untag_ptr(arg);
39609         arg_conv.is_owned = ptr_is_owned(arg);
39610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39611         arg_conv.is_owned = false;
39612         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
39613         return ret_conv;
39614 }
39615
39616 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
39617         LDKClosingTransaction orig_conv;
39618         orig_conv.inner = untag_ptr(orig);
39619         orig_conv.is_owned = ptr_is_owned(orig);
39620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39621         orig_conv.is_owned = false;
39622         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
39623         uint64_t ret_ref = 0;
39624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39626         return ret_ref;
39627 }
39628
39629 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
39630         LDKClosingTransaction o_conv;
39631         o_conv.inner = untag_ptr(o);
39632         o_conv.is_owned = ptr_is_owned(o);
39633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39634         o_conv.is_owned = false;
39635         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39636         return ret_conv;
39637 }
39638
39639 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
39640         LDKClosingTransaction a_conv;
39641         a_conv.inner = untag_ptr(a);
39642         a_conv.is_owned = ptr_is_owned(a);
39643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39644         a_conv.is_owned = false;
39645         LDKClosingTransaction b_conv;
39646         b_conv.inner = untag_ptr(b);
39647         b_conv.is_owned = ptr_is_owned(b);
39648         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39649         b_conv.is_owned = false;
39650         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
39651         return ret_conv;
39652 }
39653
39654 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) {
39655         LDKCVec_u8Z to_holder_script_ref;
39656         to_holder_script_ref.datalen = to_holder_script->arr_len;
39657         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39658         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
39659         LDKCVec_u8Z to_counterparty_script_ref;
39660         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
39661         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39662         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
39663         LDKOutPoint funding_outpoint_conv;
39664         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39665         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39666         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39667         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39668         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39669         uint64_t ret_ref = 0;
39670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39672         return ret_ref;
39673 }
39674
39675 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
39676         LDKClosingTransaction this_arg_conv;
39677         this_arg_conv.inner = untag_ptr(this_arg);
39678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39680         this_arg_conv.is_owned = false;
39681         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39682         uint64_t ret_ref = 0;
39683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39685         return ret_ref;
39686 }
39687
39688 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
39689         LDKClosingTransaction this_arg_conv;
39690         this_arg_conv.inner = untag_ptr(this_arg);
39691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39693         this_arg_conv.is_owned = false;
39694         LDKOutPoint funding_outpoint_conv;
39695         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39696         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39697         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39698         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39699         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39700         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39701         return tag_ptr(ret_conv, true);
39702 }
39703
39704 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
39705         LDKClosingTransaction this_arg_conv;
39706         this_arg_conv.inner = untag_ptr(this_arg);
39707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39709         this_arg_conv.is_owned = false;
39710         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39711         return ret_conv;
39712 }
39713
39714 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
39715         LDKClosingTransaction this_arg_conv;
39716         this_arg_conv.inner = untag_ptr(this_arg);
39717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39719         this_arg_conv.is_owned = false;
39720         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39721         return ret_conv;
39722 }
39723
39724 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
39725         LDKClosingTransaction this_arg_conv;
39726         this_arg_conv.inner = untag_ptr(this_arg);
39727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39729         this_arg_conv.is_owned = false;
39730         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39731         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39732         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39733         return ret_arr;
39734 }
39735
39736 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
39737         LDKClosingTransaction this_arg_conv;
39738         this_arg_conv.inner = untag_ptr(this_arg);
39739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39741         this_arg_conv.is_owned = false;
39742         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
39743         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39744         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39745         return ret_arr;
39746 }
39747
39748 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
39749         LDKTrustedClosingTransaction this_obj_conv;
39750         this_obj_conv.inner = untag_ptr(this_obj);
39751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39753         TrustedClosingTransaction_free(this_obj_conv);
39754 }
39755
39756 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
39757         LDKTrustedClosingTransaction this_arg_conv;
39758         this_arg_conv.inner = untag_ptr(this_arg);
39759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39761         this_arg_conv.is_owned = false;
39762         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39763         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39764         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39765         Transaction_free(ret_var);
39766         return ret_arr;
39767 }
39768
39769 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) {
39770         LDKTrustedClosingTransaction this_arg_conv;
39771         this_arg_conv.inner = untag_ptr(this_arg);
39772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39774         this_arg_conv.is_owned = false;
39775         LDKu8slice funding_redeemscript_ref;
39776         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39777         funding_redeemscript_ref.data = funding_redeemscript->elems;
39778         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39779         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39780         FREE(funding_redeemscript);
39781         return ret_arr;
39782 }
39783
39784 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) {
39785         LDKTrustedClosingTransaction this_arg_conv;
39786         this_arg_conv.inner = untag_ptr(this_arg);
39787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39789         this_arg_conv.is_owned = false;
39790         uint8_t funding_key_arr[32];
39791         CHECK(funding_key->arr_len == 32);
39792         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39793         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39794         LDKu8slice funding_redeemscript_ref;
39795         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39796         funding_redeemscript_ref.data = funding_redeemscript->elems;
39797         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39798         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39799         FREE(funding_redeemscript);
39800         return ret_arr;
39801 }
39802
39803 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
39804         LDKCommitmentTransaction this_obj_conv;
39805         this_obj_conv.inner = untag_ptr(this_obj);
39806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39808         CommitmentTransaction_free(this_obj_conv);
39809 }
39810
39811 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39812         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39813         uint64_t ret_ref = 0;
39814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39816         return ret_ref;
39817 }
39818 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
39819         LDKCommitmentTransaction arg_conv;
39820         arg_conv.inner = untag_ptr(arg);
39821         arg_conv.is_owned = ptr_is_owned(arg);
39822         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39823         arg_conv.is_owned = false;
39824         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39825         return ret_conv;
39826 }
39827
39828 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
39829         LDKCommitmentTransaction orig_conv;
39830         orig_conv.inner = untag_ptr(orig);
39831         orig_conv.is_owned = ptr_is_owned(orig);
39832         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39833         orig_conv.is_owned = false;
39834         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39835         uint64_t ret_ref = 0;
39836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39838         return ret_ref;
39839 }
39840
39841 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
39842         LDKCommitmentTransaction obj_conv;
39843         obj_conv.inner = untag_ptr(obj);
39844         obj_conv.is_owned = ptr_is_owned(obj);
39845         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39846         obj_conv.is_owned = false;
39847         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39848         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39849         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39850         CVec_u8Z_free(ret_var);
39851         return ret_arr;
39852 }
39853
39854 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
39855         LDKu8slice ser_ref;
39856         ser_ref.datalen = ser->arr_len;
39857         ser_ref.data = ser->elems;
39858         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39859         *ret_conv = CommitmentTransaction_read(ser_ref);
39860         FREE(ser);
39861         return tag_ptr(ret_conv, true);
39862 }
39863
39864 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
39865         LDKCommitmentTransaction this_arg_conv;
39866         this_arg_conv.inner = untag_ptr(this_arg);
39867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39869         this_arg_conv.is_owned = false;
39870         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39871         return ret_conv;
39872 }
39873
39874 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
39875         LDKCommitmentTransaction this_arg_conv;
39876         this_arg_conv.inner = untag_ptr(this_arg);
39877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39879         this_arg_conv.is_owned = false;
39880         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39881         return ret_conv;
39882 }
39883
39884 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
39885         LDKCommitmentTransaction this_arg_conv;
39886         this_arg_conv.inner = untag_ptr(this_arg);
39887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39889         this_arg_conv.is_owned = false;
39890         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39891         return ret_conv;
39892 }
39893
39894 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
39895         LDKCommitmentTransaction this_arg_conv;
39896         this_arg_conv.inner = untag_ptr(this_arg);
39897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39899         this_arg_conv.is_owned = false;
39900         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39901         return ret_conv;
39902 }
39903
39904 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
39905         LDKCommitmentTransaction this_arg_conv;
39906         this_arg_conv.inner = untag_ptr(this_arg);
39907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39909         this_arg_conv.is_owned = false;
39910         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39911         uint64_t ret_ref = 0;
39912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39914         return ret_ref;
39915 }
39916
39917 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) {
39918         LDKCommitmentTransaction this_arg_conv;
39919         this_arg_conv.inner = untag_ptr(this_arg);
39920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39922         this_arg_conv.is_owned = false;
39923         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39924         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39925         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39926         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39927         channel_parameters_conv.is_owned = false;
39928         LDKChannelPublicKeys broadcaster_keys_conv;
39929         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39930         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39931         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39932         broadcaster_keys_conv.is_owned = false;
39933         LDKChannelPublicKeys countersignatory_keys_conv;
39934         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39935         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39936         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39937         countersignatory_keys_conv.is_owned = false;
39938         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39939         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39940         return tag_ptr(ret_conv, true);
39941 }
39942
39943 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
39944         LDKTrustedCommitmentTransaction this_obj_conv;
39945         this_obj_conv.inner = untag_ptr(this_obj);
39946         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39948         TrustedCommitmentTransaction_free(this_obj_conv);
39949 }
39950
39951 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
39952         LDKTrustedCommitmentTransaction this_arg_conv;
39953         this_arg_conv.inner = untag_ptr(this_arg);
39954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39956         this_arg_conv.is_owned = false;
39957         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39958         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
39959         return ret_arr;
39960 }
39961
39962 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
39963         LDKTrustedCommitmentTransaction this_arg_conv;
39964         this_arg_conv.inner = untag_ptr(this_arg);
39965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39967         this_arg_conv.is_owned = false;
39968         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39969         uint64_t ret_ref = 0;
39970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39972         return ret_ref;
39973 }
39974
39975 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
39976         LDKTrustedCommitmentTransaction this_arg_conv;
39977         this_arg_conv.inner = untag_ptr(this_arg);
39978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39980         this_arg_conv.is_owned = false;
39981         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
39982         uint64_t ret_ref = 0;
39983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39985         return ret_ref;
39986 }
39987
39988 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
39989         LDKTrustedCommitmentTransaction this_arg_conv;
39990         this_arg_conv.inner = untag_ptr(this_arg);
39991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39993         this_arg_conv.is_owned = false;
39994         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
39995         return ret_conv;
39996 }
39997
39998 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) {
39999         LDKTrustedCommitmentTransaction this_arg_conv;
40000         this_arg_conv.inner = untag_ptr(this_arg);
40001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40003         this_arg_conv.is_owned = false;
40004         uint8_t htlc_base_key_arr[32];
40005         CHECK(htlc_base_key->arr_len == 32);
40006         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
40007         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
40008         LDKDirectedChannelTransactionParameters channel_parameters_conv;
40009         channel_parameters_conv.inner = untag_ptr(channel_parameters);
40010         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
40011         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40012         channel_parameters_conv.is_owned = false;
40013         void* entropy_source_ptr = untag_ptr(entropy_source);
40014         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
40015         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
40016         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
40017         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
40018         return tag_ptr(ret_conv, true);
40019 }
40020
40021 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) {
40022         LDKPublicKey broadcaster_payment_basepoint_ref;
40023         CHECK(broadcaster_payment_basepoint->arr_len == 33);
40024         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
40025         LDKPublicKey countersignatory_payment_basepoint_ref;
40026         CHECK(countersignatory_payment_basepoint->arr_len == 33);
40027         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
40028         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
40029         return ret_conv;
40030 }
40031
40032 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
40033         LDKInitFeatures a_conv;
40034         a_conv.inner = untag_ptr(a);
40035         a_conv.is_owned = ptr_is_owned(a);
40036         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40037         a_conv.is_owned = false;
40038         LDKInitFeatures b_conv;
40039         b_conv.inner = untag_ptr(b);
40040         b_conv.is_owned = ptr_is_owned(b);
40041         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40042         b_conv.is_owned = false;
40043         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
40044         return ret_conv;
40045 }
40046
40047 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
40048         LDKNodeFeatures a_conv;
40049         a_conv.inner = untag_ptr(a);
40050         a_conv.is_owned = ptr_is_owned(a);
40051         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40052         a_conv.is_owned = false;
40053         LDKNodeFeatures b_conv;
40054         b_conv.inner = untag_ptr(b);
40055         b_conv.is_owned = ptr_is_owned(b);
40056         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40057         b_conv.is_owned = false;
40058         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
40059         return ret_conv;
40060 }
40061
40062 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
40063         LDKChannelFeatures a_conv;
40064         a_conv.inner = untag_ptr(a);
40065         a_conv.is_owned = ptr_is_owned(a);
40066         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40067         a_conv.is_owned = false;
40068         LDKChannelFeatures b_conv;
40069         b_conv.inner = untag_ptr(b);
40070         b_conv.is_owned = ptr_is_owned(b);
40071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40072         b_conv.is_owned = false;
40073         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
40074         return ret_conv;
40075 }
40076
40077 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40078         LDKInvoiceFeatures a_conv;
40079         a_conv.inner = untag_ptr(a);
40080         a_conv.is_owned = ptr_is_owned(a);
40081         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40082         a_conv.is_owned = false;
40083         LDKInvoiceFeatures b_conv;
40084         b_conv.inner = untag_ptr(b);
40085         b_conv.is_owned = ptr_is_owned(b);
40086         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40087         b_conv.is_owned = false;
40088         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
40089         return ret_conv;
40090 }
40091
40092 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
40093         LDKOfferFeatures a_conv;
40094         a_conv.inner = untag_ptr(a);
40095         a_conv.is_owned = ptr_is_owned(a);
40096         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40097         a_conv.is_owned = false;
40098         LDKOfferFeatures b_conv;
40099         b_conv.inner = untag_ptr(b);
40100         b_conv.is_owned = ptr_is_owned(b);
40101         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40102         b_conv.is_owned = false;
40103         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
40104         return ret_conv;
40105 }
40106
40107 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
40108         LDKInvoiceRequestFeatures a_conv;
40109         a_conv.inner = untag_ptr(a);
40110         a_conv.is_owned = ptr_is_owned(a);
40111         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40112         a_conv.is_owned = false;
40113         LDKInvoiceRequestFeatures b_conv;
40114         b_conv.inner = untag_ptr(b);
40115         b_conv.is_owned = ptr_is_owned(b);
40116         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40117         b_conv.is_owned = false;
40118         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
40119         return ret_conv;
40120 }
40121
40122 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40123         LDKBolt12InvoiceFeatures a_conv;
40124         a_conv.inner = untag_ptr(a);
40125         a_conv.is_owned = ptr_is_owned(a);
40126         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40127         a_conv.is_owned = false;
40128         LDKBolt12InvoiceFeatures b_conv;
40129         b_conv.inner = untag_ptr(b);
40130         b_conv.is_owned = ptr_is_owned(b);
40131         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40132         b_conv.is_owned = false;
40133         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
40134         return ret_conv;
40135 }
40136
40137 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
40138         LDKBlindedHopFeatures a_conv;
40139         a_conv.inner = untag_ptr(a);
40140         a_conv.is_owned = ptr_is_owned(a);
40141         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40142         a_conv.is_owned = false;
40143         LDKBlindedHopFeatures b_conv;
40144         b_conv.inner = untag_ptr(b);
40145         b_conv.is_owned = ptr_is_owned(b);
40146         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40147         b_conv.is_owned = false;
40148         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
40149         return ret_conv;
40150 }
40151
40152 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
40153         LDKChannelTypeFeatures a_conv;
40154         a_conv.inner = untag_ptr(a);
40155         a_conv.is_owned = ptr_is_owned(a);
40156         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40157         a_conv.is_owned = false;
40158         LDKChannelTypeFeatures b_conv;
40159         b_conv.inner = untag_ptr(b);
40160         b_conv.is_owned = ptr_is_owned(b);
40161         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40162         b_conv.is_owned = false;
40163         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
40164         return ret_conv;
40165 }
40166
40167 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
40168         LDKInitFeatures ret_var = InitFeatures_clone(arg);
40169         uint64_t ret_ref = 0;
40170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40172         return ret_ref;
40173 }
40174 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
40175         LDKInitFeatures arg_conv;
40176         arg_conv.inner = untag_ptr(arg);
40177         arg_conv.is_owned = ptr_is_owned(arg);
40178         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40179         arg_conv.is_owned = false;
40180         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
40181         return ret_conv;
40182 }
40183
40184 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
40185         LDKInitFeatures orig_conv;
40186         orig_conv.inner = untag_ptr(orig);
40187         orig_conv.is_owned = ptr_is_owned(orig);
40188         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40189         orig_conv.is_owned = false;
40190         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
40191         uint64_t ret_ref = 0;
40192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40194         return ret_ref;
40195 }
40196
40197 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
40198         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
40199         uint64_t ret_ref = 0;
40200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40202         return ret_ref;
40203 }
40204 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
40205         LDKNodeFeatures arg_conv;
40206         arg_conv.inner = untag_ptr(arg);
40207         arg_conv.is_owned = ptr_is_owned(arg);
40208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40209         arg_conv.is_owned = false;
40210         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
40211         return ret_conv;
40212 }
40213
40214 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
40215         LDKNodeFeatures orig_conv;
40216         orig_conv.inner = untag_ptr(orig);
40217         orig_conv.is_owned = ptr_is_owned(orig);
40218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40219         orig_conv.is_owned = false;
40220         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
40221         uint64_t ret_ref = 0;
40222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40224         return ret_ref;
40225 }
40226
40227 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
40228         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
40229         uint64_t ret_ref = 0;
40230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40232         return ret_ref;
40233 }
40234 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
40235         LDKChannelFeatures arg_conv;
40236         arg_conv.inner = untag_ptr(arg);
40237         arg_conv.is_owned = ptr_is_owned(arg);
40238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40239         arg_conv.is_owned = false;
40240         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
40241         return ret_conv;
40242 }
40243
40244 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
40245         LDKChannelFeatures orig_conv;
40246         orig_conv.inner = untag_ptr(orig);
40247         orig_conv.is_owned = ptr_is_owned(orig);
40248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40249         orig_conv.is_owned = false;
40250         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
40251         uint64_t ret_ref = 0;
40252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40254         return ret_ref;
40255 }
40256
40257 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
40258         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
40259         uint64_t ret_ref = 0;
40260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40262         return ret_ref;
40263 }
40264 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
40265         LDKInvoiceFeatures arg_conv;
40266         arg_conv.inner = untag_ptr(arg);
40267         arg_conv.is_owned = ptr_is_owned(arg);
40268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40269         arg_conv.is_owned = false;
40270         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
40271         return ret_conv;
40272 }
40273
40274 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
40275         LDKInvoiceFeatures orig_conv;
40276         orig_conv.inner = untag_ptr(orig);
40277         orig_conv.is_owned = ptr_is_owned(orig);
40278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40279         orig_conv.is_owned = false;
40280         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
40281         uint64_t ret_ref = 0;
40282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40284         return ret_ref;
40285 }
40286
40287 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
40288         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
40289         uint64_t ret_ref = 0;
40290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40292         return ret_ref;
40293 }
40294 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
40295         LDKOfferFeatures arg_conv;
40296         arg_conv.inner = untag_ptr(arg);
40297         arg_conv.is_owned = ptr_is_owned(arg);
40298         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40299         arg_conv.is_owned = false;
40300         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
40301         return ret_conv;
40302 }
40303
40304 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
40305         LDKOfferFeatures orig_conv;
40306         orig_conv.inner = untag_ptr(orig);
40307         orig_conv.is_owned = ptr_is_owned(orig);
40308         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40309         orig_conv.is_owned = false;
40310         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
40311         uint64_t ret_ref = 0;
40312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40314         return ret_ref;
40315 }
40316
40317 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
40318         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
40319         uint64_t ret_ref = 0;
40320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40322         return ret_ref;
40323 }
40324 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
40325         LDKInvoiceRequestFeatures arg_conv;
40326         arg_conv.inner = untag_ptr(arg);
40327         arg_conv.is_owned = ptr_is_owned(arg);
40328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40329         arg_conv.is_owned = false;
40330         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
40331         return ret_conv;
40332 }
40333
40334 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
40335         LDKInvoiceRequestFeatures orig_conv;
40336         orig_conv.inner = untag_ptr(orig);
40337         orig_conv.is_owned = ptr_is_owned(orig);
40338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40339         orig_conv.is_owned = false;
40340         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
40341         uint64_t ret_ref = 0;
40342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40344         return ret_ref;
40345 }
40346
40347 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
40348         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
40349         uint64_t ret_ref = 0;
40350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40352         return ret_ref;
40353 }
40354 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
40355         LDKBolt12InvoiceFeatures arg_conv;
40356         arg_conv.inner = untag_ptr(arg);
40357         arg_conv.is_owned = ptr_is_owned(arg);
40358         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40359         arg_conv.is_owned = false;
40360         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
40361         return ret_conv;
40362 }
40363
40364 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
40365         LDKBolt12InvoiceFeatures orig_conv;
40366         orig_conv.inner = untag_ptr(orig);
40367         orig_conv.is_owned = ptr_is_owned(orig);
40368         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40369         orig_conv.is_owned = false;
40370         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
40371         uint64_t ret_ref = 0;
40372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40374         return ret_ref;
40375 }
40376
40377 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
40378         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
40379         uint64_t ret_ref = 0;
40380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40382         return ret_ref;
40383 }
40384 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
40385         LDKBlindedHopFeatures arg_conv;
40386         arg_conv.inner = untag_ptr(arg);
40387         arg_conv.is_owned = ptr_is_owned(arg);
40388         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40389         arg_conv.is_owned = false;
40390         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
40391         return ret_conv;
40392 }
40393
40394 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
40395         LDKBlindedHopFeatures orig_conv;
40396         orig_conv.inner = untag_ptr(orig);
40397         orig_conv.is_owned = ptr_is_owned(orig);
40398         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40399         orig_conv.is_owned = false;
40400         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
40401         uint64_t ret_ref = 0;
40402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40404         return ret_ref;
40405 }
40406
40407 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
40408         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
40409         uint64_t ret_ref = 0;
40410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40412         return ret_ref;
40413 }
40414 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
40415         LDKChannelTypeFeatures arg_conv;
40416         arg_conv.inner = untag_ptr(arg);
40417         arg_conv.is_owned = ptr_is_owned(arg);
40418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40419         arg_conv.is_owned = false;
40420         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
40421         return ret_conv;
40422 }
40423
40424 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
40425         LDKChannelTypeFeatures orig_conv;
40426         orig_conv.inner = untag_ptr(orig);
40427         orig_conv.is_owned = ptr_is_owned(orig);
40428         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40429         orig_conv.is_owned = false;
40430         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
40431         uint64_t ret_ref = 0;
40432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40434         return ret_ref;
40435 }
40436
40437 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
40438         LDKInitFeatures this_obj_conv;
40439         this_obj_conv.inner = untag_ptr(this_obj);
40440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40442         InitFeatures_free(this_obj_conv);
40443 }
40444
40445 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
40446         LDKNodeFeatures this_obj_conv;
40447         this_obj_conv.inner = untag_ptr(this_obj);
40448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40450         NodeFeatures_free(this_obj_conv);
40451 }
40452
40453 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
40454         LDKChannelFeatures this_obj_conv;
40455         this_obj_conv.inner = untag_ptr(this_obj);
40456         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40458         ChannelFeatures_free(this_obj_conv);
40459 }
40460
40461 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
40462         LDKInvoiceFeatures this_obj_conv;
40463         this_obj_conv.inner = untag_ptr(this_obj);
40464         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40466         InvoiceFeatures_free(this_obj_conv);
40467 }
40468
40469 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
40470         LDKOfferFeatures this_obj_conv;
40471         this_obj_conv.inner = untag_ptr(this_obj);
40472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40474         OfferFeatures_free(this_obj_conv);
40475 }
40476
40477 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
40478         LDKInvoiceRequestFeatures this_obj_conv;
40479         this_obj_conv.inner = untag_ptr(this_obj);
40480         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40482         InvoiceRequestFeatures_free(this_obj_conv);
40483 }
40484
40485 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
40486         LDKBolt12InvoiceFeatures this_obj_conv;
40487         this_obj_conv.inner = untag_ptr(this_obj);
40488         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40490         Bolt12InvoiceFeatures_free(this_obj_conv);
40491 }
40492
40493 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
40494         LDKBlindedHopFeatures this_obj_conv;
40495         this_obj_conv.inner = untag_ptr(this_obj);
40496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40498         BlindedHopFeatures_free(this_obj_conv);
40499 }
40500
40501 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
40502         LDKChannelTypeFeatures this_obj_conv;
40503         this_obj_conv.inner = untag_ptr(this_obj);
40504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40506         ChannelTypeFeatures_free(this_obj_conv);
40507 }
40508
40509 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
40510         LDKInitFeatures ret_var = InitFeatures_empty();
40511         uint64_t ret_ref = 0;
40512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40514         return ret_ref;
40515 }
40516
40517 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
40518         LDKInitFeatures this_arg_conv;
40519         this_arg_conv.inner = untag_ptr(this_arg);
40520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40522         this_arg_conv.is_owned = false;
40523         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
40524         return ret_conv;
40525 }
40526
40527 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
40528         LDKNodeFeatures ret_var = NodeFeatures_empty();
40529         uint64_t ret_ref = 0;
40530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40532         return ret_ref;
40533 }
40534
40535 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
40536         LDKNodeFeatures this_arg_conv;
40537         this_arg_conv.inner = untag_ptr(this_arg);
40538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40540         this_arg_conv.is_owned = false;
40541         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
40542         return ret_conv;
40543 }
40544
40545 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
40546         LDKChannelFeatures ret_var = ChannelFeatures_empty();
40547         uint64_t ret_ref = 0;
40548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40550         return ret_ref;
40551 }
40552
40553 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
40554         LDKChannelFeatures this_arg_conv;
40555         this_arg_conv.inner = untag_ptr(this_arg);
40556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40558         this_arg_conv.is_owned = false;
40559         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
40560         return ret_conv;
40561 }
40562
40563 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
40564         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
40565         uint64_t ret_ref = 0;
40566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40568         return ret_ref;
40569 }
40570
40571 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40572         LDKInvoiceFeatures this_arg_conv;
40573         this_arg_conv.inner = untag_ptr(this_arg);
40574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40576         this_arg_conv.is_owned = false;
40577         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40578         return ret_conv;
40579 }
40580
40581 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
40582         LDKOfferFeatures ret_var = OfferFeatures_empty();
40583         uint64_t ret_ref = 0;
40584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40586         return ret_ref;
40587 }
40588
40589 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
40590         LDKOfferFeatures this_arg_conv;
40591         this_arg_conv.inner = untag_ptr(this_arg);
40592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40594         this_arg_conv.is_owned = false;
40595         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
40596         return ret_conv;
40597 }
40598
40599 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
40600         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
40601         uint64_t ret_ref = 0;
40602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40604         return ret_ref;
40605 }
40606
40607 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
40608         LDKInvoiceRequestFeatures this_arg_conv;
40609         this_arg_conv.inner = untag_ptr(this_arg);
40610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40612         this_arg_conv.is_owned = false;
40613         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
40614         return ret_conv;
40615 }
40616
40617 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
40618         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
40619         uint64_t ret_ref = 0;
40620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40622         return ret_ref;
40623 }
40624
40625 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40626         LDKBolt12InvoiceFeatures this_arg_conv;
40627         this_arg_conv.inner = untag_ptr(this_arg);
40628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40630         this_arg_conv.is_owned = false;
40631         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40632         return ret_conv;
40633 }
40634
40635 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
40636         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
40637         uint64_t ret_ref = 0;
40638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40640         return ret_ref;
40641 }
40642
40643 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
40644         LDKBlindedHopFeatures this_arg_conv;
40645         this_arg_conv.inner = untag_ptr(this_arg);
40646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40648         this_arg_conv.is_owned = false;
40649         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
40650         return ret_conv;
40651 }
40652
40653 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
40654         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
40655         uint64_t ret_ref = 0;
40656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40658         return ret_ref;
40659 }
40660
40661 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
40662         LDKChannelTypeFeatures this_arg_conv;
40663         this_arg_conv.inner = untag_ptr(this_arg);
40664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40666         this_arg_conv.is_owned = false;
40667         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
40668         return ret_conv;
40669 }
40670
40671 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
40672         LDKInitFeatures obj_conv;
40673         obj_conv.inner = untag_ptr(obj);
40674         obj_conv.is_owned = ptr_is_owned(obj);
40675         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40676         obj_conv.is_owned = false;
40677         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
40678         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40679         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40680         CVec_u8Z_free(ret_var);
40681         return ret_arr;
40682 }
40683
40684 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
40685         LDKu8slice ser_ref;
40686         ser_ref.datalen = ser->arr_len;
40687         ser_ref.data = ser->elems;
40688         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
40689         *ret_conv = InitFeatures_read(ser_ref);
40690         FREE(ser);
40691         return tag_ptr(ret_conv, true);
40692 }
40693
40694 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
40695         LDKChannelFeatures obj_conv;
40696         obj_conv.inner = untag_ptr(obj);
40697         obj_conv.is_owned = ptr_is_owned(obj);
40698         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40699         obj_conv.is_owned = false;
40700         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
40701         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40702         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40703         CVec_u8Z_free(ret_var);
40704         return ret_arr;
40705 }
40706
40707 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
40708         LDKu8slice ser_ref;
40709         ser_ref.datalen = ser->arr_len;
40710         ser_ref.data = ser->elems;
40711         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
40712         *ret_conv = ChannelFeatures_read(ser_ref);
40713         FREE(ser);
40714         return tag_ptr(ret_conv, true);
40715 }
40716
40717 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
40718         LDKNodeFeatures obj_conv;
40719         obj_conv.inner = untag_ptr(obj);
40720         obj_conv.is_owned = ptr_is_owned(obj);
40721         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40722         obj_conv.is_owned = false;
40723         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
40724         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40725         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40726         CVec_u8Z_free(ret_var);
40727         return ret_arr;
40728 }
40729
40730 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
40731         LDKu8slice ser_ref;
40732         ser_ref.datalen = ser->arr_len;
40733         ser_ref.data = ser->elems;
40734         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
40735         *ret_conv = NodeFeatures_read(ser_ref);
40736         FREE(ser);
40737         return tag_ptr(ret_conv, true);
40738 }
40739
40740 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
40741         LDKInvoiceFeatures obj_conv;
40742         obj_conv.inner = untag_ptr(obj);
40743         obj_conv.is_owned = ptr_is_owned(obj);
40744         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40745         obj_conv.is_owned = false;
40746         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
40747         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40748         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40749         CVec_u8Z_free(ret_var);
40750         return ret_arr;
40751 }
40752
40753 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
40754         LDKu8slice ser_ref;
40755         ser_ref.datalen = ser->arr_len;
40756         ser_ref.data = ser->elems;
40757         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
40758         *ret_conv = InvoiceFeatures_read(ser_ref);
40759         FREE(ser);
40760         return tag_ptr(ret_conv, true);
40761 }
40762
40763 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
40764         LDKBlindedHopFeatures obj_conv;
40765         obj_conv.inner = untag_ptr(obj);
40766         obj_conv.is_owned = ptr_is_owned(obj);
40767         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40768         obj_conv.is_owned = false;
40769         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
40770         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40771         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40772         CVec_u8Z_free(ret_var);
40773         return ret_arr;
40774 }
40775
40776 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
40777         LDKu8slice ser_ref;
40778         ser_ref.datalen = ser->arr_len;
40779         ser_ref.data = ser->elems;
40780         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
40781         *ret_conv = BlindedHopFeatures_read(ser_ref);
40782         FREE(ser);
40783         return tag_ptr(ret_conv, true);
40784 }
40785
40786 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
40787         LDKChannelTypeFeatures obj_conv;
40788         obj_conv.inner = untag_ptr(obj);
40789         obj_conv.is_owned = ptr_is_owned(obj);
40790         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40791         obj_conv.is_owned = false;
40792         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
40793         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40794         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40795         CVec_u8Z_free(ret_var);
40796         return ret_arr;
40797 }
40798
40799 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
40800         LDKu8slice ser_ref;
40801         ser_ref.datalen = ser->arr_len;
40802         ser_ref.data = ser->elems;
40803         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
40804         *ret_conv = ChannelTypeFeatures_read(ser_ref);
40805         FREE(ser);
40806         return tag_ptr(ret_conv, true);
40807 }
40808
40809 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40810         LDKInitFeatures this_arg_conv;
40811         this_arg_conv.inner = untag_ptr(this_arg);
40812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40814         this_arg_conv.is_owned = false;
40815         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
40816 }
40817
40818 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40819         LDKInitFeatures this_arg_conv;
40820         this_arg_conv.inner = untag_ptr(this_arg);
40821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40823         this_arg_conv.is_owned = false;
40824         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
40825 }
40826
40827 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
40828         LDKInitFeatures this_arg_conv;
40829         this_arg_conv.inner = untag_ptr(this_arg);
40830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40832         this_arg_conv.is_owned = false;
40833         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
40834         return ret_conv;
40835 }
40836
40837 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40838         LDKNodeFeatures this_arg_conv;
40839         this_arg_conv.inner = untag_ptr(this_arg);
40840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40842         this_arg_conv.is_owned = false;
40843         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
40844 }
40845
40846 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40847         LDKNodeFeatures this_arg_conv;
40848         this_arg_conv.inner = untag_ptr(this_arg);
40849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40851         this_arg_conv.is_owned = false;
40852         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
40853 }
40854
40855 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
40856         LDKNodeFeatures this_arg_conv;
40857         this_arg_conv.inner = untag_ptr(this_arg);
40858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40860         this_arg_conv.is_owned = false;
40861         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
40862         return ret_conv;
40863 }
40864
40865 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
40866         LDKInitFeatures this_arg_conv;
40867         this_arg_conv.inner = untag_ptr(this_arg);
40868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40870         this_arg_conv.is_owned = false;
40871         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
40872         return ret_conv;
40873 }
40874
40875 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
40876         LDKNodeFeatures this_arg_conv;
40877         this_arg_conv.inner = untag_ptr(this_arg);
40878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40880         this_arg_conv.is_owned = false;
40881         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
40882         return ret_conv;
40883 }
40884
40885 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
40886         LDKInitFeatures this_arg_conv;
40887         this_arg_conv.inner = untag_ptr(this_arg);
40888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40890         this_arg_conv.is_owned = false;
40891         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40892 }
40893
40894 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
40895         LDKInitFeatures this_arg_conv;
40896         this_arg_conv.inner = untag_ptr(this_arg);
40897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40899         this_arg_conv.is_owned = false;
40900         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40901 }
40902
40903 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
40904         LDKInitFeatures this_arg_conv;
40905         this_arg_conv.inner = untag_ptr(this_arg);
40906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40908         this_arg_conv.is_owned = false;
40909         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40910         return ret_conv;
40911 }
40912
40913 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40914         LDKInitFeatures this_arg_conv;
40915         this_arg_conv.inner = untag_ptr(this_arg);
40916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40918         this_arg_conv.is_owned = false;
40919         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40920 }
40921
40922 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40923         LDKInitFeatures this_arg_conv;
40924         this_arg_conv.inner = untag_ptr(this_arg);
40925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40927         this_arg_conv.is_owned = false;
40928         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40929 }
40930
40931 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40932         LDKInitFeatures this_arg_conv;
40933         this_arg_conv.inner = untag_ptr(this_arg);
40934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40936         this_arg_conv.is_owned = false;
40937         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40938         return ret_conv;
40939 }
40940
40941 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40942         LDKNodeFeatures this_arg_conv;
40943         this_arg_conv.inner = untag_ptr(this_arg);
40944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40946         this_arg_conv.is_owned = false;
40947         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40948 }
40949
40950 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40951         LDKNodeFeatures this_arg_conv;
40952         this_arg_conv.inner = untag_ptr(this_arg);
40953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40955         this_arg_conv.is_owned = false;
40956         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40957 }
40958
40959 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40960         LDKNodeFeatures this_arg_conv;
40961         this_arg_conv.inner = untag_ptr(this_arg);
40962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40964         this_arg_conv.is_owned = false;
40965         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40966         return ret_conv;
40967 }
40968
40969 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
40970         LDKInitFeatures this_arg_conv;
40971         this_arg_conv.inner = untag_ptr(this_arg);
40972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40974         this_arg_conv.is_owned = false;
40975         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40976         return ret_conv;
40977 }
40978
40979 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
40980         LDKNodeFeatures this_arg_conv;
40981         this_arg_conv.inner = untag_ptr(this_arg);
40982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40984         this_arg_conv.is_owned = false;
40985         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40986         return ret_conv;
40987 }
40988
40989 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
40990         LDKInitFeatures this_arg_conv;
40991         this_arg_conv.inner = untag_ptr(this_arg);
40992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40994         this_arg_conv.is_owned = false;
40995         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
40996 }
40997
40998 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
40999         LDKInitFeatures this_arg_conv;
41000         this_arg_conv.inner = untag_ptr(this_arg);
41001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41003         this_arg_conv.is_owned = false;
41004         InitFeatures_set_gossip_queries_required(&this_arg_conv);
41005 }
41006
41007 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
41008         LDKInitFeatures this_arg_conv;
41009         this_arg_conv.inner = untag_ptr(this_arg);
41010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41012         this_arg_conv.is_owned = false;
41013         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
41014         return ret_conv;
41015 }
41016
41017 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41018         LDKNodeFeatures this_arg_conv;
41019         this_arg_conv.inner = untag_ptr(this_arg);
41020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41022         this_arg_conv.is_owned = false;
41023         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
41024 }
41025
41026 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
41027         LDKNodeFeatures this_arg_conv;
41028         this_arg_conv.inner = untag_ptr(this_arg);
41029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41031         this_arg_conv.is_owned = false;
41032         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
41033 }
41034
41035 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
41036         LDKNodeFeatures this_arg_conv;
41037         this_arg_conv.inner = untag_ptr(this_arg);
41038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41040         this_arg_conv.is_owned = false;
41041         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
41042         return ret_conv;
41043 }
41044
41045 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
41046         LDKInitFeatures this_arg_conv;
41047         this_arg_conv.inner = untag_ptr(this_arg);
41048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41050         this_arg_conv.is_owned = false;
41051         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
41052         return ret_conv;
41053 }
41054
41055 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
41056         LDKNodeFeatures this_arg_conv;
41057         this_arg_conv.inner = untag_ptr(this_arg);
41058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41060         this_arg_conv.is_owned = false;
41061         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
41062         return ret_conv;
41063 }
41064
41065 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41066         LDKInitFeatures this_arg_conv;
41067         this_arg_conv.inner = untag_ptr(this_arg);
41068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41070         this_arg_conv.is_owned = false;
41071         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
41072 }
41073
41074 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41075         LDKInitFeatures this_arg_conv;
41076         this_arg_conv.inner = untag_ptr(this_arg);
41077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41079         this_arg_conv.is_owned = false;
41080         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
41081 }
41082
41083 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
41084         LDKInitFeatures this_arg_conv;
41085         this_arg_conv.inner = untag_ptr(this_arg);
41086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41088         this_arg_conv.is_owned = false;
41089         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
41090         return ret_conv;
41091 }
41092
41093 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41094         LDKNodeFeatures this_arg_conv;
41095         this_arg_conv.inner = untag_ptr(this_arg);
41096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41098         this_arg_conv.is_owned = false;
41099         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
41100 }
41101
41102 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41103         LDKNodeFeatures this_arg_conv;
41104         this_arg_conv.inner = untag_ptr(this_arg);
41105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41107         this_arg_conv.is_owned = false;
41108         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
41109 }
41110
41111 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
41112         LDKNodeFeatures this_arg_conv;
41113         this_arg_conv.inner = untag_ptr(this_arg);
41114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41116         this_arg_conv.is_owned = false;
41117         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
41118         return ret_conv;
41119 }
41120
41121 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41122         LDKInvoiceFeatures this_arg_conv;
41123         this_arg_conv.inner = untag_ptr(this_arg);
41124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41126         this_arg_conv.is_owned = false;
41127         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
41128 }
41129
41130 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41131         LDKInvoiceFeatures this_arg_conv;
41132         this_arg_conv.inner = untag_ptr(this_arg);
41133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41135         this_arg_conv.is_owned = false;
41136         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
41137 }
41138
41139 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
41140         LDKInvoiceFeatures this_arg_conv;
41141         this_arg_conv.inner = untag_ptr(this_arg);
41142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41144         this_arg_conv.is_owned = false;
41145         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
41146         return ret_conv;
41147 }
41148
41149 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
41150         LDKInitFeatures this_arg_conv;
41151         this_arg_conv.inner = untag_ptr(this_arg);
41152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41154         this_arg_conv.is_owned = false;
41155         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
41156         return ret_conv;
41157 }
41158
41159 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
41160         LDKNodeFeatures this_arg_conv;
41161         this_arg_conv.inner = untag_ptr(this_arg);
41162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41164         this_arg_conv.is_owned = false;
41165         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
41166         return ret_conv;
41167 }
41168
41169 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
41170         LDKInvoiceFeatures this_arg_conv;
41171         this_arg_conv.inner = untag_ptr(this_arg);
41172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41174         this_arg_conv.is_owned = false;
41175         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
41176         return ret_conv;
41177 }
41178
41179 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41180         LDKInitFeatures this_arg_conv;
41181         this_arg_conv.inner = untag_ptr(this_arg);
41182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41184         this_arg_conv.is_owned = false;
41185         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
41186 }
41187
41188 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
41189         LDKInitFeatures this_arg_conv;
41190         this_arg_conv.inner = untag_ptr(this_arg);
41191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41193         this_arg_conv.is_owned = false;
41194         InitFeatures_set_static_remote_key_required(&this_arg_conv);
41195 }
41196
41197 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
41198         LDKInitFeatures this_arg_conv;
41199         this_arg_conv.inner = untag_ptr(this_arg);
41200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41202         this_arg_conv.is_owned = false;
41203         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
41204         return ret_conv;
41205 }
41206
41207 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41208         LDKNodeFeatures this_arg_conv;
41209         this_arg_conv.inner = untag_ptr(this_arg);
41210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41212         this_arg_conv.is_owned = false;
41213         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
41214 }
41215
41216 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41217         LDKNodeFeatures this_arg_conv;
41218         this_arg_conv.inner = untag_ptr(this_arg);
41219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41221         this_arg_conv.is_owned = false;
41222         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
41223 }
41224
41225 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
41226         LDKNodeFeatures this_arg_conv;
41227         this_arg_conv.inner = untag_ptr(this_arg);
41228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41230         this_arg_conv.is_owned = false;
41231         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
41232         return ret_conv;
41233 }
41234
41235 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41236         LDKChannelTypeFeatures this_arg_conv;
41237         this_arg_conv.inner = untag_ptr(this_arg);
41238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41240         this_arg_conv.is_owned = false;
41241         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
41242 }
41243
41244 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41245         LDKChannelTypeFeatures this_arg_conv;
41246         this_arg_conv.inner = untag_ptr(this_arg);
41247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41249         this_arg_conv.is_owned = false;
41250         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
41251 }
41252
41253 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
41254         LDKChannelTypeFeatures this_arg_conv;
41255         this_arg_conv.inner = untag_ptr(this_arg);
41256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41258         this_arg_conv.is_owned = false;
41259         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
41260         return ret_conv;
41261 }
41262
41263 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
41264         LDKInitFeatures this_arg_conv;
41265         this_arg_conv.inner = untag_ptr(this_arg);
41266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41268         this_arg_conv.is_owned = false;
41269         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
41270         return ret_conv;
41271 }
41272
41273 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
41274         LDKNodeFeatures this_arg_conv;
41275         this_arg_conv.inner = untag_ptr(this_arg);
41276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41278         this_arg_conv.is_owned = false;
41279         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
41280         return ret_conv;
41281 }
41282
41283 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
41284         LDKChannelTypeFeatures this_arg_conv;
41285         this_arg_conv.inner = untag_ptr(this_arg);
41286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41288         this_arg_conv.is_owned = false;
41289         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
41290         return ret_conv;
41291 }
41292
41293 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
41294         LDKInitFeatures this_arg_conv;
41295         this_arg_conv.inner = untag_ptr(this_arg);
41296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41298         this_arg_conv.is_owned = false;
41299         InitFeatures_set_payment_secret_optional(&this_arg_conv);
41300 }
41301
41302 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
41303         LDKInitFeatures this_arg_conv;
41304         this_arg_conv.inner = untag_ptr(this_arg);
41305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41307         this_arg_conv.is_owned = false;
41308         InitFeatures_set_payment_secret_required(&this_arg_conv);
41309 }
41310
41311 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
41312         LDKInitFeatures this_arg_conv;
41313         this_arg_conv.inner = untag_ptr(this_arg);
41314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41316         this_arg_conv.is_owned = false;
41317         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
41318         return ret_conv;
41319 }
41320
41321 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
41322         LDKNodeFeatures this_arg_conv;
41323         this_arg_conv.inner = untag_ptr(this_arg);
41324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41326         this_arg_conv.is_owned = false;
41327         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
41328 }
41329
41330 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
41331         LDKNodeFeatures this_arg_conv;
41332         this_arg_conv.inner = untag_ptr(this_arg);
41333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41335         this_arg_conv.is_owned = false;
41336         NodeFeatures_set_payment_secret_required(&this_arg_conv);
41337 }
41338
41339 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
41340         LDKNodeFeatures this_arg_conv;
41341         this_arg_conv.inner = untag_ptr(this_arg);
41342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41344         this_arg_conv.is_owned = false;
41345         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
41346         return ret_conv;
41347 }
41348
41349 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
41350         LDKInvoiceFeatures this_arg_conv;
41351         this_arg_conv.inner = untag_ptr(this_arg);
41352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41354         this_arg_conv.is_owned = false;
41355         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
41356 }
41357
41358 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
41359         LDKInvoiceFeatures this_arg_conv;
41360         this_arg_conv.inner = untag_ptr(this_arg);
41361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41363         this_arg_conv.is_owned = false;
41364         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
41365 }
41366
41367 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
41368         LDKInvoiceFeatures this_arg_conv;
41369         this_arg_conv.inner = untag_ptr(this_arg);
41370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41372         this_arg_conv.is_owned = false;
41373         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
41374         return ret_conv;
41375 }
41376
41377 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
41378         LDKInitFeatures this_arg_conv;
41379         this_arg_conv.inner = untag_ptr(this_arg);
41380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41382         this_arg_conv.is_owned = false;
41383         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
41384         return ret_conv;
41385 }
41386
41387 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
41388         LDKNodeFeatures this_arg_conv;
41389         this_arg_conv.inner = untag_ptr(this_arg);
41390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41392         this_arg_conv.is_owned = false;
41393         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
41394         return ret_conv;
41395 }
41396
41397 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
41398         LDKInvoiceFeatures this_arg_conv;
41399         this_arg_conv.inner = untag_ptr(this_arg);
41400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41402         this_arg_conv.is_owned = false;
41403         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
41404         return ret_conv;
41405 }
41406
41407 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41408         LDKInitFeatures this_arg_conv;
41409         this_arg_conv.inner = untag_ptr(this_arg);
41410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41412         this_arg_conv.is_owned = false;
41413         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
41414 }
41415
41416 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
41417         LDKInitFeatures this_arg_conv;
41418         this_arg_conv.inner = untag_ptr(this_arg);
41419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41421         this_arg_conv.is_owned = false;
41422         InitFeatures_set_basic_mpp_required(&this_arg_conv);
41423 }
41424
41425 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
41426         LDKInitFeatures this_arg_conv;
41427         this_arg_conv.inner = untag_ptr(this_arg);
41428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41430         this_arg_conv.is_owned = false;
41431         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
41432         return ret_conv;
41433 }
41434
41435 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41436         LDKNodeFeatures this_arg_conv;
41437         this_arg_conv.inner = untag_ptr(this_arg);
41438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41440         this_arg_conv.is_owned = false;
41441         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
41442 }
41443
41444 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
41445         LDKNodeFeatures this_arg_conv;
41446         this_arg_conv.inner = untag_ptr(this_arg);
41447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41449         this_arg_conv.is_owned = false;
41450         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
41451 }
41452
41453 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
41454         LDKNodeFeatures this_arg_conv;
41455         this_arg_conv.inner = untag_ptr(this_arg);
41456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41458         this_arg_conv.is_owned = false;
41459         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
41460         return ret_conv;
41461 }
41462
41463 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41464         LDKInvoiceFeatures this_arg_conv;
41465         this_arg_conv.inner = untag_ptr(this_arg);
41466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41468         this_arg_conv.is_owned = false;
41469         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41470 }
41471
41472 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41473         LDKInvoiceFeatures this_arg_conv;
41474         this_arg_conv.inner = untag_ptr(this_arg);
41475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41477         this_arg_conv.is_owned = false;
41478         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41479 }
41480
41481 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41482         LDKInvoiceFeatures this_arg_conv;
41483         this_arg_conv.inner = untag_ptr(this_arg);
41484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41486         this_arg_conv.is_owned = false;
41487         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41488         return ret_conv;
41489 }
41490
41491 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41492         LDKBolt12InvoiceFeatures this_arg_conv;
41493         this_arg_conv.inner = untag_ptr(this_arg);
41494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41496         this_arg_conv.is_owned = false;
41497         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41498 }
41499
41500 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41501         LDKBolt12InvoiceFeatures this_arg_conv;
41502         this_arg_conv.inner = untag_ptr(this_arg);
41503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41505         this_arg_conv.is_owned = false;
41506         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41507 }
41508
41509 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41510         LDKBolt12InvoiceFeatures this_arg_conv;
41511         this_arg_conv.inner = untag_ptr(this_arg);
41512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41514         this_arg_conv.is_owned = false;
41515         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41516         return ret_conv;
41517 }
41518
41519 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
41520         LDKInitFeatures this_arg_conv;
41521         this_arg_conv.inner = untag_ptr(this_arg);
41522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41524         this_arg_conv.is_owned = false;
41525         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
41526         return ret_conv;
41527 }
41528
41529 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
41530         LDKNodeFeatures this_arg_conv;
41531         this_arg_conv.inner = untag_ptr(this_arg);
41532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41534         this_arg_conv.is_owned = false;
41535         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
41536         return ret_conv;
41537 }
41538
41539 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41540         LDKInvoiceFeatures this_arg_conv;
41541         this_arg_conv.inner = untag_ptr(this_arg);
41542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41544         this_arg_conv.is_owned = false;
41545         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41546         return ret_conv;
41547 }
41548
41549 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41550         LDKBolt12InvoiceFeatures this_arg_conv;
41551         this_arg_conv.inner = untag_ptr(this_arg);
41552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41554         this_arg_conv.is_owned = false;
41555         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41556         return ret_conv;
41557 }
41558
41559 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
41560         LDKInitFeatures this_arg_conv;
41561         this_arg_conv.inner = untag_ptr(this_arg);
41562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41564         this_arg_conv.is_owned = false;
41565         InitFeatures_set_wumbo_optional(&this_arg_conv);
41566 }
41567
41568 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
41569         LDKInitFeatures this_arg_conv;
41570         this_arg_conv.inner = untag_ptr(this_arg);
41571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41573         this_arg_conv.is_owned = false;
41574         InitFeatures_set_wumbo_required(&this_arg_conv);
41575 }
41576
41577 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
41578         LDKInitFeatures this_arg_conv;
41579         this_arg_conv.inner = untag_ptr(this_arg);
41580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41582         this_arg_conv.is_owned = false;
41583         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
41584         return ret_conv;
41585 }
41586
41587 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
41588         LDKNodeFeatures this_arg_conv;
41589         this_arg_conv.inner = untag_ptr(this_arg);
41590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41592         this_arg_conv.is_owned = false;
41593         NodeFeatures_set_wumbo_optional(&this_arg_conv);
41594 }
41595
41596 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
41597         LDKNodeFeatures this_arg_conv;
41598         this_arg_conv.inner = untag_ptr(this_arg);
41599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41601         this_arg_conv.is_owned = false;
41602         NodeFeatures_set_wumbo_required(&this_arg_conv);
41603 }
41604
41605 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
41606         LDKNodeFeatures this_arg_conv;
41607         this_arg_conv.inner = untag_ptr(this_arg);
41608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41610         this_arg_conv.is_owned = false;
41611         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
41612         return ret_conv;
41613 }
41614
41615 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
41616         LDKInitFeatures this_arg_conv;
41617         this_arg_conv.inner = untag_ptr(this_arg);
41618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41620         this_arg_conv.is_owned = false;
41621         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
41622         return ret_conv;
41623 }
41624
41625 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
41626         LDKNodeFeatures this_arg_conv;
41627         this_arg_conv.inner = untag_ptr(this_arg);
41628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41630         this_arg_conv.is_owned = false;
41631         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
41632         return ret_conv;
41633 }
41634
41635 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) {
41636         LDKInitFeatures this_arg_conv;
41637         this_arg_conv.inner = untag_ptr(this_arg);
41638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41640         this_arg_conv.is_owned = false;
41641         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41642 }
41643
41644 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) {
41645         LDKInitFeatures this_arg_conv;
41646         this_arg_conv.inner = untag_ptr(this_arg);
41647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41649         this_arg_conv.is_owned = false;
41650         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41651 }
41652
41653 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41654         LDKInitFeatures this_arg_conv;
41655         this_arg_conv.inner = untag_ptr(this_arg);
41656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41658         this_arg_conv.is_owned = false;
41659         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41660         return ret_conv;
41661 }
41662
41663 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) {
41664         LDKNodeFeatures this_arg_conv;
41665         this_arg_conv.inner = untag_ptr(this_arg);
41666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41668         this_arg_conv.is_owned = false;
41669         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41670 }
41671
41672 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) {
41673         LDKNodeFeatures this_arg_conv;
41674         this_arg_conv.inner = untag_ptr(this_arg);
41675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41677         this_arg_conv.is_owned = false;
41678         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41679 }
41680
41681 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41682         LDKNodeFeatures this_arg_conv;
41683         this_arg_conv.inner = untag_ptr(this_arg);
41684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41686         this_arg_conv.is_owned = false;
41687         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41688         return ret_conv;
41689 }
41690
41691 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) {
41692         LDKChannelTypeFeatures this_arg_conv;
41693         this_arg_conv.inner = untag_ptr(this_arg);
41694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41696         this_arg_conv.is_owned = false;
41697         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41698 }
41699
41700 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) {
41701         LDKChannelTypeFeatures this_arg_conv;
41702         this_arg_conv.inner = untag_ptr(this_arg);
41703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41705         this_arg_conv.is_owned = false;
41706         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41707 }
41708
41709 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41710         LDKChannelTypeFeatures this_arg_conv;
41711         this_arg_conv.inner = untag_ptr(this_arg);
41712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41714         this_arg_conv.is_owned = false;
41715         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41716         return ret_conv;
41717 }
41718
41719 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41720         LDKInitFeatures this_arg_conv;
41721         this_arg_conv.inner = untag_ptr(this_arg);
41722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41724         this_arg_conv.is_owned = false;
41725         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41726         return ret_conv;
41727 }
41728
41729 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41730         LDKNodeFeatures this_arg_conv;
41731         this_arg_conv.inner = untag_ptr(this_arg);
41732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41734         this_arg_conv.is_owned = false;
41735         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41736         return ret_conv;
41737 }
41738
41739 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41740         LDKChannelTypeFeatures this_arg_conv;
41741         this_arg_conv.inner = untag_ptr(this_arg);
41742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41744         this_arg_conv.is_owned = false;
41745         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41746         return ret_conv;
41747 }
41748
41749 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41750         LDKInitFeatures this_arg_conv;
41751         this_arg_conv.inner = untag_ptr(this_arg);
41752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41754         this_arg_conv.is_owned = false;
41755         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41756 }
41757
41758 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41759         LDKInitFeatures this_arg_conv;
41760         this_arg_conv.inner = untag_ptr(this_arg);
41761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41763         this_arg_conv.is_owned = false;
41764         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41765 }
41766
41767 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41768         LDKInitFeatures this_arg_conv;
41769         this_arg_conv.inner = untag_ptr(this_arg);
41770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41772         this_arg_conv.is_owned = false;
41773         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41774         return ret_conv;
41775 }
41776
41777 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41778         LDKNodeFeatures this_arg_conv;
41779         this_arg_conv.inner = untag_ptr(this_arg);
41780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41782         this_arg_conv.is_owned = false;
41783         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41784 }
41785
41786 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41787         LDKNodeFeatures this_arg_conv;
41788         this_arg_conv.inner = untag_ptr(this_arg);
41789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41791         this_arg_conv.is_owned = false;
41792         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41793 }
41794
41795 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41796         LDKNodeFeatures this_arg_conv;
41797         this_arg_conv.inner = untag_ptr(this_arg);
41798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41800         this_arg_conv.is_owned = false;
41801         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41802         return ret_conv;
41803 }
41804
41805 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41806         LDKInitFeatures this_arg_conv;
41807         this_arg_conv.inner = untag_ptr(this_arg);
41808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41810         this_arg_conv.is_owned = false;
41811         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41812         return ret_conv;
41813 }
41814
41815 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41816         LDKNodeFeatures this_arg_conv;
41817         this_arg_conv.inner = untag_ptr(this_arg);
41818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41820         this_arg_conv.is_owned = false;
41821         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41822         return ret_conv;
41823 }
41824
41825 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
41826         LDKInitFeatures this_arg_conv;
41827         this_arg_conv.inner = untag_ptr(this_arg);
41828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41830         this_arg_conv.is_owned = false;
41831         InitFeatures_set_onion_messages_optional(&this_arg_conv);
41832 }
41833
41834 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
41835         LDKInitFeatures this_arg_conv;
41836         this_arg_conv.inner = untag_ptr(this_arg);
41837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41839         this_arg_conv.is_owned = false;
41840         InitFeatures_set_onion_messages_required(&this_arg_conv);
41841 }
41842
41843 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
41844         LDKInitFeatures this_arg_conv;
41845         this_arg_conv.inner = untag_ptr(this_arg);
41846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41848         this_arg_conv.is_owned = false;
41849         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
41850         return ret_conv;
41851 }
41852
41853 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
41854         LDKNodeFeatures this_arg_conv;
41855         this_arg_conv.inner = untag_ptr(this_arg);
41856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41858         this_arg_conv.is_owned = false;
41859         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
41860 }
41861
41862 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
41863         LDKNodeFeatures this_arg_conv;
41864         this_arg_conv.inner = untag_ptr(this_arg);
41865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41867         this_arg_conv.is_owned = false;
41868         NodeFeatures_set_onion_messages_required(&this_arg_conv);
41869 }
41870
41871 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
41872         LDKNodeFeatures this_arg_conv;
41873         this_arg_conv.inner = untag_ptr(this_arg);
41874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41876         this_arg_conv.is_owned = false;
41877         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
41878         return ret_conv;
41879 }
41880
41881 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
41882         LDKInitFeatures this_arg_conv;
41883         this_arg_conv.inner = untag_ptr(this_arg);
41884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41886         this_arg_conv.is_owned = false;
41887         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
41888         return ret_conv;
41889 }
41890
41891 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
41892         LDKNodeFeatures this_arg_conv;
41893         this_arg_conv.inner = untag_ptr(this_arg);
41894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41896         this_arg_conv.is_owned = false;
41897         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
41898         return ret_conv;
41899 }
41900
41901 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
41902         LDKInitFeatures this_arg_conv;
41903         this_arg_conv.inner = untag_ptr(this_arg);
41904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41906         this_arg_conv.is_owned = false;
41907         InitFeatures_set_channel_type_optional(&this_arg_conv);
41908 }
41909
41910 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
41911         LDKInitFeatures this_arg_conv;
41912         this_arg_conv.inner = untag_ptr(this_arg);
41913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41915         this_arg_conv.is_owned = false;
41916         InitFeatures_set_channel_type_required(&this_arg_conv);
41917 }
41918
41919 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
41920         LDKInitFeatures this_arg_conv;
41921         this_arg_conv.inner = untag_ptr(this_arg);
41922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41924         this_arg_conv.is_owned = false;
41925         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
41926         return ret_conv;
41927 }
41928
41929 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
41930         LDKNodeFeatures this_arg_conv;
41931         this_arg_conv.inner = untag_ptr(this_arg);
41932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41934         this_arg_conv.is_owned = false;
41935         NodeFeatures_set_channel_type_optional(&this_arg_conv);
41936 }
41937
41938 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
41939         LDKNodeFeatures this_arg_conv;
41940         this_arg_conv.inner = untag_ptr(this_arg);
41941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41943         this_arg_conv.is_owned = false;
41944         NodeFeatures_set_channel_type_required(&this_arg_conv);
41945 }
41946
41947 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
41948         LDKNodeFeatures this_arg_conv;
41949         this_arg_conv.inner = untag_ptr(this_arg);
41950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41952         this_arg_conv.is_owned = false;
41953         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
41954         return ret_conv;
41955 }
41956
41957 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
41958         LDKInitFeatures this_arg_conv;
41959         this_arg_conv.inner = untag_ptr(this_arg);
41960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41962         this_arg_conv.is_owned = false;
41963         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
41964         return ret_conv;
41965 }
41966
41967 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
41968         LDKNodeFeatures this_arg_conv;
41969         this_arg_conv.inner = untag_ptr(this_arg);
41970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41972         this_arg_conv.is_owned = false;
41973         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
41974         return ret_conv;
41975 }
41976
41977 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
41978         LDKInitFeatures this_arg_conv;
41979         this_arg_conv.inner = untag_ptr(this_arg);
41980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41982         this_arg_conv.is_owned = false;
41983         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
41984 }
41985
41986 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
41987         LDKInitFeatures this_arg_conv;
41988         this_arg_conv.inner = untag_ptr(this_arg);
41989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41991         this_arg_conv.is_owned = false;
41992         InitFeatures_set_scid_privacy_required(&this_arg_conv);
41993 }
41994
41995 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
41996         LDKInitFeatures this_arg_conv;
41997         this_arg_conv.inner = untag_ptr(this_arg);
41998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42000         this_arg_conv.is_owned = false;
42001         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
42002         return ret_conv;
42003 }
42004
42005 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42006         LDKNodeFeatures this_arg_conv;
42007         this_arg_conv.inner = untag_ptr(this_arg);
42008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42010         this_arg_conv.is_owned = false;
42011         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
42012 }
42013
42014 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42015         LDKNodeFeatures this_arg_conv;
42016         this_arg_conv.inner = untag_ptr(this_arg);
42017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42019         this_arg_conv.is_owned = false;
42020         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
42021 }
42022
42023 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
42024         LDKNodeFeatures this_arg_conv;
42025         this_arg_conv.inner = untag_ptr(this_arg);
42026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42028         this_arg_conv.is_owned = false;
42029         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
42030         return ret_conv;
42031 }
42032
42033 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42034         LDKChannelTypeFeatures this_arg_conv;
42035         this_arg_conv.inner = untag_ptr(this_arg);
42036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42038         this_arg_conv.is_owned = false;
42039         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
42040 }
42041
42042 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42043         LDKChannelTypeFeatures this_arg_conv;
42044         this_arg_conv.inner = untag_ptr(this_arg);
42045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42047         this_arg_conv.is_owned = false;
42048         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
42049 }
42050
42051 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
42052         LDKChannelTypeFeatures this_arg_conv;
42053         this_arg_conv.inner = untag_ptr(this_arg);
42054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42056         this_arg_conv.is_owned = false;
42057         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
42058         return ret_conv;
42059 }
42060
42061 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
42062         LDKInitFeatures this_arg_conv;
42063         this_arg_conv.inner = untag_ptr(this_arg);
42064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42066         this_arg_conv.is_owned = false;
42067         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
42068         return ret_conv;
42069 }
42070
42071 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
42072         LDKNodeFeatures this_arg_conv;
42073         this_arg_conv.inner = untag_ptr(this_arg);
42074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42076         this_arg_conv.is_owned = false;
42077         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
42078         return ret_conv;
42079 }
42080
42081 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
42082         LDKChannelTypeFeatures this_arg_conv;
42083         this_arg_conv.inner = untag_ptr(this_arg);
42084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42086         this_arg_conv.is_owned = false;
42087         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
42088         return ret_conv;
42089 }
42090
42091 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_metadata_optional"))) TS_InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
42092         LDKInvoiceFeatures this_arg_conv;
42093         this_arg_conv.inner = untag_ptr(this_arg);
42094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42096         this_arg_conv.is_owned = false;
42097         InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
42098 }
42099
42100 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_metadata_required"))) TS_InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
42101         LDKInvoiceFeatures this_arg_conv;
42102         this_arg_conv.inner = untag_ptr(this_arg);
42103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42105         this_arg_conv.is_owned = false;
42106         InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
42107 }
42108
42109 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_metadata"))) TS_InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
42110         LDKInvoiceFeatures this_arg_conv;
42111         this_arg_conv.inner = untag_ptr(this_arg);
42112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42114         this_arg_conv.is_owned = false;
42115         jboolean ret_conv = InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
42116         return ret_conv;
42117 }
42118
42119 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_metadata"))) TS_InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
42120         LDKInvoiceFeatures this_arg_conv;
42121         this_arg_conv.inner = untag_ptr(this_arg);
42122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42124         this_arg_conv.is_owned = false;
42125         jboolean ret_conv = InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
42126         return ret_conv;
42127 }
42128
42129 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
42130         LDKInitFeatures this_arg_conv;
42131         this_arg_conv.inner = untag_ptr(this_arg);
42132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42134         this_arg_conv.is_owned = false;
42135         InitFeatures_set_zero_conf_optional(&this_arg_conv);
42136 }
42137
42138 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
42139         LDKInitFeatures this_arg_conv;
42140         this_arg_conv.inner = untag_ptr(this_arg);
42141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42143         this_arg_conv.is_owned = false;
42144         InitFeatures_set_zero_conf_required(&this_arg_conv);
42145 }
42146
42147 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
42148         LDKInitFeatures this_arg_conv;
42149         this_arg_conv.inner = untag_ptr(this_arg);
42150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42152         this_arg_conv.is_owned = false;
42153         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
42154         return ret_conv;
42155 }
42156
42157 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42158         LDKNodeFeatures this_arg_conv;
42159         this_arg_conv.inner = untag_ptr(this_arg);
42160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42162         this_arg_conv.is_owned = false;
42163         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
42164 }
42165
42166 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
42167         LDKNodeFeatures this_arg_conv;
42168         this_arg_conv.inner = untag_ptr(this_arg);
42169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42171         this_arg_conv.is_owned = false;
42172         NodeFeatures_set_zero_conf_required(&this_arg_conv);
42173 }
42174
42175 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
42176         LDKNodeFeatures this_arg_conv;
42177         this_arg_conv.inner = untag_ptr(this_arg);
42178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42180         this_arg_conv.is_owned = false;
42181         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
42182         return ret_conv;
42183 }
42184
42185 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42186         LDKChannelTypeFeatures this_arg_conv;
42187         this_arg_conv.inner = untag_ptr(this_arg);
42188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42190         this_arg_conv.is_owned = false;
42191         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
42192 }
42193
42194 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
42195         LDKChannelTypeFeatures this_arg_conv;
42196         this_arg_conv.inner = untag_ptr(this_arg);
42197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42199         this_arg_conv.is_owned = false;
42200         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
42201 }
42202
42203 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
42204         LDKChannelTypeFeatures this_arg_conv;
42205         this_arg_conv.inner = untag_ptr(this_arg);
42206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42208         this_arg_conv.is_owned = false;
42209         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
42210         return ret_conv;
42211 }
42212
42213 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
42214         LDKInitFeatures this_arg_conv;
42215         this_arg_conv.inner = untag_ptr(this_arg);
42216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42218         this_arg_conv.is_owned = false;
42219         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
42220         return ret_conv;
42221 }
42222
42223 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
42224         LDKNodeFeatures this_arg_conv;
42225         this_arg_conv.inner = untag_ptr(this_arg);
42226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42228         this_arg_conv.is_owned = false;
42229         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
42230         return ret_conv;
42231 }
42232
42233 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
42234         LDKChannelTypeFeatures this_arg_conv;
42235         this_arg_conv.inner = untag_ptr(this_arg);
42236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42238         this_arg_conv.is_owned = false;
42239         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
42240         return ret_conv;
42241 }
42242
42243 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
42244         LDKNodeFeatures this_arg_conv;
42245         this_arg_conv.inner = untag_ptr(this_arg);
42246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42248         this_arg_conv.is_owned = false;
42249         NodeFeatures_set_keysend_optional(&this_arg_conv);
42250 }
42251
42252 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
42253         LDKNodeFeatures this_arg_conv;
42254         this_arg_conv.inner = untag_ptr(this_arg);
42255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42257         this_arg_conv.is_owned = false;
42258         NodeFeatures_set_keysend_required(&this_arg_conv);
42259 }
42260
42261 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
42262         LDKNodeFeatures this_arg_conv;
42263         this_arg_conv.inner = untag_ptr(this_arg);
42264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42266         this_arg_conv.is_owned = false;
42267         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
42268         return ret_conv;
42269 }
42270
42271 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
42272         LDKNodeFeatures this_arg_conv;
42273         this_arg_conv.inner = untag_ptr(this_arg);
42274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42276         this_arg_conv.is_owned = false;
42277         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
42278         return ret_conv;
42279 }
42280
42281 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
42282         LDKShutdownScript this_obj_conv;
42283         this_obj_conv.inner = untag_ptr(this_obj);
42284         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42286         ShutdownScript_free(this_obj_conv);
42287 }
42288
42289 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
42290         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
42291         uint64_t ret_ref = 0;
42292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42294         return ret_ref;
42295 }
42296 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
42297         LDKShutdownScript arg_conv;
42298         arg_conv.inner = untag_ptr(arg);
42299         arg_conv.is_owned = ptr_is_owned(arg);
42300         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42301         arg_conv.is_owned = false;
42302         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
42303         return ret_conv;
42304 }
42305
42306 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
42307         LDKShutdownScript orig_conv;
42308         orig_conv.inner = untag_ptr(orig);
42309         orig_conv.is_owned = ptr_is_owned(orig);
42310         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42311         orig_conv.is_owned = false;
42312         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
42313         uint64_t ret_ref = 0;
42314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42316         return ret_ref;
42317 }
42318
42319 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
42320         LDKShutdownScript a_conv;
42321         a_conv.inner = untag_ptr(a);
42322         a_conv.is_owned = ptr_is_owned(a);
42323         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42324         a_conv.is_owned = false;
42325         LDKShutdownScript b_conv;
42326         b_conv.inner = untag_ptr(b);
42327         b_conv.is_owned = ptr_is_owned(b);
42328         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42329         b_conv.is_owned = false;
42330         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
42331         return ret_conv;
42332 }
42333
42334 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
42335         LDKInvalidShutdownScript this_obj_conv;
42336         this_obj_conv.inner = untag_ptr(this_obj);
42337         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42339         InvalidShutdownScript_free(this_obj_conv);
42340 }
42341
42342 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
42343         LDKInvalidShutdownScript this_ptr_conv;
42344         this_ptr_conv.inner = untag_ptr(this_ptr);
42345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42347         this_ptr_conv.is_owned = false;
42348         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
42349         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42350         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42351         return ret_arr;
42352 }
42353
42354 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
42355         LDKInvalidShutdownScript this_ptr_conv;
42356         this_ptr_conv.inner = untag_ptr(this_ptr);
42357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42359         this_ptr_conv.is_owned = false;
42360         LDKCVec_u8Z val_ref;
42361         val_ref.datalen = val->arr_len;
42362         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42363         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
42364         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
42365 }
42366
42367 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
42368         LDKCVec_u8Z script_arg_ref;
42369         script_arg_ref.datalen = script_arg->arr_len;
42370         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42371         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
42372         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
42373         uint64_t ret_ref = 0;
42374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42376         return ret_ref;
42377 }
42378
42379 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
42380         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
42381         uint64_t ret_ref = 0;
42382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42384         return ret_ref;
42385 }
42386 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
42387         LDKInvalidShutdownScript arg_conv;
42388         arg_conv.inner = untag_ptr(arg);
42389         arg_conv.is_owned = ptr_is_owned(arg);
42390         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42391         arg_conv.is_owned = false;
42392         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
42393         return ret_conv;
42394 }
42395
42396 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
42397         LDKInvalidShutdownScript orig_conv;
42398         orig_conv.inner = untag_ptr(orig);
42399         orig_conv.is_owned = ptr_is_owned(orig);
42400         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42401         orig_conv.is_owned = false;
42402         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
42403         uint64_t ret_ref = 0;
42404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42406         return ret_ref;
42407 }
42408
42409 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
42410         LDKShutdownScript obj_conv;
42411         obj_conv.inner = untag_ptr(obj);
42412         obj_conv.is_owned = ptr_is_owned(obj);
42413         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42414         obj_conv.is_owned = false;
42415         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
42416         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42417         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42418         CVec_u8Z_free(ret_var);
42419         return ret_arr;
42420 }
42421
42422 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
42423         LDKu8slice ser_ref;
42424         ser_ref.datalen = ser->arr_len;
42425         ser_ref.data = ser->elems;
42426         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
42427         *ret_conv = ShutdownScript_read(ser_ref);
42428         FREE(ser);
42429         return tag_ptr(ret_conv, true);
42430 }
42431
42432 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
42433         uint8_t pubkey_hash_arr[20];
42434         CHECK(pubkey_hash->arr_len == 20);
42435         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
42436         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
42437         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
42438         uint64_t ret_ref = 0;
42439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42441         return ret_ref;
42442 }
42443
42444 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
42445         uint8_t script_hash_arr[32];
42446         CHECK(script_hash->arr_len == 32);
42447         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
42448         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
42449         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
42450         uint64_t ret_ref = 0;
42451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42453         return ret_ref;
42454 }
42455
42456 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
42457         
42458         LDKu8slice program_ref;
42459         program_ref.datalen = program->arr_len;
42460         program_ref.data = program->elems;
42461         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
42462         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
42463         FREE(program);
42464         return tag_ptr(ret_conv, true);
42465 }
42466
42467 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
42468         LDKShutdownScript this_arg_conv;
42469         this_arg_conv.inner = untag_ptr(this_arg);
42470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42472         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
42473         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
42474         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42475         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42476         CVec_u8Z_free(ret_var);
42477         return ret_arr;
42478 }
42479
42480 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
42481         LDKShutdownScript this_arg_conv;
42482         this_arg_conv.inner = untag_ptr(this_arg);
42483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42485         this_arg_conv.is_owned = false;
42486         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42487         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
42488         return ret_arr;
42489 }
42490
42491 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
42492         LDKShutdownScript this_arg_conv;
42493         this_arg_conv.inner = untag_ptr(this_arg);
42494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42496         this_arg_conv.is_owned = false;
42497         LDKInitFeatures features_conv;
42498         features_conv.inner = untag_ptr(features);
42499         features_conv.is_owned = ptr_is_owned(features);
42500         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42501         features_conv.is_owned = false;
42502         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
42503         return ret_conv;
42504 }
42505
42506 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
42507         if (!ptr_is_owned(this_ptr)) return;
42508         void* this_ptr_ptr = untag_ptr(this_ptr);
42509         CHECK_ACCESS(this_ptr_ptr);
42510         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
42511         FREE(untag_ptr(this_ptr));
42512         Retry_free(this_ptr_conv);
42513 }
42514
42515 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
42516         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42517         *ret_copy = Retry_clone(arg);
42518         uint64_t ret_ref = tag_ptr(ret_copy, true);
42519         return ret_ref;
42520 }
42521 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
42522         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
42523         int64_t ret_conv = Retry_clone_ptr(arg_conv);
42524         return ret_conv;
42525 }
42526
42527 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
42528         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
42529         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42530         *ret_copy = Retry_clone(orig_conv);
42531         uint64_t ret_ref = tag_ptr(ret_copy, true);
42532         return ret_ref;
42533 }
42534
42535 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
42536         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42537         *ret_copy = Retry_attempts(a);
42538         uint64_t ret_ref = tag_ptr(ret_copy, true);
42539         return ret_ref;
42540 }
42541
42542 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
42543         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
42544         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
42545         jboolean ret_conv = Retry_eq(a_conv, b_conv);
42546         return ret_conv;
42547 }
42548
42549 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
42550         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
42551         int64_t ret_conv = Retry_hash(o_conv);
42552         return ret_conv;
42553 }
42554
42555 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
42556         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
42557         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
42558         return ret_conv;
42559 }
42560
42561 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
42562         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
42563         return ret_conv;
42564 }
42565
42566 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
42567         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
42568         return ret_conv;
42569 }
42570
42571 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
42572         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
42573         return ret_conv;
42574 }
42575
42576 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
42577         if (!ptr_is_owned(this_ptr)) return;
42578         void* this_ptr_ptr = untag_ptr(this_ptr);
42579         CHECK_ACCESS(this_ptr_ptr);
42580         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
42581         FREE(untag_ptr(this_ptr));
42582         PaymentSendFailure_free(this_ptr_conv);
42583 }
42584
42585 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
42586         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42587         *ret_copy = PaymentSendFailure_clone(arg);
42588         uint64_t ret_ref = tag_ptr(ret_copy, true);
42589         return ret_ref;
42590 }
42591 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
42592         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
42593         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
42594         return ret_conv;
42595 }
42596
42597 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
42598         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
42599         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42600         *ret_copy = PaymentSendFailure_clone(orig_conv);
42601         uint64_t ret_ref = tag_ptr(ret_copy, true);
42602         return ret_ref;
42603 }
42604
42605 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
42606         void* a_ptr = untag_ptr(a);
42607         CHECK_ACCESS(a_ptr);
42608         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
42609         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
42610         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42611         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
42612         uint64_t ret_ref = tag_ptr(ret_copy, true);
42613         return ret_ref;
42614 }
42615
42616 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
42617         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
42618         a_constr.datalen = a->arr_len;
42619         if (a_constr.datalen > 0)
42620                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42621         else
42622                 a_constr.data = NULL;
42623         uint64_t* a_vals = a->elems;
42624         for (size_t w = 0; w < a_constr.datalen; w++) {
42625                 uint64_t a_conv_22 = a_vals[w];
42626                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
42627                 CHECK_ACCESS(a_conv_22_ptr);
42628                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
42629                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
42630                 a_constr.data[w] = a_conv_22_conv;
42631         }
42632         FREE(a);
42633         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42634         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
42635         uint64_t ret_ref = tag_ptr(ret_copy, true);
42636         return ret_ref;
42637 }
42638
42639 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
42640         LDKCVec_APIErrorZ a_constr;
42641         a_constr.datalen = a->arr_len;
42642         if (a_constr.datalen > 0)
42643                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
42644         else
42645                 a_constr.data = NULL;
42646         uint64_t* a_vals = a->elems;
42647         for (size_t k = 0; k < a_constr.datalen; k++) {
42648                 uint64_t a_conv_10 = a_vals[k];
42649                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
42650                 CHECK_ACCESS(a_conv_10_ptr);
42651                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
42652                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
42653                 a_constr.data[k] = a_conv_10_conv;
42654         }
42655         FREE(a);
42656         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42657         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
42658         uint64_t ret_ref = tag_ptr(ret_copy, true);
42659         return ret_ref;
42660 }
42661
42662 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
42663         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42664         *ret_copy = PaymentSendFailure_duplicate_payment();
42665         uint64_t ret_ref = tag_ptr(ret_copy, true);
42666         return ret_ref;
42667 }
42668
42669 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) {
42670         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
42671         results_constr.datalen = results->arr_len;
42672         if (results_constr.datalen > 0)
42673                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42674         else
42675                 results_constr.data = NULL;
42676         uint64_t* results_vals = results->elems;
42677         for (size_t w = 0; w < results_constr.datalen; w++) {
42678                 uint64_t results_conv_22 = results_vals[w];
42679                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
42680                 CHECK_ACCESS(results_conv_22_ptr);
42681                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
42682                 results_constr.data[w] = results_conv_22_conv;
42683         }
42684         FREE(results);
42685         LDKRouteParameters failed_paths_retry_conv;
42686         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
42687         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
42688         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
42689         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
42690         LDKThirtyTwoBytes payment_id_ref;
42691         CHECK(payment_id->arr_len == 32);
42692         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42693         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42694         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
42695         uint64_t ret_ref = tag_ptr(ret_copy, true);
42696         return ret_ref;
42697 }
42698
42699 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
42700         LDKRecipientOnionFields this_obj_conv;
42701         this_obj_conv.inner = untag_ptr(this_obj);
42702         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42704         RecipientOnionFields_free(this_obj_conv);
42705 }
42706
42707 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
42708         LDKRecipientOnionFields this_ptr_conv;
42709         this_ptr_conv.inner = untag_ptr(this_ptr);
42710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42712         this_ptr_conv.is_owned = false;
42713         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42714         memcpy(ret_arr->elems, RecipientOnionFields_get_payment_secret(&this_ptr_conv).data, 32);
42715         return ret_arr;
42716 }
42717
42718 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
42719         LDKRecipientOnionFields this_ptr_conv;
42720         this_ptr_conv.inner = untag_ptr(this_ptr);
42721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42723         this_ptr_conv.is_owned = false;
42724         LDKThirtyTwoBytes val_ref;
42725         CHECK(val->arr_len == 32);
42726         memcpy(val_ref.data, val->elems, 32); FREE(val);
42727         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_ref);
42728 }
42729
42730 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
42731         LDKRecipientOnionFields this_ptr_conv;
42732         this_ptr_conv.inner = untag_ptr(this_ptr);
42733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42735         this_ptr_conv.is_owned = false;
42736         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42737         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
42738         uint64_t ret_ref = tag_ptr(ret_copy, true);
42739         return ret_ref;
42740 }
42741
42742 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
42743         LDKRecipientOnionFields this_ptr_conv;
42744         this_ptr_conv.inner = untag_ptr(this_ptr);
42745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42747         this_ptr_conv.is_owned = false;
42748         void* val_ptr = untag_ptr(val);
42749         CHECK_ACCESS(val_ptr);
42750         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42751         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42752         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
42753 }
42754
42755 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_new"))) TS_RecipientOnionFields_new(int8_tArray payment_secret_arg, uint64_t payment_metadata_arg) {
42756         LDKThirtyTwoBytes payment_secret_arg_ref;
42757         CHECK(payment_secret_arg->arr_len == 32);
42758         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
42759         void* payment_metadata_arg_ptr = untag_ptr(payment_metadata_arg);
42760         CHECK_ACCESS(payment_metadata_arg_ptr);
42761         LDKCOption_CVec_u8ZZ payment_metadata_arg_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_arg_ptr);
42762         payment_metadata_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata_arg));
42763         LDKRecipientOnionFields ret_var = RecipientOnionFields_new(payment_secret_arg_ref, payment_metadata_arg_conv);
42764         uint64_t ret_ref = 0;
42765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42767         return ret_ref;
42768 }
42769
42770 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
42771         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
42772         uint64_t ret_ref = 0;
42773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42775         return ret_ref;
42776 }
42777 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
42778         LDKRecipientOnionFields arg_conv;
42779         arg_conv.inner = untag_ptr(arg);
42780         arg_conv.is_owned = ptr_is_owned(arg);
42781         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42782         arg_conv.is_owned = false;
42783         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
42784         return ret_conv;
42785 }
42786
42787 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
42788         LDKRecipientOnionFields orig_conv;
42789         orig_conv.inner = untag_ptr(orig);
42790         orig_conv.is_owned = ptr_is_owned(orig);
42791         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42792         orig_conv.is_owned = false;
42793         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
42794         uint64_t ret_ref = 0;
42795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42797         return ret_ref;
42798 }
42799
42800 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
42801         LDKRecipientOnionFields a_conv;
42802         a_conv.inner = untag_ptr(a);
42803         a_conv.is_owned = ptr_is_owned(a);
42804         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42805         a_conv.is_owned = false;
42806         LDKRecipientOnionFields b_conv;
42807         b_conv.inner = untag_ptr(b);
42808         b_conv.is_owned = ptr_is_owned(b);
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42810         b_conv.is_owned = false;
42811         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
42812         return ret_conv;
42813 }
42814
42815 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
42816         LDKRecipientOnionFields obj_conv;
42817         obj_conv.inner = untag_ptr(obj);
42818         obj_conv.is_owned = ptr_is_owned(obj);
42819         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42820         obj_conv.is_owned = false;
42821         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
42822         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42823         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42824         CVec_u8Z_free(ret_var);
42825         return ret_arr;
42826 }
42827
42828 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
42829         LDKu8slice ser_ref;
42830         ser_ref.datalen = ser->arr_len;
42831         ser_ref.data = ser->elems;
42832         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
42833         *ret_conv = RecipientOnionFields_read(ser_ref);
42834         FREE(ser);
42835         return tag_ptr(ret_conv, true);
42836 }
42837
42838 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
42839         LDKThirtyTwoBytes payment_secret_ref;
42840         CHECK(payment_secret->arr_len == 32);
42841         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
42842         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
42843         uint64_t ret_ref = 0;
42844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42846         return ret_ref;
42847 }
42848
42849 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
42850         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
42851         uint64_t ret_ref = 0;
42852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42854         return ret_ref;
42855 }
42856
42857 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
42858         if (!ptr_is_owned(this_ptr)) return;
42859         void* this_ptr_ptr = untag_ptr(this_ptr);
42860         CHECK_ACCESS(this_ptr_ptr);
42861         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
42862         FREE(untag_ptr(this_ptr));
42863         CustomMessageReader_free(this_ptr_conv);
42864 }
42865
42866 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
42867         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42868         *ret_ret = Type_clone(arg);
42869         return tag_ptr(ret_ret, true);
42870 }
42871 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
42872         void* arg_ptr = untag_ptr(arg);
42873         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
42874         LDKType* arg_conv = (LDKType*)arg_ptr;
42875         int64_t ret_conv = Type_clone_ptr(arg_conv);
42876         return ret_conv;
42877 }
42878
42879 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
42880         void* orig_ptr = untag_ptr(orig);
42881         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
42882         LDKType* orig_conv = (LDKType*)orig_ptr;
42883         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42884         *ret_ret = Type_clone(orig_conv);
42885         return tag_ptr(ret_ret, true);
42886 }
42887
42888 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
42889         if (!ptr_is_owned(this_ptr)) return;
42890         void* this_ptr_ptr = untag_ptr(this_ptr);
42891         CHECK_ACCESS(this_ptr_ptr);
42892         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
42893         FREE(untag_ptr(this_ptr));
42894         Type_free(this_ptr_conv);
42895 }
42896
42897 void  __attribute__((export_name("TS_UnsignedInvoice_free"))) TS_UnsignedInvoice_free(uint64_t this_obj) {
42898         LDKUnsignedInvoice this_obj_conv;
42899         this_obj_conv.inner = untag_ptr(this_obj);
42900         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42902         UnsignedInvoice_free(this_obj_conv);
42903 }
42904
42905 int8_tArray  __attribute__((export_name("TS_UnsignedInvoice_signing_pubkey"))) TS_UnsignedInvoice_signing_pubkey(uint64_t this_arg) {
42906         LDKUnsignedInvoice this_arg_conv;
42907         this_arg_conv.inner = untag_ptr(this_arg);
42908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42910         this_arg_conv.is_owned = false;
42911         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42912         memcpy(ret_arr->elems, UnsignedInvoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
42913         return ret_arr;
42914 }
42915
42916 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
42917         LDKBlindedPayInfo this_obj_conv;
42918         this_obj_conv.inner = untag_ptr(this_obj);
42919         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42921         BlindedPayInfo_free(this_obj_conv);
42922 }
42923
42924 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
42925         LDKBlindedPayInfo this_ptr_conv;
42926         this_ptr_conv.inner = untag_ptr(this_ptr);
42927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42929         this_ptr_conv.is_owned = false;
42930         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
42931         return ret_conv;
42932 }
42933
42934 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
42935         LDKBlindedPayInfo this_ptr_conv;
42936         this_ptr_conv.inner = untag_ptr(this_ptr);
42937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42939         this_ptr_conv.is_owned = false;
42940         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
42941 }
42942
42943 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
42944         LDKBlindedPayInfo this_ptr_conv;
42945         this_ptr_conv.inner = untag_ptr(this_ptr);
42946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42948         this_ptr_conv.is_owned = false;
42949         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
42950         return ret_conv;
42951 }
42952
42953 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
42954         LDKBlindedPayInfo this_ptr_conv;
42955         this_ptr_conv.inner = untag_ptr(this_ptr);
42956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42958         this_ptr_conv.is_owned = false;
42959         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
42960 }
42961
42962 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
42963         LDKBlindedPayInfo this_ptr_conv;
42964         this_ptr_conv.inner = untag_ptr(this_ptr);
42965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42967         this_ptr_conv.is_owned = false;
42968         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
42969         return ret_conv;
42970 }
42971
42972 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
42973         LDKBlindedPayInfo this_ptr_conv;
42974         this_ptr_conv.inner = untag_ptr(this_ptr);
42975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42977         this_ptr_conv.is_owned = false;
42978         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
42979 }
42980
42981 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
42982         LDKBlindedPayInfo this_ptr_conv;
42983         this_ptr_conv.inner = untag_ptr(this_ptr);
42984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42986         this_ptr_conv.is_owned = false;
42987         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
42988         return ret_conv;
42989 }
42990
42991 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
42992         LDKBlindedPayInfo this_ptr_conv;
42993         this_ptr_conv.inner = untag_ptr(this_ptr);
42994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42996         this_ptr_conv.is_owned = false;
42997         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
42998 }
42999
43000 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
43001         LDKBlindedPayInfo this_ptr_conv;
43002         this_ptr_conv.inner = untag_ptr(this_ptr);
43003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43005         this_ptr_conv.is_owned = false;
43006         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
43007         return ret_conv;
43008 }
43009
43010 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
43011         LDKBlindedPayInfo this_ptr_conv;
43012         this_ptr_conv.inner = untag_ptr(this_ptr);
43013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43015         this_ptr_conv.is_owned = false;
43016         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
43017 }
43018
43019 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
43020         LDKBlindedPayInfo this_ptr_conv;
43021         this_ptr_conv.inner = untag_ptr(this_ptr);
43022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43024         this_ptr_conv.is_owned = false;
43025         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
43026         uint64_t ret_ref = 0;
43027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43029         return ret_ref;
43030 }
43031
43032 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
43033         LDKBlindedPayInfo this_ptr_conv;
43034         this_ptr_conv.inner = untag_ptr(this_ptr);
43035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43037         this_ptr_conv.is_owned = false;
43038         LDKBlindedHopFeatures val_conv;
43039         val_conv.inner = untag_ptr(val);
43040         val_conv.is_owned = ptr_is_owned(val);
43041         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43042         val_conv = BlindedHopFeatures_clone(&val_conv);
43043         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
43044 }
43045
43046 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) {
43047         LDKBlindedHopFeatures features_arg_conv;
43048         features_arg_conv.inner = untag_ptr(features_arg);
43049         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43050         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43051         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
43052         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);
43053         uint64_t ret_ref = 0;
43054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43056         return ret_ref;
43057 }
43058
43059 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
43060         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
43061         uint64_t ret_ref = 0;
43062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43064         return ret_ref;
43065 }
43066 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
43067         LDKBlindedPayInfo arg_conv;
43068         arg_conv.inner = untag_ptr(arg);
43069         arg_conv.is_owned = ptr_is_owned(arg);
43070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43071         arg_conv.is_owned = false;
43072         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
43073         return ret_conv;
43074 }
43075
43076 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
43077         LDKBlindedPayInfo orig_conv;
43078         orig_conv.inner = untag_ptr(orig);
43079         orig_conv.is_owned = ptr_is_owned(orig);
43080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43081         orig_conv.is_owned = false;
43082         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
43083         uint64_t ret_ref = 0;
43084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43086         return ret_ref;
43087 }
43088
43089 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
43090         LDKBlindedPayInfo o_conv;
43091         o_conv.inner = untag_ptr(o);
43092         o_conv.is_owned = ptr_is_owned(o);
43093         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43094         o_conv.is_owned = false;
43095         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
43096         return ret_conv;
43097 }
43098
43099 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
43100         LDKBlindedPayInfo a_conv;
43101         a_conv.inner = untag_ptr(a);
43102         a_conv.is_owned = ptr_is_owned(a);
43103         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43104         a_conv.is_owned = false;
43105         LDKBlindedPayInfo b_conv;
43106         b_conv.inner = untag_ptr(b);
43107         b_conv.is_owned = ptr_is_owned(b);
43108         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43109         b_conv.is_owned = false;
43110         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
43111         return ret_conv;
43112 }
43113
43114 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
43115         LDKBlindedPayInfo obj_conv;
43116         obj_conv.inner = untag_ptr(obj);
43117         obj_conv.is_owned = ptr_is_owned(obj);
43118         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43119         obj_conv.is_owned = false;
43120         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
43121         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43122         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43123         CVec_u8Z_free(ret_var);
43124         return ret_arr;
43125 }
43126
43127 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
43128         LDKu8slice ser_ref;
43129         ser_ref.datalen = ser->arr_len;
43130         ser_ref.data = ser->elems;
43131         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
43132         *ret_conv = BlindedPayInfo_read(ser_ref);
43133         FREE(ser);
43134         return tag_ptr(ret_conv, true);
43135 }
43136
43137 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
43138         LDKUnsignedInvoiceRequest this_obj_conv;
43139         this_obj_conv.inner = untag_ptr(this_obj);
43140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43142         UnsignedInvoiceRequest_free(this_obj_conv);
43143 }
43144
43145 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
43146         LDKInvoiceRequest this_obj_conv;
43147         this_obj_conv.inner = untag_ptr(this_obj);
43148         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43150         InvoiceRequest_free(this_obj_conv);
43151 }
43152
43153 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
43154         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
43155         uint64_t ret_ref = 0;
43156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43158         return ret_ref;
43159 }
43160 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
43161         LDKInvoiceRequest arg_conv;
43162         arg_conv.inner = untag_ptr(arg);
43163         arg_conv.is_owned = ptr_is_owned(arg);
43164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43165         arg_conv.is_owned = false;
43166         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
43167         return ret_conv;
43168 }
43169
43170 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
43171         LDKInvoiceRequest orig_conv;
43172         orig_conv.inner = untag_ptr(orig);
43173         orig_conv.is_owned = ptr_is_owned(orig);
43174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43175         orig_conv.is_owned = false;
43176         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
43177         uint64_t ret_ref = 0;
43178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43180         return ret_ref;
43181 }
43182
43183 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
43184         LDKInvoiceRequest this_arg_conv;
43185         this_arg_conv.inner = untag_ptr(this_arg);
43186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43188         this_arg_conv.is_owned = false;
43189         LDKu8slice ret_var = InvoiceRequest_metadata(&this_arg_conv);
43190         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43191         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43192         return ret_arr;
43193 }
43194
43195 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
43196         LDKInvoiceRequest this_arg_conv;
43197         this_arg_conv.inner = untag_ptr(this_arg);
43198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43200         this_arg_conv.is_owned = false;
43201         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43202         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
43203         return ret_arr;
43204 }
43205
43206 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
43207         LDKInvoiceRequest this_arg_conv;
43208         this_arg_conv.inner = untag_ptr(this_arg);
43209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43211         this_arg_conv.is_owned = false;
43212         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43213         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
43214         uint64_t ret_ref = tag_ptr(ret_copy, true);
43215         return ret_ref;
43216 }
43217
43218 uint64_t  __attribute__((export_name("TS_InvoiceRequest_features"))) TS_InvoiceRequest_features(uint64_t this_arg) {
43219         LDKInvoiceRequest this_arg_conv;
43220         this_arg_conv.inner = untag_ptr(this_arg);
43221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43223         this_arg_conv.is_owned = false;
43224         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_features(&this_arg_conv);
43225         uint64_t ret_ref = 0;
43226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43228         return ret_ref;
43229 }
43230
43231 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
43232         LDKInvoiceRequest this_arg_conv;
43233         this_arg_conv.inner = untag_ptr(this_arg);
43234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43236         this_arg_conv.is_owned = false;
43237         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43238         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
43239         uint64_t ret_ref = tag_ptr(ret_copy, true);
43240         return ret_ref;
43241 }
43242
43243 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
43244         LDKInvoiceRequest this_arg_conv;
43245         this_arg_conv.inner = untag_ptr(this_arg);
43246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43248         this_arg_conv.is_owned = false;
43249         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43250         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
43251         return ret_arr;
43252 }
43253
43254 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
43255         LDKInvoiceRequest this_arg_conv;
43256         this_arg_conv.inner = untag_ptr(this_arg);
43257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43259         this_arg_conv.is_owned = false;
43260         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
43261         uint64_t ret_ref = 0;
43262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43264         return ret_ref;
43265 }
43266
43267 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
43268         LDKInvoiceRequest obj_conv;
43269         obj_conv.inner = untag_ptr(obj);
43270         obj_conv.is_owned = ptr_is_owned(obj);
43271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43272         obj_conv.is_owned = false;
43273         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
43274         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43275         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43276         CVec_u8Z_free(ret_var);
43277         return ret_arr;
43278 }
43279
43280 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
43281         LDKOffer this_obj_conv;
43282         this_obj_conv.inner = untag_ptr(this_obj);
43283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43285         Offer_free(this_obj_conv);
43286 }
43287
43288 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
43289         LDKOffer ret_var = Offer_clone(arg);
43290         uint64_t ret_ref = 0;
43291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43293         return ret_ref;
43294 }
43295 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
43296         LDKOffer arg_conv;
43297         arg_conv.inner = untag_ptr(arg);
43298         arg_conv.is_owned = ptr_is_owned(arg);
43299         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43300         arg_conv.is_owned = false;
43301         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
43302         return ret_conv;
43303 }
43304
43305 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
43306         LDKOffer orig_conv;
43307         orig_conv.inner = untag_ptr(orig);
43308         orig_conv.is_owned = ptr_is_owned(orig);
43309         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43310         orig_conv.is_owned = false;
43311         LDKOffer ret_var = Offer_clone(&orig_conv);
43312         uint64_t ret_ref = 0;
43313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43315         return ret_ref;
43316 }
43317
43318 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
43319         LDKOffer this_arg_conv;
43320         this_arg_conv.inner = untag_ptr(this_arg);
43321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43323         this_arg_conv.is_owned = false;
43324         LDKCVec_ChainHashZ ret_var = Offer_chains(&this_arg_conv);
43325         ptrArray ret_arr = NULL;
43326         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
43327         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
43328         for (size_t m = 0; m < ret_var.datalen; m++) {
43329                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
43330                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
43331                 ret_arr_ptr[m] = ret_conv_12_arr;
43332         }
43333         
43334         FREE(ret_var.data);
43335         return ret_arr;
43336 }
43337
43338 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
43339         LDKOffer this_arg_conv;
43340         this_arg_conv.inner = untag_ptr(this_arg);
43341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43343         this_arg_conv.is_owned = false;
43344         LDKThirtyTwoBytes chain_ref;
43345         CHECK(chain->arr_len == 32);
43346         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
43347         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
43348         return ret_conv;
43349 }
43350
43351 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
43352         LDKOffer this_arg_conv;
43353         this_arg_conv.inner = untag_ptr(this_arg);
43354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43356         this_arg_conv.is_owned = false;
43357         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43358         *ret_copy = Offer_metadata(&this_arg_conv);
43359         uint64_t ret_ref = tag_ptr(ret_copy, true);
43360         return ret_ref;
43361 }
43362
43363 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
43364         LDKOffer this_arg_conv;
43365         this_arg_conv.inner = untag_ptr(this_arg);
43366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43368         this_arg_conv.is_owned = false;
43369         LDKAmount ret_var = Offer_amount(&this_arg_conv);
43370         uint64_t ret_ref = 0;
43371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43373         return ret_ref;
43374 }
43375
43376 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
43377         LDKOffer this_arg_conv;
43378         this_arg_conv.inner = untag_ptr(this_arg);
43379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43381         this_arg_conv.is_owned = false;
43382         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
43383         uint64_t ret_ref = 0;
43384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43386         return ret_ref;
43387 }
43388
43389 uint64_t  __attribute__((export_name("TS_Offer_features"))) TS_Offer_features(uint64_t this_arg) {
43390         LDKOffer this_arg_conv;
43391         this_arg_conv.inner = untag_ptr(this_arg);
43392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43394         this_arg_conv.is_owned = false;
43395         LDKOfferFeatures ret_var = Offer_features(&this_arg_conv);
43396         uint64_t ret_ref = 0;
43397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43399         return ret_ref;
43400 }
43401
43402 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
43403         LDKOffer this_arg_conv;
43404         this_arg_conv.inner = untag_ptr(this_arg);
43405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43407         this_arg_conv.is_owned = false;
43408         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
43409         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
43410         uint64_t ret_ref = tag_ptr(ret_copy, true);
43411         return ret_ref;
43412 }
43413
43414 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
43415         LDKOffer this_arg_conv;
43416         this_arg_conv.inner = untag_ptr(this_arg);
43417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43419         this_arg_conv.is_owned = false;
43420         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
43421         uint64_t ret_ref = 0;
43422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43424         return ret_ref;
43425 }
43426
43427 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
43428         LDKOffer this_arg_conv;
43429         this_arg_conv.inner = untag_ptr(this_arg);
43430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43432         this_arg_conv.is_owned = false;
43433         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
43434         uint64_tArray ret_arr = NULL;
43435         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43436         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43437         for (size_t n = 0; n < ret_var.datalen; n++) {
43438                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
43439                 uint64_t ret_conv_13_ref = 0;
43440                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
43441                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
43442                 ret_arr_ptr[n] = ret_conv_13_ref;
43443         }
43444         
43445         FREE(ret_var.data);
43446         return ret_arr;
43447 }
43448
43449 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
43450         LDKOffer this_arg_conv;
43451         this_arg_conv.inner = untag_ptr(this_arg);
43452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43454         this_arg_conv.is_owned = false;
43455         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
43456         uint64_t ret_ref = 0;
43457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43459         return ret_ref;
43460 }
43461
43462 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
43463         LDKOffer this_arg_conv;
43464         this_arg_conv.inner = untag_ptr(this_arg);
43465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43467         this_arg_conv.is_owned = false;
43468         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
43469         return ret_conv;
43470 }
43471
43472 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
43473         LDKOffer this_arg_conv;
43474         this_arg_conv.inner = untag_ptr(this_arg);
43475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43477         this_arg_conv.is_owned = false;
43478         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
43479         return ret_conv;
43480 }
43481
43482 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
43483         LDKOffer this_arg_conv;
43484         this_arg_conv.inner = untag_ptr(this_arg);
43485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43487         this_arg_conv.is_owned = false;
43488         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43489         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
43490         return ret_arr;
43491 }
43492
43493 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
43494         LDKOffer obj_conv;
43495         obj_conv.inner = untag_ptr(obj);
43496         obj_conv.is_owned = ptr_is_owned(obj);
43497         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43498         obj_conv.is_owned = false;
43499         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
43500         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43501         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43502         CVec_u8Z_free(ret_var);
43503         return ret_arr;
43504 }
43505
43506 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
43507         LDKAmount this_obj_conv;
43508         this_obj_conv.inner = untag_ptr(this_obj);
43509         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43511         Amount_free(this_obj_conv);
43512 }
43513
43514 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
43515         LDKAmount ret_var = Amount_clone(arg);
43516         uint64_t ret_ref = 0;
43517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43519         return ret_ref;
43520 }
43521 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
43522         LDKAmount arg_conv;
43523         arg_conv.inner = untag_ptr(arg);
43524         arg_conv.is_owned = ptr_is_owned(arg);
43525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43526         arg_conv.is_owned = false;
43527         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
43528         return ret_conv;
43529 }
43530
43531 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
43532         LDKAmount orig_conv;
43533         orig_conv.inner = untag_ptr(orig);
43534         orig_conv.is_owned = ptr_is_owned(orig);
43535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43536         orig_conv.is_owned = false;
43537         LDKAmount ret_var = Amount_clone(&orig_conv);
43538         uint64_t ret_ref = 0;
43539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43541         return ret_ref;
43542 }
43543
43544 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
43545         LDKQuantity this_obj_conv;
43546         this_obj_conv.inner = untag_ptr(this_obj);
43547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43549         Quantity_free(this_obj_conv);
43550 }
43551
43552 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
43553         LDKQuantity ret_var = Quantity_clone(arg);
43554         uint64_t ret_ref = 0;
43555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43557         return ret_ref;
43558 }
43559 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
43560         LDKQuantity arg_conv;
43561         arg_conv.inner = untag_ptr(arg);
43562         arg_conv.is_owned = ptr_is_owned(arg);
43563         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43564         arg_conv.is_owned = false;
43565         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
43566         return ret_conv;
43567 }
43568
43569 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
43570         LDKQuantity orig_conv;
43571         orig_conv.inner = untag_ptr(orig);
43572         orig_conv.is_owned = ptr_is_owned(orig);
43573         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43574         orig_conv.is_owned = false;
43575         LDKQuantity ret_var = Quantity_clone(&orig_conv);
43576         uint64_t ret_ref = 0;
43577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43579         return ret_ref;
43580 }
43581
43582 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
43583         LDKRefund this_obj_conv;
43584         this_obj_conv.inner = untag_ptr(this_obj);
43585         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43587         Refund_free(this_obj_conv);
43588 }
43589
43590 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
43591         LDKRefund ret_var = Refund_clone(arg);
43592         uint64_t ret_ref = 0;
43593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43595         return ret_ref;
43596 }
43597 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
43598         LDKRefund arg_conv;
43599         arg_conv.inner = untag_ptr(arg);
43600         arg_conv.is_owned = ptr_is_owned(arg);
43601         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43602         arg_conv.is_owned = false;
43603         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
43604         return ret_conv;
43605 }
43606
43607 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
43608         LDKRefund orig_conv;
43609         orig_conv.inner = untag_ptr(orig);
43610         orig_conv.is_owned = ptr_is_owned(orig);
43611         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43612         orig_conv.is_owned = false;
43613         LDKRefund ret_var = Refund_clone(&orig_conv);
43614         uint64_t ret_ref = 0;
43615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43617         return ret_ref;
43618 }
43619
43620 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
43621         LDKRefund this_arg_conv;
43622         this_arg_conv.inner = untag_ptr(this_arg);
43623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43625         this_arg_conv.is_owned = false;
43626         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
43627         uint64_t ret_ref = 0;
43628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43630         return ret_ref;
43631 }
43632
43633 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
43634         LDKRefund this_arg_conv;
43635         this_arg_conv.inner = untag_ptr(this_arg);
43636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43638         this_arg_conv.is_owned = false;
43639         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
43640         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
43641         uint64_t ret_ref = tag_ptr(ret_copy, true);
43642         return ret_ref;
43643 }
43644
43645 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
43646         LDKRefund this_arg_conv;
43647         this_arg_conv.inner = untag_ptr(this_arg);
43648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43650         this_arg_conv.is_owned = false;
43651         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
43652         uint64_t ret_ref = 0;
43653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43655         return ret_ref;
43656 }
43657
43658 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
43659         LDKRefund this_arg_conv;
43660         this_arg_conv.inner = untag_ptr(this_arg);
43661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43663         this_arg_conv.is_owned = false;
43664         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
43665         uint64_tArray ret_arr = NULL;
43666         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43667         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43668         for (size_t n = 0; n < ret_var.datalen; n++) {
43669                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
43670                 uint64_t ret_conv_13_ref = 0;
43671                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
43672                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
43673                 ret_arr_ptr[n] = ret_conv_13_ref;
43674         }
43675         
43676         FREE(ret_var.data);
43677         return ret_arr;
43678 }
43679
43680 int8_tArray  __attribute__((export_name("TS_Refund_metadata"))) TS_Refund_metadata(uint64_t this_arg) {
43681         LDKRefund this_arg_conv;
43682         this_arg_conv.inner = untag_ptr(this_arg);
43683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43685         this_arg_conv.is_owned = false;
43686         LDKu8slice ret_var = Refund_metadata(&this_arg_conv);
43687         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43688         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43689         return ret_arr;
43690 }
43691
43692 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
43693         LDKRefund this_arg_conv;
43694         this_arg_conv.inner = untag_ptr(this_arg);
43695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43697         this_arg_conv.is_owned = false;
43698         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43699         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
43700         return ret_arr;
43701 }
43702
43703 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
43704         LDKRefund this_arg_conv;
43705         this_arg_conv.inner = untag_ptr(this_arg);
43706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43708         this_arg_conv.is_owned = false;
43709         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
43710         return ret_conv;
43711 }
43712
43713 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
43714         LDKRefund this_arg_conv;
43715         this_arg_conv.inner = untag_ptr(this_arg);
43716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43718         this_arg_conv.is_owned = false;
43719         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
43720         uint64_t ret_ref = 0;
43721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43723         return ret_ref;
43724 }
43725
43726 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
43727         LDKRefund this_arg_conv;
43728         this_arg_conv.inner = untag_ptr(this_arg);
43729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43731         this_arg_conv.is_owned = false;
43732         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43733         *ret_copy = Refund_quantity(&this_arg_conv);
43734         uint64_t ret_ref = tag_ptr(ret_copy, true);
43735         return ret_ref;
43736 }
43737
43738 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
43739         LDKRefund this_arg_conv;
43740         this_arg_conv.inner = untag_ptr(this_arg);
43741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43743         this_arg_conv.is_owned = false;
43744         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43745         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
43746         return ret_arr;
43747 }
43748
43749 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
43750         LDKRefund this_arg_conv;
43751         this_arg_conv.inner = untag_ptr(this_arg);
43752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43754         this_arg_conv.is_owned = false;
43755         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
43756         uint64_t ret_ref = 0;
43757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43759         return ret_ref;
43760 }
43761
43762 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
43763         LDKRefund obj_conv;
43764         obj_conv.inner = untag_ptr(obj);
43765         obj_conv.is_owned = ptr_is_owned(obj);
43766         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43767         obj_conv.is_owned = false;
43768         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
43769         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43770         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43771         CVec_u8Z_free(ret_var);
43772         return ret_arr;
43773 }
43774
43775 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
43776         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
43777         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
43778         return ret_conv;
43779 }
43780
43781 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
43782         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
43783         return ret_conv;
43784 }
43785
43786 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
43787         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
43788         return ret_conv;
43789 }
43790
43791 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
43792         if (!ptr_is_owned(this_ptr)) return;
43793         void* this_ptr_ptr = untag_ptr(this_ptr);
43794         CHECK_ACCESS(this_ptr_ptr);
43795         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
43796         FREE(untag_ptr(this_ptr));
43797         UtxoResult_free(this_ptr_conv);
43798 }
43799
43800 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
43801         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43802         *ret_copy = UtxoResult_clone(arg);
43803         uint64_t ret_ref = tag_ptr(ret_copy, true);
43804         return ret_ref;
43805 }
43806 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
43807         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
43808         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
43809         return ret_conv;
43810 }
43811
43812 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
43813         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
43814         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43815         *ret_copy = UtxoResult_clone(orig_conv);
43816         uint64_t ret_ref = tag_ptr(ret_copy, true);
43817         return ret_ref;
43818 }
43819
43820 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
43821         void* a_ptr = untag_ptr(a);
43822         CHECK_ACCESS(a_ptr);
43823         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
43824         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
43825         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43826         *ret_copy = UtxoResult_sync(a_conv);
43827         uint64_t ret_ref = tag_ptr(ret_copy, true);
43828         return ret_ref;
43829 }
43830
43831 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
43832         LDKUtxoFuture a_conv;
43833         a_conv.inner = untag_ptr(a);
43834         a_conv.is_owned = ptr_is_owned(a);
43835         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43836         a_conv = UtxoFuture_clone(&a_conv);
43837         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43838         *ret_copy = UtxoResult_async(a_conv);
43839         uint64_t ret_ref = tag_ptr(ret_copy, true);
43840         return ret_ref;
43841 }
43842
43843 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
43844         if (!ptr_is_owned(this_ptr)) return;
43845         void* this_ptr_ptr = untag_ptr(this_ptr);
43846         CHECK_ACCESS(this_ptr_ptr);
43847         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
43848         FREE(untag_ptr(this_ptr));
43849         UtxoLookup_free(this_ptr_conv);
43850 }
43851
43852 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
43853         LDKUtxoFuture this_obj_conv;
43854         this_obj_conv.inner = untag_ptr(this_obj);
43855         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43857         UtxoFuture_free(this_obj_conv);
43858 }
43859
43860 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
43861         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
43862         uint64_t ret_ref = 0;
43863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43865         return ret_ref;
43866 }
43867 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
43868         LDKUtxoFuture arg_conv;
43869         arg_conv.inner = untag_ptr(arg);
43870         arg_conv.is_owned = ptr_is_owned(arg);
43871         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43872         arg_conv.is_owned = false;
43873         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
43874         return ret_conv;
43875 }
43876
43877 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
43878         LDKUtxoFuture orig_conv;
43879         orig_conv.inner = untag_ptr(orig);
43880         orig_conv.is_owned = ptr_is_owned(orig);
43881         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43882         orig_conv.is_owned = false;
43883         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
43884         uint64_t ret_ref = 0;
43885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43887         return ret_ref;
43888 }
43889
43890 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
43891         LDKUtxoFuture ret_var = UtxoFuture_new();
43892         uint64_t ret_ref = 0;
43893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43895         return ret_ref;
43896 }
43897
43898 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
43899         LDKUtxoFuture this_arg_conv;
43900         this_arg_conv.inner = untag_ptr(this_arg);
43901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43903         this_arg_conv.is_owned = false;
43904         LDKNetworkGraph graph_conv;
43905         graph_conv.inner = untag_ptr(graph);
43906         graph_conv.is_owned = ptr_is_owned(graph);
43907         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
43908         graph_conv.is_owned = false;
43909         void* result_ptr = untag_ptr(result);
43910         CHECK_ACCESS(result_ptr);
43911         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
43912         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
43913 }
43914
43915 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
43916         LDKUtxoFuture this_arg_conv;
43917         this_arg_conv.inner = untag_ptr(this_arg);
43918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43920         this_arg_conv.is_owned = false;
43921         LDKNetworkGraph graph_conv;
43922         graph_conv.inner = untag_ptr(graph);
43923         graph_conv.is_owned = ptr_is_owned(graph);
43924         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
43925         graph_conv.is_owned = false;
43926         LDKP2PGossipSync gossip_conv;
43927         gossip_conv.inner = untag_ptr(gossip);
43928         gossip_conv.is_owned = ptr_is_owned(gossip);
43929         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
43930         gossip_conv.is_owned = false;
43931         void* result_ptr = untag_ptr(result);
43932         CHECK_ACCESS(result_ptr);
43933         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
43934         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
43935 }
43936
43937 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
43938         LDKNodeId this_obj_conv;
43939         this_obj_conv.inner = untag_ptr(this_obj);
43940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43942         NodeId_free(this_obj_conv);
43943 }
43944
43945 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
43946         LDKNodeId ret_var = NodeId_clone(arg);
43947         uint64_t ret_ref = 0;
43948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43950         return ret_ref;
43951 }
43952 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
43953         LDKNodeId arg_conv;
43954         arg_conv.inner = untag_ptr(arg);
43955         arg_conv.is_owned = ptr_is_owned(arg);
43956         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43957         arg_conv.is_owned = false;
43958         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
43959         return ret_conv;
43960 }
43961
43962 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
43963         LDKNodeId orig_conv;
43964         orig_conv.inner = untag_ptr(orig);
43965         orig_conv.is_owned = ptr_is_owned(orig);
43966         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43967         orig_conv.is_owned = false;
43968         LDKNodeId ret_var = NodeId_clone(&orig_conv);
43969         uint64_t ret_ref = 0;
43970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43972         return ret_ref;
43973 }
43974
43975 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
43976         LDKPublicKey pubkey_ref;
43977         CHECK(pubkey->arr_len == 33);
43978         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
43979         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
43980         uint64_t ret_ref = 0;
43981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43983         return ret_ref;
43984 }
43985
43986 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
43987         LDKNodeId this_arg_conv;
43988         this_arg_conv.inner = untag_ptr(this_arg);
43989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43991         this_arg_conv.is_owned = false;
43992         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
43993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43995         return ret_arr;
43996 }
43997
43998 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
43999         LDKNodeId this_arg_conv;
44000         this_arg_conv.inner = untag_ptr(this_arg);
44001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44003         this_arg_conv.is_owned = false;
44004         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
44005         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
44006         return tag_ptr(ret_conv, true);
44007 }
44008
44009 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
44010         LDKNodeId o_conv;
44011         o_conv.inner = untag_ptr(o);
44012         o_conv.is_owned = ptr_is_owned(o);
44013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44014         o_conv.is_owned = false;
44015         int64_t ret_conv = NodeId_hash(&o_conv);
44016         return ret_conv;
44017 }
44018
44019 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
44020         LDKNodeId obj_conv;
44021         obj_conv.inner = untag_ptr(obj);
44022         obj_conv.is_owned = ptr_is_owned(obj);
44023         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44024         obj_conv.is_owned = false;
44025         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
44026         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44027         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44028         CVec_u8Z_free(ret_var);
44029         return ret_arr;
44030 }
44031
44032 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
44033         LDKu8slice ser_ref;
44034         ser_ref.datalen = ser->arr_len;
44035         ser_ref.data = ser->elems;
44036         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
44037         *ret_conv = NodeId_read(ser_ref);
44038         FREE(ser);
44039         return tag_ptr(ret_conv, true);
44040 }
44041
44042 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
44043         LDKNetworkGraph this_obj_conv;
44044         this_obj_conv.inner = untag_ptr(this_obj);
44045         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44047         NetworkGraph_free(this_obj_conv);
44048 }
44049
44050 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
44051         LDKReadOnlyNetworkGraph this_obj_conv;
44052         this_obj_conv.inner = untag_ptr(this_obj);
44053         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44055         ReadOnlyNetworkGraph_free(this_obj_conv);
44056 }
44057
44058 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
44059         if (!ptr_is_owned(this_ptr)) return;
44060         void* this_ptr_ptr = untag_ptr(this_ptr);
44061         CHECK_ACCESS(this_ptr_ptr);
44062         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
44063         FREE(untag_ptr(this_ptr));
44064         NetworkUpdate_free(this_ptr_conv);
44065 }
44066
44067 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
44068         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44069         *ret_copy = NetworkUpdate_clone(arg);
44070         uint64_t ret_ref = tag_ptr(ret_copy, true);
44071         return ret_ref;
44072 }
44073 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
44074         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
44075         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
44076         return ret_conv;
44077 }
44078
44079 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
44080         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
44081         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44082         *ret_copy = NetworkUpdate_clone(orig_conv);
44083         uint64_t ret_ref = tag_ptr(ret_copy, true);
44084         return ret_ref;
44085 }
44086
44087 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
44088         LDKChannelUpdate msg_conv;
44089         msg_conv.inner = untag_ptr(msg);
44090         msg_conv.is_owned = ptr_is_owned(msg);
44091         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44092         msg_conv = ChannelUpdate_clone(&msg_conv);
44093         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44094         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
44095         uint64_t ret_ref = tag_ptr(ret_copy, true);
44096         return ret_ref;
44097 }
44098
44099 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
44100         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44101         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
44102         uint64_t ret_ref = tag_ptr(ret_copy, true);
44103         return ret_ref;
44104 }
44105
44106 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
44107         LDKPublicKey node_id_ref;
44108         CHECK(node_id->arr_len == 33);
44109         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
44110         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44111         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
44112         uint64_t ret_ref = tag_ptr(ret_copy, true);
44113         return ret_ref;
44114 }
44115
44116 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
44117         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
44118         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
44119         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
44120         return ret_conv;
44121 }
44122
44123 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
44124         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
44125         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
44126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44128         CVec_u8Z_free(ret_var);
44129         return ret_arr;
44130 }
44131
44132 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
44133         LDKu8slice ser_ref;
44134         ser_ref.datalen = ser->arr_len;
44135         ser_ref.data = ser->elems;
44136         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
44137         *ret_conv = NetworkUpdate_read(ser_ref);
44138         FREE(ser);
44139         return tag_ptr(ret_conv, true);
44140 }
44141
44142 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
44143         LDKP2PGossipSync this_obj_conv;
44144         this_obj_conv.inner = untag_ptr(this_obj);
44145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44147         P2PGossipSync_free(this_obj_conv);
44148 }
44149
44150 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
44151         LDKNetworkGraph network_graph_conv;
44152         network_graph_conv.inner = untag_ptr(network_graph);
44153         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44154         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44155         network_graph_conv.is_owned = false;
44156         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44157         CHECK_ACCESS(utxo_lookup_ptr);
44158         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44159         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44160         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44161                 // Manually implement clone for Java trait instances
44162                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44163                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44164                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44165                 }
44166         }
44167         void* logger_ptr = untag_ptr(logger);
44168         CHECK_ACCESS(logger_ptr);
44169         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44170         if (logger_conv.free == LDKLogger_JCalls_free) {
44171                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44172                 LDKLogger_JCalls_cloned(&logger_conv);
44173         }
44174         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
44175         uint64_t ret_ref = 0;
44176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44178         return ret_ref;
44179 }
44180
44181 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
44182         LDKP2PGossipSync this_arg_conv;
44183         this_arg_conv.inner = untag_ptr(this_arg);
44184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44186         this_arg_conv.is_owned = false;
44187         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44188         CHECK_ACCESS(utxo_lookup_ptr);
44189         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44190         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44191         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44192                 // Manually implement clone for Java trait instances
44193                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44194                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44195                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44196                 }
44197         }
44198         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
44199 }
44200
44201 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
44202         LDKNetworkGraph this_arg_conv;
44203         this_arg_conv.inner = untag_ptr(this_arg);
44204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44206         this_arg_conv.is_owned = false;
44207         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
44208         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
44209 }
44210
44211 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
44212         LDKP2PGossipSync this_arg_conv;
44213         this_arg_conv.inner = untag_ptr(this_arg);
44214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44216         this_arg_conv.is_owned = false;
44217         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
44218         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
44219         return tag_ptr(ret_ret, true);
44220 }
44221
44222 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
44223         LDKP2PGossipSync this_arg_conv;
44224         this_arg_conv.inner = untag_ptr(this_arg);
44225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44227         this_arg_conv.is_owned = false;
44228         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
44229         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
44230         return tag_ptr(ret_ret, true);
44231 }
44232
44233 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
44234         LDKChannelUpdateInfo this_obj_conv;
44235         this_obj_conv.inner = untag_ptr(this_obj);
44236         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44238         ChannelUpdateInfo_free(this_obj_conv);
44239 }
44240
44241 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
44242         LDKChannelUpdateInfo this_ptr_conv;
44243         this_ptr_conv.inner = untag_ptr(this_ptr);
44244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44246         this_ptr_conv.is_owned = false;
44247         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
44248         return ret_conv;
44249 }
44250
44251 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
44252         LDKChannelUpdateInfo this_ptr_conv;
44253         this_ptr_conv.inner = untag_ptr(this_ptr);
44254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44256         this_ptr_conv.is_owned = false;
44257         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
44258 }
44259
44260 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
44261         LDKChannelUpdateInfo this_ptr_conv;
44262         this_ptr_conv.inner = untag_ptr(this_ptr);
44263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44265         this_ptr_conv.is_owned = false;
44266         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
44267         return ret_conv;
44268 }
44269
44270 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
44271         LDKChannelUpdateInfo this_ptr_conv;
44272         this_ptr_conv.inner = untag_ptr(this_ptr);
44273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44275         this_ptr_conv.is_owned = false;
44276         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
44277 }
44278
44279 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
44280         LDKChannelUpdateInfo this_ptr_conv;
44281         this_ptr_conv.inner = untag_ptr(this_ptr);
44282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44284         this_ptr_conv.is_owned = false;
44285         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
44286         return ret_conv;
44287 }
44288
44289 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
44290         LDKChannelUpdateInfo this_ptr_conv;
44291         this_ptr_conv.inner = untag_ptr(this_ptr);
44292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44294         this_ptr_conv.is_owned = false;
44295         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
44296 }
44297
44298 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
44299         LDKChannelUpdateInfo this_ptr_conv;
44300         this_ptr_conv.inner = untag_ptr(this_ptr);
44301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44303         this_ptr_conv.is_owned = false;
44304         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
44305         return ret_conv;
44306 }
44307
44308 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
44309         LDKChannelUpdateInfo this_ptr_conv;
44310         this_ptr_conv.inner = untag_ptr(this_ptr);
44311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44313         this_ptr_conv.is_owned = false;
44314         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
44315 }
44316
44317 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
44318         LDKChannelUpdateInfo this_ptr_conv;
44319         this_ptr_conv.inner = untag_ptr(this_ptr);
44320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44322         this_ptr_conv.is_owned = false;
44323         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
44324         return ret_conv;
44325 }
44326
44327 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
44328         LDKChannelUpdateInfo this_ptr_conv;
44329         this_ptr_conv.inner = untag_ptr(this_ptr);
44330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44332         this_ptr_conv.is_owned = false;
44333         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
44334 }
44335
44336 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
44337         LDKChannelUpdateInfo this_ptr_conv;
44338         this_ptr_conv.inner = untag_ptr(this_ptr);
44339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44341         this_ptr_conv.is_owned = false;
44342         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
44343         uint64_t ret_ref = 0;
44344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44346         return ret_ref;
44347 }
44348
44349 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
44350         LDKChannelUpdateInfo this_ptr_conv;
44351         this_ptr_conv.inner = untag_ptr(this_ptr);
44352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44354         this_ptr_conv.is_owned = false;
44355         LDKRoutingFees val_conv;
44356         val_conv.inner = untag_ptr(val);
44357         val_conv.is_owned = ptr_is_owned(val);
44358         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44359         val_conv = RoutingFees_clone(&val_conv);
44360         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
44361 }
44362
44363 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
44364         LDKChannelUpdateInfo this_ptr_conv;
44365         this_ptr_conv.inner = untag_ptr(this_ptr);
44366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44368         this_ptr_conv.is_owned = false;
44369         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
44370         uint64_t ret_ref = 0;
44371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44373         return ret_ref;
44374 }
44375
44376 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
44377         LDKChannelUpdateInfo this_ptr_conv;
44378         this_ptr_conv.inner = untag_ptr(this_ptr);
44379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44381         this_ptr_conv.is_owned = false;
44382         LDKChannelUpdate val_conv;
44383         val_conv.inner = untag_ptr(val);
44384         val_conv.is_owned = ptr_is_owned(val);
44385         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44386         val_conv = ChannelUpdate_clone(&val_conv);
44387         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
44388 }
44389
44390 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) {
44391         LDKRoutingFees fees_arg_conv;
44392         fees_arg_conv.inner = untag_ptr(fees_arg);
44393         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
44394         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
44395         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
44396         LDKChannelUpdate last_update_message_arg_conv;
44397         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
44398         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
44399         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
44400         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
44401         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);
44402         uint64_t ret_ref = 0;
44403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44405         return ret_ref;
44406 }
44407
44408 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
44409         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
44410         uint64_t ret_ref = 0;
44411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44413         return ret_ref;
44414 }
44415 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
44416         LDKChannelUpdateInfo arg_conv;
44417         arg_conv.inner = untag_ptr(arg);
44418         arg_conv.is_owned = ptr_is_owned(arg);
44419         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44420         arg_conv.is_owned = false;
44421         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
44422         return ret_conv;
44423 }
44424
44425 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
44426         LDKChannelUpdateInfo orig_conv;
44427         orig_conv.inner = untag_ptr(orig);
44428         orig_conv.is_owned = ptr_is_owned(orig);
44429         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44430         orig_conv.is_owned = false;
44431         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
44432         uint64_t ret_ref = 0;
44433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44435         return ret_ref;
44436 }
44437
44438 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
44439         LDKChannelUpdateInfo a_conv;
44440         a_conv.inner = untag_ptr(a);
44441         a_conv.is_owned = ptr_is_owned(a);
44442         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44443         a_conv.is_owned = false;
44444         LDKChannelUpdateInfo b_conv;
44445         b_conv.inner = untag_ptr(b);
44446         b_conv.is_owned = ptr_is_owned(b);
44447         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44448         b_conv.is_owned = false;
44449         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
44450         return ret_conv;
44451 }
44452
44453 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
44454         LDKChannelUpdateInfo obj_conv;
44455         obj_conv.inner = untag_ptr(obj);
44456         obj_conv.is_owned = ptr_is_owned(obj);
44457         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44458         obj_conv.is_owned = false;
44459         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
44460         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44461         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44462         CVec_u8Z_free(ret_var);
44463         return ret_arr;
44464 }
44465
44466 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
44467         LDKu8slice ser_ref;
44468         ser_ref.datalen = ser->arr_len;
44469         ser_ref.data = ser->elems;
44470         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
44471         *ret_conv = ChannelUpdateInfo_read(ser_ref);
44472         FREE(ser);
44473         return tag_ptr(ret_conv, true);
44474 }
44475
44476 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
44477         LDKChannelInfo this_obj_conv;
44478         this_obj_conv.inner = untag_ptr(this_obj);
44479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44481         ChannelInfo_free(this_obj_conv);
44482 }
44483
44484 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
44485         LDKChannelInfo this_ptr_conv;
44486         this_ptr_conv.inner = untag_ptr(this_ptr);
44487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44489         this_ptr_conv.is_owned = false;
44490         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
44491         uint64_t ret_ref = 0;
44492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44494         return ret_ref;
44495 }
44496
44497 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
44498         LDKChannelInfo this_ptr_conv;
44499         this_ptr_conv.inner = untag_ptr(this_ptr);
44500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44502         this_ptr_conv.is_owned = false;
44503         LDKChannelFeatures val_conv;
44504         val_conv.inner = untag_ptr(val);
44505         val_conv.is_owned = ptr_is_owned(val);
44506         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44507         val_conv = ChannelFeatures_clone(&val_conv);
44508         ChannelInfo_set_features(&this_ptr_conv, val_conv);
44509 }
44510
44511 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
44512         LDKChannelInfo this_ptr_conv;
44513         this_ptr_conv.inner = untag_ptr(this_ptr);
44514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44516         this_ptr_conv.is_owned = false;
44517         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
44518         uint64_t ret_ref = 0;
44519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44521         return ret_ref;
44522 }
44523
44524 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
44525         LDKChannelInfo this_ptr_conv;
44526         this_ptr_conv.inner = untag_ptr(this_ptr);
44527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44529         this_ptr_conv.is_owned = false;
44530         LDKNodeId val_conv;
44531         val_conv.inner = untag_ptr(val);
44532         val_conv.is_owned = ptr_is_owned(val);
44533         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44534         val_conv = NodeId_clone(&val_conv);
44535         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
44536 }
44537
44538 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
44539         LDKChannelInfo this_ptr_conv;
44540         this_ptr_conv.inner = untag_ptr(this_ptr);
44541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44543         this_ptr_conv.is_owned = false;
44544         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
44545         uint64_t ret_ref = 0;
44546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44548         return ret_ref;
44549 }
44550
44551 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
44552         LDKChannelInfo this_ptr_conv;
44553         this_ptr_conv.inner = untag_ptr(this_ptr);
44554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44556         this_ptr_conv.is_owned = false;
44557         LDKChannelUpdateInfo val_conv;
44558         val_conv.inner = untag_ptr(val);
44559         val_conv.is_owned = ptr_is_owned(val);
44560         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44561         val_conv = ChannelUpdateInfo_clone(&val_conv);
44562         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
44563 }
44564
44565 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
44566         LDKChannelInfo this_ptr_conv;
44567         this_ptr_conv.inner = untag_ptr(this_ptr);
44568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44570         this_ptr_conv.is_owned = false;
44571         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
44572         uint64_t ret_ref = 0;
44573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44575         return ret_ref;
44576 }
44577
44578 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
44579         LDKChannelInfo this_ptr_conv;
44580         this_ptr_conv.inner = untag_ptr(this_ptr);
44581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44583         this_ptr_conv.is_owned = false;
44584         LDKNodeId val_conv;
44585         val_conv.inner = untag_ptr(val);
44586         val_conv.is_owned = ptr_is_owned(val);
44587         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44588         val_conv = NodeId_clone(&val_conv);
44589         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
44590 }
44591
44592 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
44593         LDKChannelInfo this_ptr_conv;
44594         this_ptr_conv.inner = untag_ptr(this_ptr);
44595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44597         this_ptr_conv.is_owned = false;
44598         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
44599         uint64_t ret_ref = 0;
44600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44602         return ret_ref;
44603 }
44604
44605 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
44606         LDKChannelInfo this_ptr_conv;
44607         this_ptr_conv.inner = untag_ptr(this_ptr);
44608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44610         this_ptr_conv.is_owned = false;
44611         LDKChannelUpdateInfo val_conv;
44612         val_conv.inner = untag_ptr(val);
44613         val_conv.is_owned = ptr_is_owned(val);
44614         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44615         val_conv = ChannelUpdateInfo_clone(&val_conv);
44616         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
44617 }
44618
44619 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
44620         LDKChannelInfo this_ptr_conv;
44621         this_ptr_conv.inner = untag_ptr(this_ptr);
44622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44624         this_ptr_conv.is_owned = false;
44625         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44626         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
44627         uint64_t ret_ref = tag_ptr(ret_copy, true);
44628         return ret_ref;
44629 }
44630
44631 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
44632         LDKChannelInfo this_ptr_conv;
44633         this_ptr_conv.inner = untag_ptr(this_ptr);
44634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44636         this_ptr_conv.is_owned = false;
44637         void* val_ptr = untag_ptr(val);
44638         CHECK_ACCESS(val_ptr);
44639         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44640         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44641         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
44642 }
44643
44644 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
44645         LDKChannelInfo this_ptr_conv;
44646         this_ptr_conv.inner = untag_ptr(this_ptr);
44647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44649         this_ptr_conv.is_owned = false;
44650         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
44651         uint64_t ret_ref = 0;
44652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44654         return ret_ref;
44655 }
44656
44657 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
44658         LDKChannelInfo this_ptr_conv;
44659         this_ptr_conv.inner = untag_ptr(this_ptr);
44660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44662         this_ptr_conv.is_owned = false;
44663         LDKChannelAnnouncement val_conv;
44664         val_conv.inner = untag_ptr(val);
44665         val_conv.is_owned = ptr_is_owned(val);
44666         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44667         val_conv = ChannelAnnouncement_clone(&val_conv);
44668         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
44669 }
44670
44671 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
44672         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
44673         uint64_t ret_ref = 0;
44674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44676         return ret_ref;
44677 }
44678 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
44679         LDKChannelInfo arg_conv;
44680         arg_conv.inner = untag_ptr(arg);
44681         arg_conv.is_owned = ptr_is_owned(arg);
44682         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44683         arg_conv.is_owned = false;
44684         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
44685         return ret_conv;
44686 }
44687
44688 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
44689         LDKChannelInfo orig_conv;
44690         orig_conv.inner = untag_ptr(orig);
44691         orig_conv.is_owned = ptr_is_owned(orig);
44692         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44693         orig_conv.is_owned = false;
44694         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
44695         uint64_t ret_ref = 0;
44696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44698         return ret_ref;
44699 }
44700
44701 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
44702         LDKChannelInfo a_conv;
44703         a_conv.inner = untag_ptr(a);
44704         a_conv.is_owned = ptr_is_owned(a);
44705         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44706         a_conv.is_owned = false;
44707         LDKChannelInfo b_conv;
44708         b_conv.inner = untag_ptr(b);
44709         b_conv.is_owned = ptr_is_owned(b);
44710         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44711         b_conv.is_owned = false;
44712         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
44713         return ret_conv;
44714 }
44715
44716 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
44717         LDKChannelInfo this_arg_conv;
44718         this_arg_conv.inner = untag_ptr(this_arg);
44719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44721         this_arg_conv.is_owned = false;
44722         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
44723         uint64_t ret_ref = 0;
44724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44726         return ret_ref;
44727 }
44728
44729 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
44730         LDKChannelInfo obj_conv;
44731         obj_conv.inner = untag_ptr(obj);
44732         obj_conv.is_owned = ptr_is_owned(obj);
44733         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44734         obj_conv.is_owned = false;
44735         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
44736         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44737         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44738         CVec_u8Z_free(ret_var);
44739         return ret_arr;
44740 }
44741
44742 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
44743         LDKu8slice ser_ref;
44744         ser_ref.datalen = ser->arr_len;
44745         ser_ref.data = ser->elems;
44746         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
44747         *ret_conv = ChannelInfo_read(ser_ref);
44748         FREE(ser);
44749         return tag_ptr(ret_conv, true);
44750 }
44751
44752 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
44753         LDKDirectedChannelInfo this_obj_conv;
44754         this_obj_conv.inner = untag_ptr(this_obj);
44755         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44757         DirectedChannelInfo_free(this_obj_conv);
44758 }
44759
44760 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
44761         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
44762         uint64_t ret_ref = 0;
44763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44765         return ret_ref;
44766 }
44767 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
44768         LDKDirectedChannelInfo arg_conv;
44769         arg_conv.inner = untag_ptr(arg);
44770         arg_conv.is_owned = ptr_is_owned(arg);
44771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44772         arg_conv.is_owned = false;
44773         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
44774         return ret_conv;
44775 }
44776
44777 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
44778         LDKDirectedChannelInfo orig_conv;
44779         orig_conv.inner = untag_ptr(orig);
44780         orig_conv.is_owned = ptr_is_owned(orig);
44781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44782         orig_conv.is_owned = false;
44783         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
44784         uint64_t ret_ref = 0;
44785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44787         return ret_ref;
44788 }
44789
44790 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
44791         LDKDirectedChannelInfo this_arg_conv;
44792         this_arg_conv.inner = untag_ptr(this_arg);
44793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44795         this_arg_conv.is_owned = false;
44796         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
44797         uint64_t ret_ref = 0;
44798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44800         return ret_ref;
44801 }
44802
44803 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
44804         LDKDirectedChannelInfo this_arg_conv;
44805         this_arg_conv.inner = untag_ptr(this_arg);
44806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44808         this_arg_conv.is_owned = false;
44809         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
44810         return ret_conv;
44811 }
44812
44813 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
44814         LDKDirectedChannelInfo this_arg_conv;
44815         this_arg_conv.inner = untag_ptr(this_arg);
44816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44818         this_arg_conv.is_owned = false;
44819         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44820         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
44821         uint64_t ret_ref = tag_ptr(ret_copy, true);
44822         return ret_ref;
44823 }
44824
44825 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
44826         if (!ptr_is_owned(this_ptr)) return;
44827         void* this_ptr_ptr = untag_ptr(this_ptr);
44828         CHECK_ACCESS(this_ptr_ptr);
44829         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
44830         FREE(untag_ptr(this_ptr));
44831         EffectiveCapacity_free(this_ptr_conv);
44832 }
44833
44834 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
44835         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44836         *ret_copy = EffectiveCapacity_clone(arg);
44837         uint64_t ret_ref = tag_ptr(ret_copy, true);
44838         return ret_ref;
44839 }
44840 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
44841         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
44842         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
44843         return ret_conv;
44844 }
44845
44846 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
44847         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
44848         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44849         *ret_copy = EffectiveCapacity_clone(orig_conv);
44850         uint64_t ret_ref = tag_ptr(ret_copy, true);
44851         return ret_ref;
44852 }
44853
44854 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
44855         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44856         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
44857         uint64_t ret_ref = tag_ptr(ret_copy, true);
44858         return ret_ref;
44859 }
44860
44861 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
44862         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44863         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
44864         uint64_t ret_ref = tag_ptr(ret_copy, true);
44865         return ret_ref;
44866 }
44867
44868 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
44869         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44870         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
44871         uint64_t ret_ref = tag_ptr(ret_copy, true);
44872         return ret_ref;
44873 }
44874
44875 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
44876         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44877         *ret_copy = EffectiveCapacity_infinite();
44878         uint64_t ret_ref = tag_ptr(ret_copy, true);
44879         return ret_ref;
44880 }
44881
44882 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
44883         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44884         *ret_copy = EffectiveCapacity_unknown();
44885         uint64_t ret_ref = tag_ptr(ret_copy, true);
44886         return ret_ref;
44887 }
44888
44889 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
44890         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
44891         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
44892         return ret_conv;
44893 }
44894
44895 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
44896         LDKRoutingFees this_obj_conv;
44897         this_obj_conv.inner = untag_ptr(this_obj);
44898         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44900         RoutingFees_free(this_obj_conv);
44901 }
44902
44903 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
44904         LDKRoutingFees this_ptr_conv;
44905         this_ptr_conv.inner = untag_ptr(this_ptr);
44906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44908         this_ptr_conv.is_owned = false;
44909         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
44910         return ret_conv;
44911 }
44912
44913 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
44914         LDKRoutingFees this_ptr_conv;
44915         this_ptr_conv.inner = untag_ptr(this_ptr);
44916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44918         this_ptr_conv.is_owned = false;
44919         RoutingFees_set_base_msat(&this_ptr_conv, val);
44920 }
44921
44922 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
44923         LDKRoutingFees this_ptr_conv;
44924         this_ptr_conv.inner = untag_ptr(this_ptr);
44925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44927         this_ptr_conv.is_owned = false;
44928         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
44929         return ret_conv;
44930 }
44931
44932 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
44933         LDKRoutingFees this_ptr_conv;
44934         this_ptr_conv.inner = untag_ptr(this_ptr);
44935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44937         this_ptr_conv.is_owned = false;
44938         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
44939 }
44940
44941 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
44942         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
44943         uint64_t ret_ref = 0;
44944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44946         return ret_ref;
44947 }
44948
44949 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
44950         LDKRoutingFees a_conv;
44951         a_conv.inner = untag_ptr(a);
44952         a_conv.is_owned = ptr_is_owned(a);
44953         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44954         a_conv.is_owned = false;
44955         LDKRoutingFees b_conv;
44956         b_conv.inner = untag_ptr(b);
44957         b_conv.is_owned = ptr_is_owned(b);
44958         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44959         b_conv.is_owned = false;
44960         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
44961         return ret_conv;
44962 }
44963
44964 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
44965         LDKRoutingFees ret_var = RoutingFees_clone(arg);
44966         uint64_t ret_ref = 0;
44967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44969         return ret_ref;
44970 }
44971 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
44972         LDKRoutingFees arg_conv;
44973         arg_conv.inner = untag_ptr(arg);
44974         arg_conv.is_owned = ptr_is_owned(arg);
44975         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44976         arg_conv.is_owned = false;
44977         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
44978         return ret_conv;
44979 }
44980
44981 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
44982         LDKRoutingFees orig_conv;
44983         orig_conv.inner = untag_ptr(orig);
44984         orig_conv.is_owned = ptr_is_owned(orig);
44985         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44986         orig_conv.is_owned = false;
44987         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
44988         uint64_t ret_ref = 0;
44989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44991         return ret_ref;
44992 }
44993
44994 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
44995         LDKRoutingFees o_conv;
44996         o_conv.inner = untag_ptr(o);
44997         o_conv.is_owned = ptr_is_owned(o);
44998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44999         o_conv.is_owned = false;
45000         int64_t ret_conv = RoutingFees_hash(&o_conv);
45001         return ret_conv;
45002 }
45003
45004 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
45005         LDKRoutingFees obj_conv;
45006         obj_conv.inner = untag_ptr(obj);
45007         obj_conv.is_owned = ptr_is_owned(obj);
45008         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45009         obj_conv.is_owned = false;
45010         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
45011         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45012         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45013         CVec_u8Z_free(ret_var);
45014         return ret_arr;
45015 }
45016
45017 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
45018         LDKu8slice ser_ref;
45019         ser_ref.datalen = ser->arr_len;
45020         ser_ref.data = ser->elems;
45021         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
45022         *ret_conv = RoutingFees_read(ser_ref);
45023         FREE(ser);
45024         return tag_ptr(ret_conv, true);
45025 }
45026
45027 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
45028         LDKNodeAnnouncementInfo this_obj_conv;
45029         this_obj_conv.inner = untag_ptr(this_obj);
45030         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45032         NodeAnnouncementInfo_free(this_obj_conv);
45033 }
45034
45035 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
45036         LDKNodeAnnouncementInfo this_ptr_conv;
45037         this_ptr_conv.inner = untag_ptr(this_ptr);
45038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45040         this_ptr_conv.is_owned = false;
45041         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
45042         uint64_t ret_ref = 0;
45043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45045         return ret_ref;
45046 }
45047
45048 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
45049         LDKNodeAnnouncementInfo this_ptr_conv;
45050         this_ptr_conv.inner = untag_ptr(this_ptr);
45051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45053         this_ptr_conv.is_owned = false;
45054         LDKNodeFeatures val_conv;
45055         val_conv.inner = untag_ptr(val);
45056         val_conv.is_owned = ptr_is_owned(val);
45057         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45058         val_conv = NodeFeatures_clone(&val_conv);
45059         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
45060 }
45061
45062 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
45063         LDKNodeAnnouncementInfo this_ptr_conv;
45064         this_ptr_conv.inner = untag_ptr(this_ptr);
45065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45067         this_ptr_conv.is_owned = false;
45068         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
45069         return ret_conv;
45070 }
45071
45072 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
45073         LDKNodeAnnouncementInfo this_ptr_conv;
45074         this_ptr_conv.inner = untag_ptr(this_ptr);
45075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45077         this_ptr_conv.is_owned = false;
45078         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
45079 }
45080
45081 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
45082         LDKNodeAnnouncementInfo this_ptr_conv;
45083         this_ptr_conv.inner = untag_ptr(this_ptr);
45084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45086         this_ptr_conv.is_owned = false;
45087         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
45088         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
45089         return ret_arr;
45090 }
45091
45092 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
45093         LDKNodeAnnouncementInfo this_ptr_conv;
45094         this_ptr_conv.inner = untag_ptr(this_ptr);
45095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45097         this_ptr_conv.is_owned = false;
45098         LDKThreeBytes val_ref;
45099         CHECK(val->arr_len == 3);
45100         memcpy(val_ref.data, val->elems, 3); FREE(val);
45101         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
45102 }
45103
45104 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
45105         LDKNodeAnnouncementInfo this_ptr_conv;
45106         this_ptr_conv.inner = untag_ptr(this_ptr);
45107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45109         this_ptr_conv.is_owned = false;
45110         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
45111         uint64_t ret_ref = 0;
45112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45114         return ret_ref;
45115 }
45116
45117 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
45118         LDKNodeAnnouncementInfo this_ptr_conv;
45119         this_ptr_conv.inner = untag_ptr(this_ptr);
45120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45122         this_ptr_conv.is_owned = false;
45123         LDKNodeAlias val_conv;
45124         val_conv.inner = untag_ptr(val);
45125         val_conv.is_owned = ptr_is_owned(val);
45126         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45127         val_conv = NodeAlias_clone(&val_conv);
45128         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
45129 }
45130
45131 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
45132         LDKNodeAnnouncementInfo this_ptr_conv;
45133         this_ptr_conv.inner = untag_ptr(this_ptr);
45134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45136         this_ptr_conv.is_owned = false;
45137         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
45138         uint64_t ret_ref = 0;
45139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45141         return ret_ref;
45142 }
45143
45144 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
45145         LDKNodeAnnouncementInfo this_ptr_conv;
45146         this_ptr_conv.inner = untag_ptr(this_ptr);
45147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45149         this_ptr_conv.is_owned = false;
45150         LDKNodeAnnouncement val_conv;
45151         val_conv.inner = untag_ptr(val);
45152         val_conv.is_owned = ptr_is_owned(val);
45153         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45154         val_conv = NodeAnnouncement_clone(&val_conv);
45155         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
45156 }
45157
45158 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) {
45159         LDKNodeFeatures features_arg_conv;
45160         features_arg_conv.inner = untag_ptr(features_arg);
45161         features_arg_conv.is_owned = ptr_is_owned(features_arg);
45162         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45163         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
45164         LDKThreeBytes rgb_arg_ref;
45165         CHECK(rgb_arg->arr_len == 3);
45166         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
45167         LDKNodeAlias alias_arg_conv;
45168         alias_arg_conv.inner = untag_ptr(alias_arg);
45169         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
45170         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
45171         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
45172         LDKNodeAnnouncement announcement_message_arg_conv;
45173         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
45174         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
45175         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
45176         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
45177         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
45178         uint64_t ret_ref = 0;
45179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45181         return ret_ref;
45182 }
45183
45184 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
45185         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
45186         uint64_t ret_ref = 0;
45187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45189         return ret_ref;
45190 }
45191 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
45192         LDKNodeAnnouncementInfo arg_conv;
45193         arg_conv.inner = untag_ptr(arg);
45194         arg_conv.is_owned = ptr_is_owned(arg);
45195         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45196         arg_conv.is_owned = false;
45197         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
45198         return ret_conv;
45199 }
45200
45201 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
45202         LDKNodeAnnouncementInfo orig_conv;
45203         orig_conv.inner = untag_ptr(orig);
45204         orig_conv.is_owned = ptr_is_owned(orig);
45205         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45206         orig_conv.is_owned = false;
45207         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
45208         uint64_t ret_ref = 0;
45209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45211         return ret_ref;
45212 }
45213
45214 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
45215         LDKNodeAnnouncementInfo a_conv;
45216         a_conv.inner = untag_ptr(a);
45217         a_conv.is_owned = ptr_is_owned(a);
45218         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45219         a_conv.is_owned = false;
45220         LDKNodeAnnouncementInfo b_conv;
45221         b_conv.inner = untag_ptr(b);
45222         b_conv.is_owned = ptr_is_owned(b);
45223         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45224         b_conv.is_owned = false;
45225         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
45226         return ret_conv;
45227 }
45228
45229 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
45230         LDKNodeAnnouncementInfo this_arg_conv;
45231         this_arg_conv.inner = untag_ptr(this_arg);
45232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45234         this_arg_conv.is_owned = false;
45235         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
45236         uint64_tArray ret_arr = NULL;
45237         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45238         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45239         for (size_t m = 0; m < ret_var.datalen; m++) {
45240                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45241                 *ret_conv_12_copy = ret_var.data[m];
45242                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
45243                 ret_arr_ptr[m] = ret_conv_12_ref;
45244         }
45245         
45246         FREE(ret_var.data);
45247         return ret_arr;
45248 }
45249
45250 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
45251         LDKNodeAnnouncementInfo obj_conv;
45252         obj_conv.inner = untag_ptr(obj);
45253         obj_conv.is_owned = ptr_is_owned(obj);
45254         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45255         obj_conv.is_owned = false;
45256         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
45257         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45258         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45259         CVec_u8Z_free(ret_var);
45260         return ret_arr;
45261 }
45262
45263 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
45264         LDKu8slice ser_ref;
45265         ser_ref.datalen = ser->arr_len;
45266         ser_ref.data = ser->elems;
45267         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
45268         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
45269         FREE(ser);
45270         return tag_ptr(ret_conv, true);
45271 }
45272
45273 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
45274         LDKNodeAlias this_obj_conv;
45275         this_obj_conv.inner = untag_ptr(this_obj);
45276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45278         NodeAlias_free(this_obj_conv);
45279 }
45280
45281 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
45282         LDKNodeAlias this_ptr_conv;
45283         this_ptr_conv.inner = untag_ptr(this_ptr);
45284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45286         this_ptr_conv.is_owned = false;
45287         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45288         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
45289         return ret_arr;
45290 }
45291
45292 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
45293         LDKNodeAlias this_ptr_conv;
45294         this_ptr_conv.inner = untag_ptr(this_ptr);
45295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45297         this_ptr_conv.is_owned = false;
45298         LDKThirtyTwoBytes val_ref;
45299         CHECK(val->arr_len == 32);
45300         memcpy(val_ref.data, val->elems, 32); FREE(val);
45301         NodeAlias_set_a(&this_ptr_conv, val_ref);
45302 }
45303
45304 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
45305         LDKThirtyTwoBytes a_arg_ref;
45306         CHECK(a_arg->arr_len == 32);
45307         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
45308         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
45309         uint64_t ret_ref = 0;
45310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45312         return ret_ref;
45313 }
45314
45315 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
45316         LDKNodeAlias ret_var = NodeAlias_clone(arg);
45317         uint64_t ret_ref = 0;
45318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45320         return ret_ref;
45321 }
45322 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
45323         LDKNodeAlias arg_conv;
45324         arg_conv.inner = untag_ptr(arg);
45325         arg_conv.is_owned = ptr_is_owned(arg);
45326         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45327         arg_conv.is_owned = false;
45328         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
45329         return ret_conv;
45330 }
45331
45332 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
45333         LDKNodeAlias orig_conv;
45334         orig_conv.inner = untag_ptr(orig);
45335         orig_conv.is_owned = ptr_is_owned(orig);
45336         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45337         orig_conv.is_owned = false;
45338         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
45339         uint64_t ret_ref = 0;
45340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45342         return ret_ref;
45343 }
45344
45345 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
45346         LDKNodeAlias a_conv;
45347         a_conv.inner = untag_ptr(a);
45348         a_conv.is_owned = ptr_is_owned(a);
45349         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45350         a_conv.is_owned = false;
45351         LDKNodeAlias b_conv;
45352         b_conv.inner = untag_ptr(b);
45353         b_conv.is_owned = ptr_is_owned(b);
45354         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45355         b_conv.is_owned = false;
45356         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
45357         return ret_conv;
45358 }
45359
45360 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
45361         LDKNodeAlias obj_conv;
45362         obj_conv.inner = untag_ptr(obj);
45363         obj_conv.is_owned = ptr_is_owned(obj);
45364         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45365         obj_conv.is_owned = false;
45366         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
45367         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45368         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45369         CVec_u8Z_free(ret_var);
45370         return ret_arr;
45371 }
45372
45373 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
45374         LDKu8slice ser_ref;
45375         ser_ref.datalen = ser->arr_len;
45376         ser_ref.data = ser->elems;
45377         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
45378         *ret_conv = NodeAlias_read(ser_ref);
45379         FREE(ser);
45380         return tag_ptr(ret_conv, true);
45381 }
45382
45383 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
45384         LDKNodeInfo this_obj_conv;
45385         this_obj_conv.inner = untag_ptr(this_obj);
45386         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45388         NodeInfo_free(this_obj_conv);
45389 }
45390
45391 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
45392         LDKNodeInfo this_ptr_conv;
45393         this_ptr_conv.inner = untag_ptr(this_ptr);
45394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45396         this_ptr_conv.is_owned = false;
45397         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
45398         int64_tArray ret_arr = NULL;
45399         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45400         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45401         for (size_t i = 0; i < ret_var.datalen; i++) {
45402                 int64_t ret_conv_8_conv = ret_var.data[i];
45403                 ret_arr_ptr[i] = ret_conv_8_conv;
45404         }
45405         
45406         FREE(ret_var.data);
45407         return ret_arr;
45408 }
45409
45410 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
45411         LDKNodeInfo this_ptr_conv;
45412         this_ptr_conv.inner = untag_ptr(this_ptr);
45413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45415         this_ptr_conv.is_owned = false;
45416         LDKCVec_u64Z val_constr;
45417         val_constr.datalen = val->arr_len;
45418         if (val_constr.datalen > 0)
45419                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45420         else
45421                 val_constr.data = NULL;
45422         int64_t* val_vals = val->elems;
45423         for (size_t i = 0; i < val_constr.datalen; i++) {
45424                 int64_t val_conv_8 = val_vals[i];
45425                 val_constr.data[i] = val_conv_8;
45426         }
45427         FREE(val);
45428         NodeInfo_set_channels(&this_ptr_conv, val_constr);
45429 }
45430
45431 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
45432         LDKNodeInfo this_ptr_conv;
45433         this_ptr_conv.inner = untag_ptr(this_ptr);
45434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45436         this_ptr_conv.is_owned = false;
45437         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
45438         uint64_t ret_ref = 0;
45439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45441         return ret_ref;
45442 }
45443
45444 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
45445         LDKNodeInfo this_ptr_conv;
45446         this_ptr_conv.inner = untag_ptr(this_ptr);
45447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45449         this_ptr_conv.is_owned = false;
45450         LDKNodeAnnouncementInfo val_conv;
45451         val_conv.inner = untag_ptr(val);
45452         val_conv.is_owned = ptr_is_owned(val);
45453         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45454         val_conv = NodeAnnouncementInfo_clone(&val_conv);
45455         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
45456 }
45457
45458 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
45459         LDKCVec_u64Z channels_arg_constr;
45460         channels_arg_constr.datalen = channels_arg->arr_len;
45461         if (channels_arg_constr.datalen > 0)
45462                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45463         else
45464                 channels_arg_constr.data = NULL;
45465         int64_t* channels_arg_vals = channels_arg->elems;
45466         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
45467                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
45468                 channels_arg_constr.data[i] = channels_arg_conv_8;
45469         }
45470         FREE(channels_arg);
45471         LDKNodeAnnouncementInfo announcement_info_arg_conv;
45472         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
45473         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
45474         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
45475         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
45476         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
45477         uint64_t ret_ref = 0;
45478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45480         return ret_ref;
45481 }
45482
45483 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
45484         LDKNodeInfo ret_var = NodeInfo_clone(arg);
45485         uint64_t ret_ref = 0;
45486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45488         return ret_ref;
45489 }
45490 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
45491         LDKNodeInfo arg_conv;
45492         arg_conv.inner = untag_ptr(arg);
45493         arg_conv.is_owned = ptr_is_owned(arg);
45494         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45495         arg_conv.is_owned = false;
45496         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
45497         return ret_conv;
45498 }
45499
45500 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
45501         LDKNodeInfo orig_conv;
45502         orig_conv.inner = untag_ptr(orig);
45503         orig_conv.is_owned = ptr_is_owned(orig);
45504         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45505         orig_conv.is_owned = false;
45506         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
45507         uint64_t ret_ref = 0;
45508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45510         return ret_ref;
45511 }
45512
45513 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
45514         LDKNodeInfo a_conv;
45515         a_conv.inner = untag_ptr(a);
45516         a_conv.is_owned = ptr_is_owned(a);
45517         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45518         a_conv.is_owned = false;
45519         LDKNodeInfo b_conv;
45520         b_conv.inner = untag_ptr(b);
45521         b_conv.is_owned = ptr_is_owned(b);
45522         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45523         b_conv.is_owned = false;
45524         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
45525         return ret_conv;
45526 }
45527
45528 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
45529         LDKNodeInfo obj_conv;
45530         obj_conv.inner = untag_ptr(obj);
45531         obj_conv.is_owned = ptr_is_owned(obj);
45532         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45533         obj_conv.is_owned = false;
45534         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
45535         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45536         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45537         CVec_u8Z_free(ret_var);
45538         return ret_arr;
45539 }
45540
45541 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
45542         LDKu8slice ser_ref;
45543         ser_ref.datalen = ser->arr_len;
45544         ser_ref.data = ser->elems;
45545         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
45546         *ret_conv = NodeInfo_read(ser_ref);
45547         FREE(ser);
45548         return tag_ptr(ret_conv, true);
45549 }
45550
45551 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
45552         LDKNetworkGraph obj_conv;
45553         obj_conv.inner = untag_ptr(obj);
45554         obj_conv.is_owned = ptr_is_owned(obj);
45555         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45556         obj_conv.is_owned = false;
45557         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
45558         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45559         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45560         CVec_u8Z_free(ret_var);
45561         return ret_arr;
45562 }
45563
45564 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
45565         LDKu8slice ser_ref;
45566         ser_ref.datalen = ser->arr_len;
45567         ser_ref.data = ser->elems;
45568         void* arg_ptr = untag_ptr(arg);
45569         CHECK_ACCESS(arg_ptr);
45570         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
45571         if (arg_conv.free == LDKLogger_JCalls_free) {
45572                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45573                 LDKLogger_JCalls_cloned(&arg_conv);
45574         }
45575         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
45576         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
45577         FREE(ser);
45578         return tag_ptr(ret_conv, true);
45579 }
45580
45581 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
45582         LDKNetwork network_conv = LDKNetwork_from_js(network);
45583         void* logger_ptr = untag_ptr(logger);
45584         CHECK_ACCESS(logger_ptr);
45585         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45586         if (logger_conv.free == LDKLogger_JCalls_free) {
45587                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45588                 LDKLogger_JCalls_cloned(&logger_conv);
45589         }
45590         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
45591         uint64_t ret_ref = 0;
45592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45594         return ret_ref;
45595 }
45596
45597 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
45598         LDKNetworkGraph this_arg_conv;
45599         this_arg_conv.inner = untag_ptr(this_arg);
45600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45602         this_arg_conv.is_owned = false;
45603         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
45604         uint64_t ret_ref = 0;
45605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45607         return ret_ref;
45608 }
45609
45610 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) {
45611         LDKNetworkGraph this_arg_conv;
45612         this_arg_conv.inner = untag_ptr(this_arg);
45613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45615         this_arg_conv.is_owned = false;
45616         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45617         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
45618         uint64_t ret_ref = tag_ptr(ret_copy, true);
45619         return ret_ref;
45620 }
45621
45622 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) {
45623         LDKNetworkGraph this_arg_conv;
45624         this_arg_conv.inner = untag_ptr(this_arg);
45625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45627         this_arg_conv.is_owned = false;
45628         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
45629 }
45630
45631 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
45632         LDKNetworkGraph this_arg_conv;
45633         this_arg_conv.inner = untag_ptr(this_arg);
45634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45636         this_arg_conv.is_owned = false;
45637         LDKNodeAnnouncement msg_conv;
45638         msg_conv.inner = untag_ptr(msg);
45639         msg_conv.is_owned = ptr_is_owned(msg);
45640         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45641         msg_conv.is_owned = false;
45642         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45643         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
45644         return tag_ptr(ret_conv, true);
45645 }
45646
45647 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) {
45648         LDKNetworkGraph this_arg_conv;
45649         this_arg_conv.inner = untag_ptr(this_arg);
45650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45652         this_arg_conv.is_owned = false;
45653         LDKUnsignedNodeAnnouncement msg_conv;
45654         msg_conv.inner = untag_ptr(msg);
45655         msg_conv.is_owned = ptr_is_owned(msg);
45656         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45657         msg_conv.is_owned = false;
45658         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45659         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
45660         return tag_ptr(ret_conv, true);
45661 }
45662
45663 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) {
45664         LDKNetworkGraph this_arg_conv;
45665         this_arg_conv.inner = untag_ptr(this_arg);
45666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45668         this_arg_conv.is_owned = false;
45669         LDKChannelAnnouncement msg_conv;
45670         msg_conv.inner = untag_ptr(msg);
45671         msg_conv.is_owned = ptr_is_owned(msg);
45672         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45673         msg_conv.is_owned = false;
45674         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
45675         CHECK_ACCESS(utxo_lookup_ptr);
45676         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
45677         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
45678         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
45679                 // Manually implement clone for Java trait instances
45680                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
45681                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45682                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
45683                 }
45684         }
45685         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45686         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
45687         return tag_ptr(ret_conv, true);
45688 }
45689
45690 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) {
45691         LDKNetworkGraph this_arg_conv;
45692         this_arg_conv.inner = untag_ptr(this_arg);
45693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45695         this_arg_conv.is_owned = false;
45696         LDKUnsignedChannelAnnouncement msg_conv;
45697         msg_conv.inner = untag_ptr(msg);
45698         msg_conv.is_owned = ptr_is_owned(msg);
45699         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45700         msg_conv.is_owned = false;
45701         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
45702         CHECK_ACCESS(utxo_lookup_ptr);
45703         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
45704         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
45705         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
45706                 // Manually implement clone for Java trait instances
45707                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
45708                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45709                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
45710                 }
45711         }
45712         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45713         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
45714         return tag_ptr(ret_conv, true);
45715 }
45716
45717 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) {
45718         LDKNetworkGraph this_arg_conv;
45719         this_arg_conv.inner = untag_ptr(this_arg);
45720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45722         this_arg_conv.is_owned = false;
45723         LDKChannelFeatures features_conv;
45724         features_conv.inner = untag_ptr(features);
45725         features_conv.is_owned = ptr_is_owned(features);
45726         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
45727         features_conv = ChannelFeatures_clone(&features_conv);
45728         LDKPublicKey node_id_1_ref;
45729         CHECK(node_id_1->arr_len == 33);
45730         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
45731         LDKPublicKey node_id_2_ref;
45732         CHECK(node_id_2->arr_len == 33);
45733         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
45734         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45735         *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);
45736         return tag_ptr(ret_conv, true);
45737 }
45738
45739 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
45740         LDKNetworkGraph this_arg_conv;
45741         this_arg_conv.inner = untag_ptr(this_arg);
45742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45744         this_arg_conv.is_owned = false;
45745         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
45746 }
45747
45748 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
45749         LDKNetworkGraph this_arg_conv;
45750         this_arg_conv.inner = untag_ptr(this_arg);
45751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45753         this_arg_conv.is_owned = false;
45754         LDKPublicKey node_id_ref;
45755         CHECK(node_id->arr_len == 33);
45756         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
45757         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
45758 }
45759
45760 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) {
45761         LDKNetworkGraph this_arg_conv;
45762         this_arg_conv.inner = untag_ptr(this_arg);
45763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45765         this_arg_conv.is_owned = false;
45766         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
45767 }
45768
45769 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
45770         LDKNetworkGraph this_arg_conv;
45771         this_arg_conv.inner = untag_ptr(this_arg);
45772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45774         this_arg_conv.is_owned = false;
45775         LDKChannelUpdate msg_conv;
45776         msg_conv.inner = untag_ptr(msg);
45777         msg_conv.is_owned = ptr_is_owned(msg);
45778         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45779         msg_conv.is_owned = false;
45780         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45781         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
45782         return tag_ptr(ret_conv, true);
45783 }
45784
45785 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
45786         LDKNetworkGraph this_arg_conv;
45787         this_arg_conv.inner = untag_ptr(this_arg);
45788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45790         this_arg_conv.is_owned = false;
45791         LDKUnsignedChannelUpdate msg_conv;
45792         msg_conv.inner = untag_ptr(msg);
45793         msg_conv.is_owned = ptr_is_owned(msg);
45794         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45795         msg_conv.is_owned = false;
45796         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45797         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
45798         return tag_ptr(ret_conv, true);
45799 }
45800
45801 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
45802         LDKReadOnlyNetworkGraph this_arg_conv;
45803         this_arg_conv.inner = untag_ptr(this_arg);
45804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45806         this_arg_conv.is_owned = false;
45807         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
45808         uint64_t ret_ref = 0;
45809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45811         return ret_ref;
45812 }
45813
45814 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
45815         LDKReadOnlyNetworkGraph this_arg_conv;
45816         this_arg_conv.inner = untag_ptr(this_arg);
45817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45819         this_arg_conv.is_owned = false;
45820         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
45821         int64_tArray ret_arr = NULL;
45822         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45823         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45824         for (size_t i = 0; i < ret_var.datalen; i++) {
45825                 int64_t ret_conv_8_conv = ret_var.data[i];
45826                 ret_arr_ptr[i] = ret_conv_8_conv;
45827         }
45828         
45829         FREE(ret_var.data);
45830         return ret_arr;
45831 }
45832
45833 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
45834         LDKReadOnlyNetworkGraph this_arg_conv;
45835         this_arg_conv.inner = untag_ptr(this_arg);
45836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45838         this_arg_conv.is_owned = false;
45839         LDKNodeId node_id_conv;
45840         node_id_conv.inner = untag_ptr(node_id);
45841         node_id_conv.is_owned = ptr_is_owned(node_id);
45842         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45843         node_id_conv.is_owned = false;
45844         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
45845         uint64_t ret_ref = 0;
45846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45848         return ret_ref;
45849 }
45850
45851 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
45852         LDKReadOnlyNetworkGraph this_arg_conv;
45853         this_arg_conv.inner = untag_ptr(this_arg);
45854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45856         this_arg_conv.is_owned = false;
45857         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
45858         uint64_tArray ret_arr = NULL;
45859         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45860         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45861         for (size_t i = 0; i < ret_var.datalen; i++) {
45862                 LDKNodeId ret_conv_8_var = ret_var.data[i];
45863                 uint64_t ret_conv_8_ref = 0;
45864                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
45865                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
45866                 ret_arr_ptr[i] = ret_conv_8_ref;
45867         }
45868         
45869         FREE(ret_var.data);
45870         return ret_arr;
45871 }
45872
45873 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
45874         LDKReadOnlyNetworkGraph this_arg_conv;
45875         this_arg_conv.inner = untag_ptr(this_arg);
45876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45878         this_arg_conv.is_owned = false;
45879         LDKPublicKey pubkey_ref;
45880         CHECK(pubkey->arr_len == 33);
45881         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
45882         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
45883         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
45884         uint64_t ret_ref = tag_ptr(ret_copy, true);
45885         return ret_ref;
45886 }
45887
45888 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
45889         LDKDefaultRouter this_obj_conv;
45890         this_obj_conv.inner = untag_ptr(this_obj);
45891         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45893         DefaultRouter_free(this_obj_conv);
45894 }
45895
45896 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) {
45897         LDKNetworkGraph network_graph_conv;
45898         network_graph_conv.inner = untag_ptr(network_graph);
45899         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45900         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45901         network_graph_conv.is_owned = false;
45902         void* logger_ptr = untag_ptr(logger);
45903         CHECK_ACCESS(logger_ptr);
45904         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45905         if (logger_conv.free == LDKLogger_JCalls_free) {
45906                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45907                 LDKLogger_JCalls_cloned(&logger_conv);
45908         }
45909         LDKThirtyTwoBytes random_seed_bytes_ref;
45910         CHECK(random_seed_bytes->arr_len == 32);
45911         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
45912         void* scorer_ptr = untag_ptr(scorer);
45913         CHECK_ACCESS(scorer_ptr);
45914         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
45915         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
45916                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45917                 LDKLockableScore_JCalls_cloned(&scorer_conv);
45918         }
45919         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
45920         uint64_t ret_ref = 0;
45921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45923         return ret_ref;
45924 }
45925
45926 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
45927         LDKDefaultRouter this_arg_conv;
45928         this_arg_conv.inner = untag_ptr(this_arg);
45929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45931         this_arg_conv.is_owned = false;
45932         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
45933         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
45934         return tag_ptr(ret_ret, true);
45935 }
45936
45937 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
45938         if (!ptr_is_owned(this_ptr)) return;
45939         void* this_ptr_ptr = untag_ptr(this_ptr);
45940         CHECK_ACCESS(this_ptr_ptr);
45941         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
45942         FREE(untag_ptr(this_ptr));
45943         Router_free(this_ptr_conv);
45944 }
45945
45946 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
45947         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
45948         this_obj_conv.inner = untag_ptr(this_obj);
45949         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45951         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
45952 }
45953
45954 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
45955         void* scorer_ptr = untag_ptr(scorer);
45956         CHECK_ACCESS(scorer_ptr);
45957         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
45958         if (scorer_conv.free == LDKScore_JCalls_free) {
45959                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45960                 LDKScore_JCalls_cloned(&scorer_conv);
45961         }
45962         LDKInFlightHtlcs inflight_htlcs_conv;
45963         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
45964         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
45965         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
45966         inflight_htlcs_conv.is_owned = false;
45967         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
45968         uint64_t ret_ref = 0;
45969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45971         return ret_ref;
45972 }
45973
45974 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
45975         LDKScorerAccountingForInFlightHtlcs obj_conv;
45976         obj_conv.inner = untag_ptr(obj);
45977         obj_conv.is_owned = ptr_is_owned(obj);
45978         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45979         obj_conv.is_owned = false;
45980         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
45981         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45982         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45983         CVec_u8Z_free(ret_var);
45984         return ret_arr;
45985 }
45986
45987 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
45988         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
45989         this_arg_conv.inner = untag_ptr(this_arg);
45990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45992         this_arg_conv.is_owned = false;
45993         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45994         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
45995         return tag_ptr(ret_ret, true);
45996 }
45997
45998 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
45999         LDKInFlightHtlcs this_obj_conv;
46000         this_obj_conv.inner = untag_ptr(this_obj);
46001         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46003         InFlightHtlcs_free(this_obj_conv);
46004 }
46005
46006 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
46007         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
46008         uint64_t ret_ref = 0;
46009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46011         return ret_ref;
46012 }
46013 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
46014         LDKInFlightHtlcs arg_conv;
46015         arg_conv.inner = untag_ptr(arg);
46016         arg_conv.is_owned = ptr_is_owned(arg);
46017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46018         arg_conv.is_owned = false;
46019         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
46020         return ret_conv;
46021 }
46022
46023 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
46024         LDKInFlightHtlcs orig_conv;
46025         orig_conv.inner = untag_ptr(orig);
46026         orig_conv.is_owned = ptr_is_owned(orig);
46027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46028         orig_conv.is_owned = false;
46029         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
46030         uint64_t ret_ref = 0;
46031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46033         return ret_ref;
46034 }
46035
46036 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
46037         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
46038         uint64_t ret_ref = 0;
46039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46041         return ret_ref;
46042 }
46043
46044 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
46045         LDKInFlightHtlcs this_arg_conv;
46046         this_arg_conv.inner = untag_ptr(this_arg);
46047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46049         this_arg_conv.is_owned = false;
46050         LDKPath path_conv;
46051         path_conv.inner = untag_ptr(path);
46052         path_conv.is_owned = ptr_is_owned(path);
46053         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
46054         path_conv.is_owned = false;
46055         LDKPublicKey payer_node_id_ref;
46056         CHECK(payer_node_id->arr_len == 33);
46057         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
46058         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
46059 }
46060
46061 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) {
46062         LDKInFlightHtlcs this_arg_conv;
46063         this_arg_conv.inner = untag_ptr(this_arg);
46064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46066         this_arg_conv.is_owned = false;
46067         LDKNodeId source_conv;
46068         source_conv.inner = untag_ptr(source);
46069         source_conv.is_owned = ptr_is_owned(source);
46070         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
46071         source_conv.is_owned = false;
46072         LDKNodeId target_conv;
46073         target_conv.inner = untag_ptr(target);
46074         target_conv.is_owned = ptr_is_owned(target);
46075         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
46076         target_conv.is_owned = false;
46077         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46078         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
46079         uint64_t ret_ref = tag_ptr(ret_copy, true);
46080         return ret_ref;
46081 }
46082
46083 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
46084         LDKInFlightHtlcs obj_conv;
46085         obj_conv.inner = untag_ptr(obj);
46086         obj_conv.is_owned = ptr_is_owned(obj);
46087         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46088         obj_conv.is_owned = false;
46089         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
46090         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46091         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46092         CVec_u8Z_free(ret_var);
46093         return ret_arr;
46094 }
46095
46096 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
46097         LDKu8slice ser_ref;
46098         ser_ref.datalen = ser->arr_len;
46099         ser_ref.data = ser->elems;
46100         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
46101         *ret_conv = InFlightHtlcs_read(ser_ref);
46102         FREE(ser);
46103         return tag_ptr(ret_conv, true);
46104 }
46105
46106 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
46107         LDKRouteHop this_obj_conv;
46108         this_obj_conv.inner = untag_ptr(this_obj);
46109         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46111         RouteHop_free(this_obj_conv);
46112 }
46113
46114 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
46115         LDKRouteHop this_ptr_conv;
46116         this_ptr_conv.inner = untag_ptr(this_ptr);
46117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46119         this_ptr_conv.is_owned = false;
46120         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46121         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
46122         return ret_arr;
46123 }
46124
46125 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
46126         LDKRouteHop this_ptr_conv;
46127         this_ptr_conv.inner = untag_ptr(this_ptr);
46128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46130         this_ptr_conv.is_owned = false;
46131         LDKPublicKey val_ref;
46132         CHECK(val->arr_len == 33);
46133         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46134         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
46135 }
46136
46137 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
46138         LDKRouteHop this_ptr_conv;
46139         this_ptr_conv.inner = untag_ptr(this_ptr);
46140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46142         this_ptr_conv.is_owned = false;
46143         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
46144         uint64_t ret_ref = 0;
46145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46147         return ret_ref;
46148 }
46149
46150 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
46151         LDKRouteHop this_ptr_conv;
46152         this_ptr_conv.inner = untag_ptr(this_ptr);
46153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46155         this_ptr_conv.is_owned = false;
46156         LDKNodeFeatures val_conv;
46157         val_conv.inner = untag_ptr(val);
46158         val_conv.is_owned = ptr_is_owned(val);
46159         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46160         val_conv = NodeFeatures_clone(&val_conv);
46161         RouteHop_set_node_features(&this_ptr_conv, val_conv);
46162 }
46163
46164 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
46165         LDKRouteHop this_ptr_conv;
46166         this_ptr_conv.inner = untag_ptr(this_ptr);
46167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46169         this_ptr_conv.is_owned = false;
46170         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
46171         return ret_conv;
46172 }
46173
46174 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
46175         LDKRouteHop this_ptr_conv;
46176         this_ptr_conv.inner = untag_ptr(this_ptr);
46177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46179         this_ptr_conv.is_owned = false;
46180         RouteHop_set_short_channel_id(&this_ptr_conv, val);
46181 }
46182
46183 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
46184         LDKRouteHop this_ptr_conv;
46185         this_ptr_conv.inner = untag_ptr(this_ptr);
46186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46188         this_ptr_conv.is_owned = false;
46189         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
46190         uint64_t ret_ref = 0;
46191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46193         return ret_ref;
46194 }
46195
46196 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
46197         LDKRouteHop this_ptr_conv;
46198         this_ptr_conv.inner = untag_ptr(this_ptr);
46199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46201         this_ptr_conv.is_owned = false;
46202         LDKChannelFeatures val_conv;
46203         val_conv.inner = untag_ptr(val);
46204         val_conv.is_owned = ptr_is_owned(val);
46205         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46206         val_conv = ChannelFeatures_clone(&val_conv);
46207         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
46208 }
46209
46210 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
46211         LDKRouteHop this_ptr_conv;
46212         this_ptr_conv.inner = untag_ptr(this_ptr);
46213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46215         this_ptr_conv.is_owned = false;
46216         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
46217         return ret_conv;
46218 }
46219
46220 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
46221         LDKRouteHop this_ptr_conv;
46222         this_ptr_conv.inner = untag_ptr(this_ptr);
46223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46225         this_ptr_conv.is_owned = false;
46226         RouteHop_set_fee_msat(&this_ptr_conv, val);
46227 }
46228
46229 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
46230         LDKRouteHop this_ptr_conv;
46231         this_ptr_conv.inner = untag_ptr(this_ptr);
46232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46234         this_ptr_conv.is_owned = false;
46235         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
46236         return ret_conv;
46237 }
46238
46239 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
46240         LDKRouteHop this_ptr_conv;
46241         this_ptr_conv.inner = untag_ptr(this_ptr);
46242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46244         this_ptr_conv.is_owned = false;
46245         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
46246 }
46247
46248 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) {
46249         LDKPublicKey pubkey_arg_ref;
46250         CHECK(pubkey_arg->arr_len == 33);
46251         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
46252         LDKNodeFeatures node_features_arg_conv;
46253         node_features_arg_conv.inner = untag_ptr(node_features_arg);
46254         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
46255         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
46256         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
46257         LDKChannelFeatures channel_features_arg_conv;
46258         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
46259         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
46260         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
46261         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
46262         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);
46263         uint64_t ret_ref = 0;
46264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46266         return ret_ref;
46267 }
46268
46269 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
46270         LDKRouteHop ret_var = RouteHop_clone(arg);
46271         uint64_t ret_ref = 0;
46272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46274         return ret_ref;
46275 }
46276 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
46277         LDKRouteHop arg_conv;
46278         arg_conv.inner = untag_ptr(arg);
46279         arg_conv.is_owned = ptr_is_owned(arg);
46280         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46281         arg_conv.is_owned = false;
46282         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
46283         return ret_conv;
46284 }
46285
46286 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
46287         LDKRouteHop orig_conv;
46288         orig_conv.inner = untag_ptr(orig);
46289         orig_conv.is_owned = ptr_is_owned(orig);
46290         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46291         orig_conv.is_owned = false;
46292         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
46293         uint64_t ret_ref = 0;
46294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46296         return ret_ref;
46297 }
46298
46299 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
46300         LDKRouteHop o_conv;
46301         o_conv.inner = untag_ptr(o);
46302         o_conv.is_owned = ptr_is_owned(o);
46303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46304         o_conv.is_owned = false;
46305         int64_t ret_conv = RouteHop_hash(&o_conv);
46306         return ret_conv;
46307 }
46308
46309 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
46310         LDKRouteHop a_conv;
46311         a_conv.inner = untag_ptr(a);
46312         a_conv.is_owned = ptr_is_owned(a);
46313         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46314         a_conv.is_owned = false;
46315         LDKRouteHop b_conv;
46316         b_conv.inner = untag_ptr(b);
46317         b_conv.is_owned = ptr_is_owned(b);
46318         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46319         b_conv.is_owned = false;
46320         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
46321         return ret_conv;
46322 }
46323
46324 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
46325         LDKRouteHop obj_conv;
46326         obj_conv.inner = untag_ptr(obj);
46327         obj_conv.is_owned = ptr_is_owned(obj);
46328         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46329         obj_conv.is_owned = false;
46330         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
46331         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46332         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46333         CVec_u8Z_free(ret_var);
46334         return ret_arr;
46335 }
46336
46337 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
46338         LDKu8slice ser_ref;
46339         ser_ref.datalen = ser->arr_len;
46340         ser_ref.data = ser->elems;
46341         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
46342         *ret_conv = RouteHop_read(ser_ref);
46343         FREE(ser);
46344         return tag_ptr(ret_conv, true);
46345 }
46346
46347 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
46348         LDKBlindedTail this_obj_conv;
46349         this_obj_conv.inner = untag_ptr(this_obj);
46350         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46352         BlindedTail_free(this_obj_conv);
46353 }
46354
46355 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
46356         LDKBlindedTail this_ptr_conv;
46357         this_ptr_conv.inner = untag_ptr(this_ptr);
46358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46360         this_ptr_conv.is_owned = false;
46361         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
46362         uint64_tArray ret_arr = NULL;
46363         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46364         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46365         for (size_t m = 0; m < ret_var.datalen; m++) {
46366                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
46367                 uint64_t ret_conv_12_ref = 0;
46368                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
46369                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
46370                 ret_arr_ptr[m] = ret_conv_12_ref;
46371         }
46372         
46373         FREE(ret_var.data);
46374         return ret_arr;
46375 }
46376
46377 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
46378         LDKBlindedTail this_ptr_conv;
46379         this_ptr_conv.inner = untag_ptr(this_ptr);
46380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46382         this_ptr_conv.is_owned = false;
46383         LDKCVec_BlindedHopZ val_constr;
46384         val_constr.datalen = val->arr_len;
46385         if (val_constr.datalen > 0)
46386                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
46387         else
46388                 val_constr.data = NULL;
46389         uint64_t* val_vals = val->elems;
46390         for (size_t m = 0; m < val_constr.datalen; m++) {
46391                 uint64_t val_conv_12 = val_vals[m];
46392                 LDKBlindedHop val_conv_12_conv;
46393                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
46394                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
46395                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
46396                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
46397                 val_constr.data[m] = val_conv_12_conv;
46398         }
46399         FREE(val);
46400         BlindedTail_set_hops(&this_ptr_conv, val_constr);
46401 }
46402
46403 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
46404         LDKBlindedTail this_ptr_conv;
46405         this_ptr_conv.inner = untag_ptr(this_ptr);
46406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46408         this_ptr_conv.is_owned = false;
46409         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46410         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46411         return ret_arr;
46412 }
46413
46414 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
46415         LDKBlindedTail this_ptr_conv;
46416         this_ptr_conv.inner = untag_ptr(this_ptr);
46417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46419         this_ptr_conv.is_owned = false;
46420         LDKPublicKey val_ref;
46421         CHECK(val->arr_len == 33);
46422         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46423         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
46424 }
46425
46426 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) {
46427         LDKBlindedTail this_ptr_conv;
46428         this_ptr_conv.inner = untag_ptr(this_ptr);
46429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46431         this_ptr_conv.is_owned = false;
46432         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
46433         return ret_conv;
46434 }
46435
46436 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) {
46437         LDKBlindedTail this_ptr_conv;
46438         this_ptr_conv.inner = untag_ptr(this_ptr);
46439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46441         this_ptr_conv.is_owned = false;
46442         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
46443 }
46444
46445 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
46446         LDKBlindedTail this_ptr_conv;
46447         this_ptr_conv.inner = untag_ptr(this_ptr);
46448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46450         this_ptr_conv.is_owned = false;
46451         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
46452         return ret_conv;
46453 }
46454
46455 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
46456         LDKBlindedTail this_ptr_conv;
46457         this_ptr_conv.inner = untag_ptr(this_ptr);
46458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46460         this_ptr_conv.is_owned = false;
46461         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
46462 }
46463
46464 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) {
46465         LDKCVec_BlindedHopZ hops_arg_constr;
46466         hops_arg_constr.datalen = hops_arg->arr_len;
46467         if (hops_arg_constr.datalen > 0)
46468                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
46469         else
46470                 hops_arg_constr.data = NULL;
46471         uint64_t* hops_arg_vals = hops_arg->elems;
46472         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
46473                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
46474                 LDKBlindedHop hops_arg_conv_12_conv;
46475                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
46476                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
46477                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
46478                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
46479                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
46480         }
46481         FREE(hops_arg);
46482         LDKPublicKey blinding_point_arg_ref;
46483         CHECK(blinding_point_arg->arr_len == 33);
46484         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46485         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
46486         uint64_t ret_ref = 0;
46487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46489         return ret_ref;
46490 }
46491
46492 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
46493         LDKBlindedTail ret_var = BlindedTail_clone(arg);
46494         uint64_t ret_ref = 0;
46495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46497         return ret_ref;
46498 }
46499 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
46500         LDKBlindedTail arg_conv;
46501         arg_conv.inner = untag_ptr(arg);
46502         arg_conv.is_owned = ptr_is_owned(arg);
46503         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46504         arg_conv.is_owned = false;
46505         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
46506         return ret_conv;
46507 }
46508
46509 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
46510         LDKBlindedTail orig_conv;
46511         orig_conv.inner = untag_ptr(orig);
46512         orig_conv.is_owned = ptr_is_owned(orig);
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46514         orig_conv.is_owned = false;
46515         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
46516         uint64_t ret_ref = 0;
46517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46519         return ret_ref;
46520 }
46521
46522 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
46523         LDKBlindedTail o_conv;
46524         o_conv.inner = untag_ptr(o);
46525         o_conv.is_owned = ptr_is_owned(o);
46526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46527         o_conv.is_owned = false;
46528         int64_t ret_conv = BlindedTail_hash(&o_conv);
46529         return ret_conv;
46530 }
46531
46532 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
46533         LDKBlindedTail a_conv;
46534         a_conv.inner = untag_ptr(a);
46535         a_conv.is_owned = ptr_is_owned(a);
46536         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46537         a_conv.is_owned = false;
46538         LDKBlindedTail b_conv;
46539         b_conv.inner = untag_ptr(b);
46540         b_conv.is_owned = ptr_is_owned(b);
46541         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46542         b_conv.is_owned = false;
46543         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
46544         return ret_conv;
46545 }
46546
46547 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
46548         LDKBlindedTail obj_conv;
46549         obj_conv.inner = untag_ptr(obj);
46550         obj_conv.is_owned = ptr_is_owned(obj);
46551         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46552         obj_conv.is_owned = false;
46553         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
46554         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46555         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46556         CVec_u8Z_free(ret_var);
46557         return ret_arr;
46558 }
46559
46560 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
46561         LDKu8slice ser_ref;
46562         ser_ref.datalen = ser->arr_len;
46563         ser_ref.data = ser->elems;
46564         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
46565         *ret_conv = BlindedTail_read(ser_ref);
46566         FREE(ser);
46567         return tag_ptr(ret_conv, true);
46568 }
46569
46570 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
46571         LDKPath this_obj_conv;
46572         this_obj_conv.inner = untag_ptr(this_obj);
46573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46575         Path_free(this_obj_conv);
46576 }
46577
46578 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
46579         LDKPath this_ptr_conv;
46580         this_ptr_conv.inner = untag_ptr(this_ptr);
46581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46583         this_ptr_conv.is_owned = false;
46584         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
46585         uint64_tArray ret_arr = NULL;
46586         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46587         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46588         for (size_t k = 0; k < ret_var.datalen; k++) {
46589                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
46590                 uint64_t ret_conv_10_ref = 0;
46591                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
46592                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
46593                 ret_arr_ptr[k] = ret_conv_10_ref;
46594         }
46595         
46596         FREE(ret_var.data);
46597         return ret_arr;
46598 }
46599
46600 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
46601         LDKPath this_ptr_conv;
46602         this_ptr_conv.inner = untag_ptr(this_ptr);
46603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46605         this_ptr_conv.is_owned = false;
46606         LDKCVec_RouteHopZ val_constr;
46607         val_constr.datalen = val->arr_len;
46608         if (val_constr.datalen > 0)
46609                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
46610         else
46611                 val_constr.data = NULL;
46612         uint64_t* val_vals = val->elems;
46613         for (size_t k = 0; k < val_constr.datalen; k++) {
46614                 uint64_t val_conv_10 = val_vals[k];
46615                 LDKRouteHop val_conv_10_conv;
46616                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
46617                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
46618                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
46619                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
46620                 val_constr.data[k] = val_conv_10_conv;
46621         }
46622         FREE(val);
46623         Path_set_hops(&this_ptr_conv, val_constr);
46624 }
46625
46626 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
46627         LDKPath this_ptr_conv;
46628         this_ptr_conv.inner = untag_ptr(this_ptr);
46629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46631         this_ptr_conv.is_owned = false;
46632         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
46633         uint64_t ret_ref = 0;
46634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46636         return ret_ref;
46637 }
46638
46639 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
46640         LDKPath this_ptr_conv;
46641         this_ptr_conv.inner = untag_ptr(this_ptr);
46642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46644         this_ptr_conv.is_owned = false;
46645         LDKBlindedTail val_conv;
46646         val_conv.inner = untag_ptr(val);
46647         val_conv.is_owned = ptr_is_owned(val);
46648         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46649         val_conv = BlindedTail_clone(&val_conv);
46650         Path_set_blinded_tail(&this_ptr_conv, val_conv);
46651 }
46652
46653 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
46654         LDKCVec_RouteHopZ hops_arg_constr;
46655         hops_arg_constr.datalen = hops_arg->arr_len;
46656         if (hops_arg_constr.datalen > 0)
46657                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
46658         else
46659                 hops_arg_constr.data = NULL;
46660         uint64_t* hops_arg_vals = hops_arg->elems;
46661         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
46662                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
46663                 LDKRouteHop hops_arg_conv_10_conv;
46664                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
46665                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
46666                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
46667                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
46668                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
46669         }
46670         FREE(hops_arg);
46671         LDKBlindedTail blinded_tail_arg_conv;
46672         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
46673         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
46674         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
46675         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
46676         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
46677         uint64_t ret_ref = 0;
46678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46680         return ret_ref;
46681 }
46682
46683 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
46684         LDKPath ret_var = Path_clone(arg);
46685         uint64_t ret_ref = 0;
46686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46688         return ret_ref;
46689 }
46690 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
46691         LDKPath arg_conv;
46692         arg_conv.inner = untag_ptr(arg);
46693         arg_conv.is_owned = ptr_is_owned(arg);
46694         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46695         arg_conv.is_owned = false;
46696         int64_t ret_conv = Path_clone_ptr(&arg_conv);
46697         return ret_conv;
46698 }
46699
46700 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
46701         LDKPath orig_conv;
46702         orig_conv.inner = untag_ptr(orig);
46703         orig_conv.is_owned = ptr_is_owned(orig);
46704         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46705         orig_conv.is_owned = false;
46706         LDKPath ret_var = Path_clone(&orig_conv);
46707         uint64_t ret_ref = 0;
46708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46710         return ret_ref;
46711 }
46712
46713 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
46714         LDKPath o_conv;
46715         o_conv.inner = untag_ptr(o);
46716         o_conv.is_owned = ptr_is_owned(o);
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46718         o_conv.is_owned = false;
46719         int64_t ret_conv = Path_hash(&o_conv);
46720         return ret_conv;
46721 }
46722
46723 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
46724         LDKPath a_conv;
46725         a_conv.inner = untag_ptr(a);
46726         a_conv.is_owned = ptr_is_owned(a);
46727         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46728         a_conv.is_owned = false;
46729         LDKPath b_conv;
46730         b_conv.inner = untag_ptr(b);
46731         b_conv.is_owned = ptr_is_owned(b);
46732         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46733         b_conv.is_owned = false;
46734         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
46735         return ret_conv;
46736 }
46737
46738 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
46739         LDKPath this_arg_conv;
46740         this_arg_conv.inner = untag_ptr(this_arg);
46741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46743         this_arg_conv.is_owned = false;
46744         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
46745         return ret_conv;
46746 }
46747
46748 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
46749         LDKPath this_arg_conv;
46750         this_arg_conv.inner = untag_ptr(this_arg);
46751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46753         this_arg_conv.is_owned = false;
46754         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
46755         return ret_conv;
46756 }
46757
46758 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
46759         LDKPath this_arg_conv;
46760         this_arg_conv.inner = untag_ptr(this_arg);
46761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46763         this_arg_conv.is_owned = false;
46764         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
46765         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
46766         uint64_t ret_ref = tag_ptr(ret_copy, true);
46767         return ret_ref;
46768 }
46769
46770 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
46771         LDKRoute this_obj_conv;
46772         this_obj_conv.inner = untag_ptr(this_obj);
46773         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46775         Route_free(this_obj_conv);
46776 }
46777
46778 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
46779         LDKRoute this_ptr_conv;
46780         this_ptr_conv.inner = untag_ptr(this_ptr);
46781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46783         this_ptr_conv.is_owned = false;
46784         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
46785         uint64_tArray ret_arr = NULL;
46786         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46787         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46788         for (size_t g = 0; g < ret_var.datalen; g++) {
46789                 LDKPath ret_conv_6_var = ret_var.data[g];
46790                 uint64_t ret_conv_6_ref = 0;
46791                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
46792                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
46793                 ret_arr_ptr[g] = ret_conv_6_ref;
46794         }
46795         
46796         FREE(ret_var.data);
46797         return ret_arr;
46798 }
46799
46800 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
46801         LDKRoute this_ptr_conv;
46802         this_ptr_conv.inner = untag_ptr(this_ptr);
46803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46805         this_ptr_conv.is_owned = false;
46806         LDKCVec_PathZ val_constr;
46807         val_constr.datalen = val->arr_len;
46808         if (val_constr.datalen > 0)
46809                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
46810         else
46811                 val_constr.data = NULL;
46812         uint64_t* val_vals = val->elems;
46813         for (size_t g = 0; g < val_constr.datalen; g++) {
46814                 uint64_t val_conv_6 = val_vals[g];
46815                 LDKPath val_conv_6_conv;
46816                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
46817                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
46818                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
46819                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
46820                 val_constr.data[g] = val_conv_6_conv;
46821         }
46822         FREE(val);
46823         Route_set_paths(&this_ptr_conv, val_constr);
46824 }
46825
46826 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
46827         LDKRoute this_ptr_conv;
46828         this_ptr_conv.inner = untag_ptr(this_ptr);
46829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46831         this_ptr_conv.is_owned = false;
46832         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
46833         uint64_t ret_ref = 0;
46834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46836         return ret_ref;
46837 }
46838
46839 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
46840         LDKRoute this_ptr_conv;
46841         this_ptr_conv.inner = untag_ptr(this_ptr);
46842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46844         this_ptr_conv.is_owned = false;
46845         LDKPaymentParameters val_conv;
46846         val_conv.inner = untag_ptr(val);
46847         val_conv.is_owned = ptr_is_owned(val);
46848         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46849         val_conv = PaymentParameters_clone(&val_conv);
46850         Route_set_payment_params(&this_ptr_conv, val_conv);
46851 }
46852
46853 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t payment_params_arg) {
46854         LDKCVec_PathZ paths_arg_constr;
46855         paths_arg_constr.datalen = paths_arg->arr_len;
46856         if (paths_arg_constr.datalen > 0)
46857                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
46858         else
46859                 paths_arg_constr.data = NULL;
46860         uint64_t* paths_arg_vals = paths_arg->elems;
46861         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
46862                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
46863                 LDKPath paths_arg_conv_6_conv;
46864                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
46865                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
46866                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
46867                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
46868                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
46869         }
46870         FREE(paths_arg);
46871         LDKPaymentParameters payment_params_arg_conv;
46872         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
46873         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
46874         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
46875         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
46876         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
46877         uint64_t ret_ref = 0;
46878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46880         return ret_ref;
46881 }
46882
46883 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
46884         LDKRoute ret_var = Route_clone(arg);
46885         uint64_t ret_ref = 0;
46886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46888         return ret_ref;
46889 }
46890 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
46891         LDKRoute arg_conv;
46892         arg_conv.inner = untag_ptr(arg);
46893         arg_conv.is_owned = ptr_is_owned(arg);
46894         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46895         arg_conv.is_owned = false;
46896         int64_t ret_conv = Route_clone_ptr(&arg_conv);
46897         return ret_conv;
46898 }
46899
46900 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
46901         LDKRoute orig_conv;
46902         orig_conv.inner = untag_ptr(orig);
46903         orig_conv.is_owned = ptr_is_owned(orig);
46904         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46905         orig_conv.is_owned = false;
46906         LDKRoute ret_var = Route_clone(&orig_conv);
46907         uint64_t ret_ref = 0;
46908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46910         return ret_ref;
46911 }
46912
46913 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
46914         LDKRoute o_conv;
46915         o_conv.inner = untag_ptr(o);
46916         o_conv.is_owned = ptr_is_owned(o);
46917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46918         o_conv.is_owned = false;
46919         int64_t ret_conv = Route_hash(&o_conv);
46920         return ret_conv;
46921 }
46922
46923 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
46924         LDKRoute a_conv;
46925         a_conv.inner = untag_ptr(a);
46926         a_conv.is_owned = ptr_is_owned(a);
46927         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46928         a_conv.is_owned = false;
46929         LDKRoute b_conv;
46930         b_conv.inner = untag_ptr(b);
46931         b_conv.is_owned = ptr_is_owned(b);
46932         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46933         b_conv.is_owned = false;
46934         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
46935         return ret_conv;
46936 }
46937
46938 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
46939         LDKRoute this_arg_conv;
46940         this_arg_conv.inner = untag_ptr(this_arg);
46941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46943         this_arg_conv.is_owned = false;
46944         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
46945         return ret_conv;
46946 }
46947
46948 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
46949         LDKRoute this_arg_conv;
46950         this_arg_conv.inner = untag_ptr(this_arg);
46951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46953         this_arg_conv.is_owned = false;
46954         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
46955         return ret_conv;
46956 }
46957
46958 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
46959         LDKRoute obj_conv;
46960         obj_conv.inner = untag_ptr(obj);
46961         obj_conv.is_owned = ptr_is_owned(obj);
46962         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46963         obj_conv.is_owned = false;
46964         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
46965         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46966         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46967         CVec_u8Z_free(ret_var);
46968         return ret_arr;
46969 }
46970
46971 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
46972         LDKu8slice ser_ref;
46973         ser_ref.datalen = ser->arr_len;
46974         ser_ref.data = ser->elems;
46975         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
46976         *ret_conv = Route_read(ser_ref);
46977         FREE(ser);
46978         return tag_ptr(ret_conv, true);
46979 }
46980
46981 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
46982         LDKRouteParameters this_obj_conv;
46983         this_obj_conv.inner = untag_ptr(this_obj);
46984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46986         RouteParameters_free(this_obj_conv);
46987 }
46988
46989 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
46990         LDKRouteParameters this_ptr_conv;
46991         this_ptr_conv.inner = untag_ptr(this_ptr);
46992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46994         this_ptr_conv.is_owned = false;
46995         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
46996         uint64_t ret_ref = 0;
46997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46999         return ret_ref;
47000 }
47001
47002 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
47003         LDKRouteParameters this_ptr_conv;
47004         this_ptr_conv.inner = untag_ptr(this_ptr);
47005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47007         this_ptr_conv.is_owned = false;
47008         LDKPaymentParameters val_conv;
47009         val_conv.inner = untag_ptr(val);
47010         val_conv.is_owned = ptr_is_owned(val);
47011         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47012         val_conv = PaymentParameters_clone(&val_conv);
47013         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
47014 }
47015
47016 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
47017         LDKRouteParameters this_ptr_conv;
47018         this_ptr_conv.inner = untag_ptr(this_ptr);
47019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47021         this_ptr_conv.is_owned = false;
47022         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
47023         return ret_conv;
47024 }
47025
47026 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
47027         LDKRouteParameters this_ptr_conv;
47028         this_ptr_conv.inner = untag_ptr(this_ptr);
47029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47031         this_ptr_conv.is_owned = false;
47032         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
47033 }
47034
47035 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) {
47036         LDKPaymentParameters payment_params_arg_conv;
47037         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
47038         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
47039         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
47040         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
47041         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
47042         uint64_t ret_ref = 0;
47043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47045         return ret_ref;
47046 }
47047
47048 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
47049         LDKRouteParameters ret_var = RouteParameters_clone(arg);
47050         uint64_t ret_ref = 0;
47051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47053         return ret_ref;
47054 }
47055 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
47056         LDKRouteParameters arg_conv;
47057         arg_conv.inner = untag_ptr(arg);
47058         arg_conv.is_owned = ptr_is_owned(arg);
47059         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47060         arg_conv.is_owned = false;
47061         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
47062         return ret_conv;
47063 }
47064
47065 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
47066         LDKRouteParameters orig_conv;
47067         orig_conv.inner = untag_ptr(orig);
47068         orig_conv.is_owned = ptr_is_owned(orig);
47069         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47070         orig_conv.is_owned = false;
47071         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
47072         uint64_t ret_ref = 0;
47073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47075         return ret_ref;
47076 }
47077
47078 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
47079         LDKRouteParameters a_conv;
47080         a_conv.inner = untag_ptr(a);
47081         a_conv.is_owned = ptr_is_owned(a);
47082         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47083         a_conv.is_owned = false;
47084         LDKRouteParameters b_conv;
47085         b_conv.inner = untag_ptr(b);
47086         b_conv.is_owned = ptr_is_owned(b);
47087         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47088         b_conv.is_owned = false;
47089         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
47090         return ret_conv;
47091 }
47092
47093 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
47094         LDKRouteParameters obj_conv;
47095         obj_conv.inner = untag_ptr(obj);
47096         obj_conv.is_owned = ptr_is_owned(obj);
47097         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47098         obj_conv.is_owned = false;
47099         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
47100         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47101         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47102         CVec_u8Z_free(ret_var);
47103         return ret_arr;
47104 }
47105
47106 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
47107         LDKu8slice ser_ref;
47108         ser_ref.datalen = ser->arr_len;
47109         ser_ref.data = ser->elems;
47110         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
47111         *ret_conv = RouteParameters_read(ser_ref);
47112         FREE(ser);
47113         return tag_ptr(ret_conv, true);
47114 }
47115
47116 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
47117         LDKPaymentParameters this_obj_conv;
47118         this_obj_conv.inner = untag_ptr(this_obj);
47119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47121         PaymentParameters_free(this_obj_conv);
47122 }
47123
47124 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
47125         LDKPaymentParameters this_ptr_conv;
47126         this_ptr_conv.inner = untag_ptr(this_ptr);
47127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47129         this_ptr_conv.is_owned = false;
47130         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47131         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
47132         return ret_arr;
47133 }
47134
47135 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
47136         LDKPaymentParameters this_ptr_conv;
47137         this_ptr_conv.inner = untag_ptr(this_ptr);
47138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47140         this_ptr_conv.is_owned = false;
47141         LDKPublicKey val_ref;
47142         CHECK(val->arr_len == 33);
47143         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47144         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
47145 }
47146
47147 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
47148         LDKPaymentParameters this_ptr_conv;
47149         this_ptr_conv.inner = untag_ptr(this_ptr);
47150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47152         this_ptr_conv.is_owned = false;
47153         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
47154         uint64_t ret_ref = 0;
47155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47157         return ret_ref;
47158 }
47159
47160 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
47161         LDKPaymentParameters this_ptr_conv;
47162         this_ptr_conv.inner = untag_ptr(this_ptr);
47163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47165         this_ptr_conv.is_owned = false;
47166         LDKInvoiceFeatures val_conv;
47167         val_conv.inner = untag_ptr(val);
47168         val_conv.is_owned = ptr_is_owned(val);
47169         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47170         val_conv = InvoiceFeatures_clone(&val_conv);
47171         PaymentParameters_set_features(&this_ptr_conv, val_conv);
47172 }
47173
47174 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
47175         LDKPaymentParameters this_ptr_conv;
47176         this_ptr_conv.inner = untag_ptr(this_ptr);
47177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47179         this_ptr_conv.is_owned = false;
47180         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47181         *ret_copy = PaymentParameters_get_route_hints(&this_ptr_conv);
47182         uint64_t ret_ref = tag_ptr(ret_copy, true);
47183         return ret_ref;
47184 }
47185
47186 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_t val) {
47187         LDKPaymentParameters this_ptr_conv;
47188         this_ptr_conv.inner = untag_ptr(this_ptr);
47189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47191         this_ptr_conv.is_owned = false;
47192         void* val_ptr = untag_ptr(val);
47193         CHECK_ACCESS(val_ptr);
47194         LDKHints val_conv = *(LDKHints*)(val_ptr);
47195         val_conv = Hints_clone((LDKHints*)untag_ptr(val));
47196         PaymentParameters_set_route_hints(&this_ptr_conv, val_conv);
47197 }
47198
47199 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
47200         LDKPaymentParameters this_ptr_conv;
47201         this_ptr_conv.inner = untag_ptr(this_ptr);
47202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47204         this_ptr_conv.is_owned = false;
47205         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47206         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
47207         uint64_t ret_ref = tag_ptr(ret_copy, true);
47208         return ret_ref;
47209 }
47210
47211 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
47212         LDKPaymentParameters this_ptr_conv;
47213         this_ptr_conv.inner = untag_ptr(this_ptr);
47214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47216         this_ptr_conv.is_owned = false;
47217         void* val_ptr = untag_ptr(val);
47218         CHECK_ACCESS(val_ptr);
47219         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47220         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47221         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
47222 }
47223
47224 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) {
47225         LDKPaymentParameters this_ptr_conv;
47226         this_ptr_conv.inner = untag_ptr(this_ptr);
47227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47229         this_ptr_conv.is_owned = false;
47230         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
47231         return ret_conv;
47232 }
47233
47234 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) {
47235         LDKPaymentParameters this_ptr_conv;
47236         this_ptr_conv.inner = untag_ptr(this_ptr);
47237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47239         this_ptr_conv.is_owned = false;
47240         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
47241 }
47242
47243 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
47244         LDKPaymentParameters this_ptr_conv;
47245         this_ptr_conv.inner = untag_ptr(this_ptr);
47246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47248         this_ptr_conv.is_owned = false;
47249         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
47250         return ret_conv;
47251 }
47252
47253 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
47254         LDKPaymentParameters this_ptr_conv;
47255         this_ptr_conv.inner = untag_ptr(this_ptr);
47256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47258         this_ptr_conv.is_owned = false;
47259         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
47260 }
47261
47262 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) {
47263         LDKPaymentParameters this_ptr_conv;
47264         this_ptr_conv.inner = untag_ptr(this_ptr);
47265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47267         this_ptr_conv.is_owned = false;
47268         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
47269         return ret_conv;
47270 }
47271
47272 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) {
47273         LDKPaymentParameters this_ptr_conv;
47274         this_ptr_conv.inner = untag_ptr(this_ptr);
47275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47277         this_ptr_conv.is_owned = false;
47278         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
47279 }
47280
47281 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
47282         LDKPaymentParameters this_ptr_conv;
47283         this_ptr_conv.inner = untag_ptr(this_ptr);
47284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47286         this_ptr_conv.is_owned = false;
47287         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
47288         int64_tArray ret_arr = NULL;
47289         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
47290         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
47291         for (size_t i = 0; i < ret_var.datalen; i++) {
47292                 int64_t ret_conv_8_conv = ret_var.data[i];
47293                 ret_arr_ptr[i] = ret_conv_8_conv;
47294         }
47295         
47296         FREE(ret_var.data);
47297         return ret_arr;
47298 }
47299
47300 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
47301         LDKPaymentParameters this_ptr_conv;
47302         this_ptr_conv.inner = untag_ptr(this_ptr);
47303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47305         this_ptr_conv.is_owned = false;
47306         LDKCVec_u64Z val_constr;
47307         val_constr.datalen = val->arr_len;
47308         if (val_constr.datalen > 0)
47309                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47310         else
47311                 val_constr.data = NULL;
47312         int64_t* val_vals = val->elems;
47313         for (size_t i = 0; i < val_constr.datalen; i++) {
47314                 int64_t val_conv_8 = val_vals[i];
47315                 val_constr.data[i] = val_conv_8;
47316         }
47317         FREE(val);
47318         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
47319 }
47320
47321 int32_t  __attribute__((export_name("TS_PaymentParameters_get_final_cltv_expiry_delta"))) TS_PaymentParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
47322         LDKPaymentParameters this_ptr_conv;
47323         this_ptr_conv.inner = untag_ptr(this_ptr);
47324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47326         this_ptr_conv.is_owned = false;
47327         int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
47328         return ret_conv;
47329 }
47330
47331 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) {
47332         LDKPaymentParameters this_ptr_conv;
47333         this_ptr_conv.inner = untag_ptr(this_ptr);
47334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47336         this_ptr_conv.is_owned = false;
47337         PaymentParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
47338 }
47339
47340 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) {
47341         LDKPublicKey payee_pubkey_arg_ref;
47342         CHECK(payee_pubkey_arg->arr_len == 33);
47343         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
47344         LDKInvoiceFeatures features_arg_conv;
47345         features_arg_conv.inner = untag_ptr(features_arg);
47346         features_arg_conv.is_owned = ptr_is_owned(features_arg);
47347         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
47348         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
47349         void* route_hints_arg_ptr = untag_ptr(route_hints_arg);
47350         CHECK_ACCESS(route_hints_arg_ptr);
47351         LDKHints route_hints_arg_conv = *(LDKHints*)(route_hints_arg_ptr);
47352         route_hints_arg_conv = Hints_clone((LDKHints*)untag_ptr(route_hints_arg));
47353         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
47354         CHECK_ACCESS(expiry_time_arg_ptr);
47355         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
47356         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
47357         LDKCVec_u64Z previously_failed_channels_arg_constr;
47358         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
47359         if (previously_failed_channels_arg_constr.datalen > 0)
47360                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47361         else
47362                 previously_failed_channels_arg_constr.data = NULL;
47363         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
47364         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
47365                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
47366                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
47367         }
47368         FREE(previously_failed_channels_arg);
47369         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);
47370         uint64_t ret_ref = 0;
47371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47373         return ret_ref;
47374 }
47375
47376 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
47377         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
47378         uint64_t ret_ref = 0;
47379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47381         return ret_ref;
47382 }
47383 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
47384         LDKPaymentParameters arg_conv;
47385         arg_conv.inner = untag_ptr(arg);
47386         arg_conv.is_owned = ptr_is_owned(arg);
47387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47388         arg_conv.is_owned = false;
47389         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
47390         return ret_conv;
47391 }
47392
47393 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
47394         LDKPaymentParameters orig_conv;
47395         orig_conv.inner = untag_ptr(orig);
47396         orig_conv.is_owned = ptr_is_owned(orig);
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47398         orig_conv.is_owned = false;
47399         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
47400         uint64_t ret_ref = 0;
47401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47403         return ret_ref;
47404 }
47405
47406 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
47407         LDKPaymentParameters o_conv;
47408         o_conv.inner = untag_ptr(o);
47409         o_conv.is_owned = ptr_is_owned(o);
47410         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47411         o_conv.is_owned = false;
47412         int64_t ret_conv = PaymentParameters_hash(&o_conv);
47413         return ret_conv;
47414 }
47415
47416 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
47417         LDKPaymentParameters a_conv;
47418         a_conv.inner = untag_ptr(a);
47419         a_conv.is_owned = ptr_is_owned(a);
47420         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47421         a_conv.is_owned = false;
47422         LDKPaymentParameters b_conv;
47423         b_conv.inner = untag_ptr(b);
47424         b_conv.is_owned = ptr_is_owned(b);
47425         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47426         b_conv.is_owned = false;
47427         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
47428         return ret_conv;
47429 }
47430
47431 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
47432         LDKPaymentParameters obj_conv;
47433         obj_conv.inner = untag_ptr(obj);
47434         obj_conv.is_owned = ptr_is_owned(obj);
47435         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47436         obj_conv.is_owned = false;
47437         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
47438         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47439         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47440         CVec_u8Z_free(ret_var);
47441         return ret_arr;
47442 }
47443
47444 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
47445         LDKu8slice ser_ref;
47446         ser_ref.datalen = ser->arr_len;
47447         ser_ref.data = ser->elems;
47448         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
47449         *ret_conv = PaymentParameters_read(ser_ref, arg);
47450         FREE(ser);
47451         return tag_ptr(ret_conv, true);
47452 }
47453
47454 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) {
47455         LDKPublicKey payee_pubkey_ref;
47456         CHECK(payee_pubkey->arr_len == 33);
47457         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
47458         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
47459         uint64_t ret_ref = 0;
47460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47462         return ret_ref;
47463 }
47464
47465 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
47466         LDKPublicKey payee_pubkey_ref;
47467         CHECK(payee_pubkey->arr_len == 33);
47468         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
47469         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta);
47470         uint64_t ret_ref = 0;
47471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47473         return ret_ref;
47474 }
47475
47476 void  __attribute__((export_name("TS_Hints_free"))) TS_Hints_free(uint64_t this_ptr) {
47477         if (!ptr_is_owned(this_ptr)) return;
47478         void* this_ptr_ptr = untag_ptr(this_ptr);
47479         CHECK_ACCESS(this_ptr_ptr);
47480         LDKHints this_ptr_conv = *(LDKHints*)(this_ptr_ptr);
47481         FREE(untag_ptr(this_ptr));
47482         Hints_free(this_ptr_conv);
47483 }
47484
47485 static inline uint64_t Hints_clone_ptr(LDKHints *NONNULL_PTR arg) {
47486         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47487         *ret_copy = Hints_clone(arg);
47488         uint64_t ret_ref = tag_ptr(ret_copy, true);
47489         return ret_ref;
47490 }
47491 int64_t  __attribute__((export_name("TS_Hints_clone_ptr"))) TS_Hints_clone_ptr(uint64_t arg) {
47492         LDKHints* arg_conv = (LDKHints*)untag_ptr(arg);
47493         int64_t ret_conv = Hints_clone_ptr(arg_conv);
47494         return ret_conv;
47495 }
47496
47497 uint64_t  __attribute__((export_name("TS_Hints_clone"))) TS_Hints_clone(uint64_t orig) {
47498         LDKHints* orig_conv = (LDKHints*)untag_ptr(orig);
47499         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47500         *ret_copy = Hints_clone(orig_conv);
47501         uint64_t ret_ref = tag_ptr(ret_copy, true);
47502         return ret_ref;
47503 }
47504
47505 uint64_t  __attribute__((export_name("TS_Hints_blinded"))) TS_Hints_blinded(uint64_tArray a) {
47506         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ a_constr;
47507         a_constr.datalen = a->arr_len;
47508         if (a_constr.datalen > 0)
47509                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
47510         else
47511                 a_constr.data = NULL;
47512         uint64_t* a_vals = a->elems;
47513         for (size_t l = 0; l < a_constr.datalen; l++) {
47514                 uint64_t a_conv_37 = a_vals[l];
47515                 void* a_conv_37_ptr = untag_ptr(a_conv_37);
47516                 CHECK_ACCESS(a_conv_37_ptr);
47517                 LDKC2Tuple_BlindedPayInfoBlindedPathZ a_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(a_conv_37_ptr);
47518                 a_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(a_conv_37));
47519                 a_constr.data[l] = a_conv_37_conv;
47520         }
47521         FREE(a);
47522         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47523         *ret_copy = Hints_blinded(a_constr);
47524         uint64_t ret_ref = tag_ptr(ret_copy, true);
47525         return ret_ref;
47526 }
47527
47528 uint64_t  __attribute__((export_name("TS_Hints_clear"))) TS_Hints_clear(uint64_tArray a) {
47529         LDKCVec_RouteHintZ a_constr;
47530         a_constr.datalen = a->arr_len;
47531         if (a_constr.datalen > 0)
47532                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
47533         else
47534                 a_constr.data = NULL;
47535         uint64_t* a_vals = a->elems;
47536         for (size_t l = 0; l < a_constr.datalen; l++) {
47537                 uint64_t a_conv_11 = a_vals[l];
47538                 LDKRouteHint a_conv_11_conv;
47539                 a_conv_11_conv.inner = untag_ptr(a_conv_11);
47540                 a_conv_11_conv.is_owned = ptr_is_owned(a_conv_11);
47541                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv_11_conv);
47542                 a_conv_11_conv = RouteHint_clone(&a_conv_11_conv);
47543                 a_constr.data[l] = a_conv_11_conv;
47544         }
47545         FREE(a);
47546         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47547         *ret_copy = Hints_clear(a_constr);
47548         uint64_t ret_ref = tag_ptr(ret_copy, true);
47549         return ret_ref;
47550 }
47551
47552 int64_t  __attribute__((export_name("TS_Hints_hash"))) TS_Hints_hash(uint64_t o) {
47553         LDKHints* o_conv = (LDKHints*)untag_ptr(o);
47554         int64_t ret_conv = Hints_hash(o_conv);
47555         return ret_conv;
47556 }
47557
47558 jboolean  __attribute__((export_name("TS_Hints_eq"))) TS_Hints_eq(uint64_t a, uint64_t b) {
47559         LDKHints* a_conv = (LDKHints*)untag_ptr(a);
47560         LDKHints* b_conv = (LDKHints*)untag_ptr(b);
47561         jboolean ret_conv = Hints_eq(a_conv, b_conv);
47562         return ret_conv;
47563 }
47564
47565 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
47566         LDKRouteHint this_obj_conv;
47567         this_obj_conv.inner = untag_ptr(this_obj);
47568         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47570         RouteHint_free(this_obj_conv);
47571 }
47572
47573 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
47574         LDKRouteHint this_ptr_conv;
47575         this_ptr_conv.inner = untag_ptr(this_ptr);
47576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47578         this_ptr_conv.is_owned = false;
47579         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
47580         uint64_tArray ret_arr = NULL;
47581         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47582         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47583         for (size_t o = 0; o < ret_var.datalen; o++) {
47584                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
47585                 uint64_t ret_conv_14_ref = 0;
47586                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47587                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
47588                 ret_arr_ptr[o] = ret_conv_14_ref;
47589         }
47590         
47591         FREE(ret_var.data);
47592         return ret_arr;
47593 }
47594
47595 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
47596         LDKRouteHint this_ptr_conv;
47597         this_ptr_conv.inner = untag_ptr(this_ptr);
47598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47600         this_ptr_conv.is_owned = false;
47601         LDKCVec_RouteHintHopZ val_constr;
47602         val_constr.datalen = val->arr_len;
47603         if (val_constr.datalen > 0)
47604                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
47605         else
47606                 val_constr.data = NULL;
47607         uint64_t* val_vals = val->elems;
47608         for (size_t o = 0; o < val_constr.datalen; o++) {
47609                 uint64_t val_conv_14 = val_vals[o];
47610                 LDKRouteHintHop val_conv_14_conv;
47611                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
47612                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
47613                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
47614                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
47615                 val_constr.data[o] = val_conv_14_conv;
47616         }
47617         FREE(val);
47618         RouteHint_set_a(&this_ptr_conv, val_constr);
47619 }
47620
47621 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
47622         LDKCVec_RouteHintHopZ a_arg_constr;
47623         a_arg_constr.datalen = a_arg->arr_len;
47624         if (a_arg_constr.datalen > 0)
47625                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
47626         else
47627                 a_arg_constr.data = NULL;
47628         uint64_t* a_arg_vals = a_arg->elems;
47629         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
47630                 uint64_t a_arg_conv_14 = a_arg_vals[o];
47631                 LDKRouteHintHop a_arg_conv_14_conv;
47632                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
47633                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
47634                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
47635                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
47636                 a_arg_constr.data[o] = a_arg_conv_14_conv;
47637         }
47638         FREE(a_arg);
47639         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
47640         uint64_t ret_ref = 0;
47641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47643         return ret_ref;
47644 }
47645
47646 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
47647         LDKRouteHint ret_var = RouteHint_clone(arg);
47648         uint64_t ret_ref = 0;
47649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47651         return ret_ref;
47652 }
47653 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
47654         LDKRouteHint arg_conv;
47655         arg_conv.inner = untag_ptr(arg);
47656         arg_conv.is_owned = ptr_is_owned(arg);
47657         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47658         arg_conv.is_owned = false;
47659         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
47660         return ret_conv;
47661 }
47662
47663 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
47664         LDKRouteHint orig_conv;
47665         orig_conv.inner = untag_ptr(orig);
47666         orig_conv.is_owned = ptr_is_owned(orig);
47667         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47668         orig_conv.is_owned = false;
47669         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
47670         uint64_t ret_ref = 0;
47671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47673         return ret_ref;
47674 }
47675
47676 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
47677         LDKRouteHint o_conv;
47678         o_conv.inner = untag_ptr(o);
47679         o_conv.is_owned = ptr_is_owned(o);
47680         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47681         o_conv.is_owned = false;
47682         int64_t ret_conv = RouteHint_hash(&o_conv);
47683         return ret_conv;
47684 }
47685
47686 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
47687         LDKRouteHint a_conv;
47688         a_conv.inner = untag_ptr(a);
47689         a_conv.is_owned = ptr_is_owned(a);
47690         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47691         a_conv.is_owned = false;
47692         LDKRouteHint b_conv;
47693         b_conv.inner = untag_ptr(b);
47694         b_conv.is_owned = ptr_is_owned(b);
47695         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47696         b_conv.is_owned = false;
47697         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
47698         return ret_conv;
47699 }
47700
47701 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
47702         LDKRouteHint obj_conv;
47703         obj_conv.inner = untag_ptr(obj);
47704         obj_conv.is_owned = ptr_is_owned(obj);
47705         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47706         obj_conv.is_owned = false;
47707         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
47708         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47709         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47710         CVec_u8Z_free(ret_var);
47711         return ret_arr;
47712 }
47713
47714 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
47715         LDKu8slice ser_ref;
47716         ser_ref.datalen = ser->arr_len;
47717         ser_ref.data = ser->elems;
47718         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
47719         *ret_conv = RouteHint_read(ser_ref);
47720         FREE(ser);
47721         return tag_ptr(ret_conv, true);
47722 }
47723
47724 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
47725         LDKRouteHintHop this_obj_conv;
47726         this_obj_conv.inner = untag_ptr(this_obj);
47727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47729         RouteHintHop_free(this_obj_conv);
47730 }
47731
47732 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
47733         LDKRouteHintHop this_ptr_conv;
47734         this_ptr_conv.inner = untag_ptr(this_ptr);
47735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47737         this_ptr_conv.is_owned = false;
47738         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47739         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
47740         return ret_arr;
47741 }
47742
47743 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
47744         LDKRouteHintHop this_ptr_conv;
47745         this_ptr_conv.inner = untag_ptr(this_ptr);
47746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47748         this_ptr_conv.is_owned = false;
47749         LDKPublicKey val_ref;
47750         CHECK(val->arr_len == 33);
47751         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47752         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
47753 }
47754
47755 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
47756         LDKRouteHintHop this_ptr_conv;
47757         this_ptr_conv.inner = untag_ptr(this_ptr);
47758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47760         this_ptr_conv.is_owned = false;
47761         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
47762         return ret_conv;
47763 }
47764
47765 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
47766         LDKRouteHintHop this_ptr_conv;
47767         this_ptr_conv.inner = untag_ptr(this_ptr);
47768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47770         this_ptr_conv.is_owned = false;
47771         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
47772 }
47773
47774 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
47775         LDKRouteHintHop this_ptr_conv;
47776         this_ptr_conv.inner = untag_ptr(this_ptr);
47777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47779         this_ptr_conv.is_owned = false;
47780         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
47781         uint64_t ret_ref = 0;
47782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47784         return ret_ref;
47785 }
47786
47787 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
47788         LDKRouteHintHop this_ptr_conv;
47789         this_ptr_conv.inner = untag_ptr(this_ptr);
47790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47792         this_ptr_conv.is_owned = false;
47793         LDKRoutingFees val_conv;
47794         val_conv.inner = untag_ptr(val);
47795         val_conv.is_owned = ptr_is_owned(val);
47796         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47797         val_conv = RoutingFees_clone(&val_conv);
47798         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
47799 }
47800
47801 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
47802         LDKRouteHintHop this_ptr_conv;
47803         this_ptr_conv.inner = untag_ptr(this_ptr);
47804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47806         this_ptr_conv.is_owned = false;
47807         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
47808         return ret_conv;
47809 }
47810
47811 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
47812         LDKRouteHintHop this_ptr_conv;
47813         this_ptr_conv.inner = untag_ptr(this_ptr);
47814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47816         this_ptr_conv.is_owned = false;
47817         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
47818 }
47819
47820 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
47821         LDKRouteHintHop this_ptr_conv;
47822         this_ptr_conv.inner = untag_ptr(this_ptr);
47823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47825         this_ptr_conv.is_owned = false;
47826         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47827         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
47828         uint64_t ret_ref = tag_ptr(ret_copy, true);
47829         return ret_ref;
47830 }
47831
47832 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
47833         LDKRouteHintHop this_ptr_conv;
47834         this_ptr_conv.inner = untag_ptr(this_ptr);
47835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47837         this_ptr_conv.is_owned = false;
47838         void* val_ptr = untag_ptr(val);
47839         CHECK_ACCESS(val_ptr);
47840         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47841         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47842         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
47843 }
47844
47845 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
47846         LDKRouteHintHop this_ptr_conv;
47847         this_ptr_conv.inner = untag_ptr(this_ptr);
47848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47850         this_ptr_conv.is_owned = false;
47851         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47852         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
47853         uint64_t ret_ref = tag_ptr(ret_copy, true);
47854         return ret_ref;
47855 }
47856
47857 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
47858         LDKRouteHintHop this_ptr_conv;
47859         this_ptr_conv.inner = untag_ptr(this_ptr);
47860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47862         this_ptr_conv.is_owned = false;
47863         void* val_ptr = untag_ptr(val);
47864         CHECK_ACCESS(val_ptr);
47865         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47866         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47867         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
47868 }
47869
47870 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) {
47871         LDKPublicKey src_node_id_arg_ref;
47872         CHECK(src_node_id_arg->arr_len == 33);
47873         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
47874         LDKRoutingFees fees_arg_conv;
47875         fees_arg_conv.inner = untag_ptr(fees_arg);
47876         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
47877         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
47878         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
47879         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
47880         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
47881         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
47882         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
47883         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
47884         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
47885         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
47886         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
47887         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);
47888         uint64_t ret_ref = 0;
47889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47891         return ret_ref;
47892 }
47893
47894 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
47895         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
47896         uint64_t ret_ref = 0;
47897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47899         return ret_ref;
47900 }
47901 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
47902         LDKRouteHintHop arg_conv;
47903         arg_conv.inner = untag_ptr(arg);
47904         arg_conv.is_owned = ptr_is_owned(arg);
47905         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47906         arg_conv.is_owned = false;
47907         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
47908         return ret_conv;
47909 }
47910
47911 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
47912         LDKRouteHintHop orig_conv;
47913         orig_conv.inner = untag_ptr(orig);
47914         orig_conv.is_owned = ptr_is_owned(orig);
47915         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47916         orig_conv.is_owned = false;
47917         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
47918         uint64_t ret_ref = 0;
47919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47921         return ret_ref;
47922 }
47923
47924 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
47925         LDKRouteHintHop o_conv;
47926         o_conv.inner = untag_ptr(o);
47927         o_conv.is_owned = ptr_is_owned(o);
47928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47929         o_conv.is_owned = false;
47930         int64_t ret_conv = RouteHintHop_hash(&o_conv);
47931         return ret_conv;
47932 }
47933
47934 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
47935         LDKRouteHintHop a_conv;
47936         a_conv.inner = untag_ptr(a);
47937         a_conv.is_owned = ptr_is_owned(a);
47938         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47939         a_conv.is_owned = false;
47940         LDKRouteHintHop b_conv;
47941         b_conv.inner = untag_ptr(b);
47942         b_conv.is_owned = ptr_is_owned(b);
47943         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47944         b_conv.is_owned = false;
47945         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
47946         return ret_conv;
47947 }
47948
47949 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
47950         LDKRouteHintHop obj_conv;
47951         obj_conv.inner = untag_ptr(obj);
47952         obj_conv.is_owned = ptr_is_owned(obj);
47953         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47954         obj_conv.is_owned = false;
47955         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
47956         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47957         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47958         CVec_u8Z_free(ret_var);
47959         return ret_arr;
47960 }
47961
47962 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
47963         LDKu8slice ser_ref;
47964         ser_ref.datalen = ser->arr_len;
47965         ser_ref.data = ser->elems;
47966         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
47967         *ret_conv = RouteHintHop_read(ser_ref);
47968         FREE(ser);
47969         return tag_ptr(ret_conv, true);
47970 }
47971
47972 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) {
47973         LDKPublicKey our_node_pubkey_ref;
47974         CHECK(our_node_pubkey->arr_len == 33);
47975         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
47976         LDKRouteParameters route_params_conv;
47977         route_params_conv.inner = untag_ptr(route_params);
47978         route_params_conv.is_owned = ptr_is_owned(route_params);
47979         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
47980         route_params_conv.is_owned = false;
47981         LDKNetworkGraph network_graph_conv;
47982         network_graph_conv.inner = untag_ptr(network_graph);
47983         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47984         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47985         network_graph_conv.is_owned = false;
47986         LDKCVec_ChannelDetailsZ first_hops_constr;
47987         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
47988         if (first_hops != 0) {
47989                 first_hops_constr.datalen = first_hops->arr_len;
47990                 if (first_hops_constr.datalen > 0)
47991                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
47992                 else
47993                         first_hops_constr.data = NULL;
47994                 uint64_t* first_hops_vals = first_hops->elems;
47995                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
47996                         uint64_t first_hops_conv_16 = first_hops_vals[q];
47997                         LDKChannelDetails first_hops_conv_16_conv;
47998                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
47999                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
48000                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
48001                         first_hops_conv_16_conv.is_owned = false;
48002                         first_hops_constr.data[q] = first_hops_conv_16_conv;
48003                 }
48004                 FREE(first_hops);
48005                 first_hops_ptr = &first_hops_constr;
48006         }
48007         void* logger_ptr = untag_ptr(logger);
48008         CHECK_ACCESS(logger_ptr);
48009         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48010         if (logger_conv.free == LDKLogger_JCalls_free) {
48011                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48012                 LDKLogger_JCalls_cloned(&logger_conv);
48013         }
48014         void* scorer_ptr = untag_ptr(scorer);
48015         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
48016         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
48017         uint8_t random_seed_bytes_arr[32];
48018         CHECK(random_seed_bytes->arr_len == 32);
48019         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
48020         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
48021         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
48022         *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);
48023         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
48024         return tag_ptr(ret_conv, true);
48025 }
48026
48027 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) {
48028         LDKPublicKey our_node_pubkey_ref;
48029         CHECK(our_node_pubkey->arr_len == 33);
48030         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
48031         LDKCVec_PublicKeyZ hops_constr;
48032         hops_constr.datalen = hops->arr_len;
48033         if (hops_constr.datalen > 0)
48034                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
48035         else
48036                 hops_constr.data = NULL;
48037         int8_tArray* hops_vals = (void*) hops->elems;
48038         for (size_t m = 0; m < hops_constr.datalen; m++) {
48039                 int8_tArray hops_conv_12 = hops_vals[m];
48040                 LDKPublicKey hops_conv_12_ref;
48041                 CHECK(hops_conv_12->arr_len == 33);
48042                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
48043                 hops_constr.data[m] = hops_conv_12_ref;
48044         }
48045         FREE(hops);
48046         LDKRouteParameters route_params_conv;
48047         route_params_conv.inner = untag_ptr(route_params);
48048         route_params_conv.is_owned = ptr_is_owned(route_params);
48049         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48050         route_params_conv.is_owned = false;
48051         LDKNetworkGraph network_graph_conv;
48052         network_graph_conv.inner = untag_ptr(network_graph);
48053         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48054         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48055         network_graph_conv.is_owned = false;
48056         void* logger_ptr = untag_ptr(logger);
48057         CHECK_ACCESS(logger_ptr);
48058         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48059         if (logger_conv.free == LDKLogger_JCalls_free) {
48060                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48061                 LDKLogger_JCalls_cloned(&logger_conv);
48062         }
48063         uint8_t random_seed_bytes_arr[32];
48064         CHECK(random_seed_bytes->arr_len == 32);
48065         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
48066         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
48067         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
48068         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
48069         return tag_ptr(ret_conv, true);
48070 }
48071
48072 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
48073         if (!ptr_is_owned(this_ptr)) return;
48074         void* this_ptr_ptr = untag_ptr(this_ptr);
48075         CHECK_ACCESS(this_ptr_ptr);
48076         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
48077         FREE(untag_ptr(this_ptr));
48078         Score_free(this_ptr_conv);
48079 }
48080
48081 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
48082         if (!ptr_is_owned(this_ptr)) return;
48083         void* this_ptr_ptr = untag_ptr(this_ptr);
48084         CHECK_ACCESS(this_ptr_ptr);
48085         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
48086         FREE(untag_ptr(this_ptr));
48087         LockableScore_free(this_ptr_conv);
48088 }
48089
48090 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
48091         if (!ptr_is_owned(this_ptr)) return;
48092         void* this_ptr_ptr = untag_ptr(this_ptr);
48093         CHECK_ACCESS(this_ptr_ptr);
48094         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
48095         FREE(untag_ptr(this_ptr));
48096         WriteableScore_free(this_ptr_conv);
48097 }
48098
48099 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
48100         LDKMultiThreadedLockableScore this_obj_conv;
48101         this_obj_conv.inner = untag_ptr(this_obj);
48102         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48104         MultiThreadedLockableScore_free(this_obj_conv);
48105 }
48106
48107 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
48108         LDKMultiThreadedScoreLock this_obj_conv;
48109         this_obj_conv.inner = untag_ptr(this_obj);
48110         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48112         MultiThreadedScoreLock_free(this_obj_conv);
48113 }
48114
48115 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
48116         LDKMultiThreadedScoreLock this_arg_conv;
48117         this_arg_conv.inner = untag_ptr(this_arg);
48118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48120         this_arg_conv.is_owned = false;
48121         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48122         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
48123         return tag_ptr(ret_ret, true);
48124 }
48125
48126 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
48127         LDKMultiThreadedScoreLock obj_conv;
48128         obj_conv.inner = untag_ptr(obj);
48129         obj_conv.is_owned = ptr_is_owned(obj);
48130         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48131         obj_conv.is_owned = false;
48132         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
48133         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48134         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48135         CVec_u8Z_free(ret_var);
48136         return ret_arr;
48137 }
48138
48139 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
48140         LDKMultiThreadedLockableScore this_arg_conv;
48141         this_arg_conv.inner = untag_ptr(this_arg);
48142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48144         this_arg_conv.is_owned = false;
48145         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
48146         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
48147         return tag_ptr(ret_ret, true);
48148 }
48149
48150 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
48151         LDKMultiThreadedLockableScore obj_conv;
48152         obj_conv.inner = untag_ptr(obj);
48153         obj_conv.is_owned = ptr_is_owned(obj);
48154         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48155         obj_conv.is_owned = false;
48156         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
48157         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48158         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48159         CVec_u8Z_free(ret_var);
48160         return ret_arr;
48161 }
48162
48163 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
48164         LDKMultiThreadedLockableScore this_arg_conv;
48165         this_arg_conv.inner = untag_ptr(this_arg);
48166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48168         this_arg_conv.is_owned = false;
48169         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
48170         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
48171         return tag_ptr(ret_ret, true);
48172 }
48173
48174 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
48175         void* score_ptr = untag_ptr(score);
48176         CHECK_ACCESS(score_ptr);
48177         LDKScore score_conv = *(LDKScore*)(score_ptr);
48178         if (score_conv.free == LDKScore_JCalls_free) {
48179                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48180                 LDKScore_JCalls_cloned(&score_conv);
48181         }
48182         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
48183         uint64_t ret_ref = 0;
48184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48186         return ret_ref;
48187 }
48188
48189 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
48190         LDKChannelUsage this_obj_conv;
48191         this_obj_conv.inner = untag_ptr(this_obj);
48192         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48194         ChannelUsage_free(this_obj_conv);
48195 }
48196
48197 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
48198         LDKChannelUsage this_ptr_conv;
48199         this_ptr_conv.inner = untag_ptr(this_ptr);
48200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48202         this_ptr_conv.is_owned = false;
48203         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
48204         return ret_conv;
48205 }
48206
48207 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
48208         LDKChannelUsage this_ptr_conv;
48209         this_ptr_conv.inner = untag_ptr(this_ptr);
48210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48212         this_ptr_conv.is_owned = false;
48213         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
48214 }
48215
48216 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
48217         LDKChannelUsage this_ptr_conv;
48218         this_ptr_conv.inner = untag_ptr(this_ptr);
48219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48221         this_ptr_conv.is_owned = false;
48222         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
48223         return ret_conv;
48224 }
48225
48226 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
48227         LDKChannelUsage this_ptr_conv;
48228         this_ptr_conv.inner = untag_ptr(this_ptr);
48229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48231         this_ptr_conv.is_owned = false;
48232         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
48233 }
48234
48235 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
48236         LDKChannelUsage this_ptr_conv;
48237         this_ptr_conv.inner = untag_ptr(this_ptr);
48238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48240         this_ptr_conv.is_owned = false;
48241         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48242         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
48243         uint64_t ret_ref = tag_ptr(ret_copy, true);
48244         return ret_ref;
48245 }
48246
48247 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
48248         LDKChannelUsage this_ptr_conv;
48249         this_ptr_conv.inner = untag_ptr(this_ptr);
48250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48252         this_ptr_conv.is_owned = false;
48253         void* val_ptr = untag_ptr(val);
48254         CHECK_ACCESS(val_ptr);
48255         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
48256         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
48257         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
48258 }
48259
48260 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) {
48261         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
48262         CHECK_ACCESS(effective_capacity_arg_ptr);
48263         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
48264         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
48265         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
48266         uint64_t ret_ref = 0;
48267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48269         return ret_ref;
48270 }
48271
48272 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
48273         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
48274         uint64_t ret_ref = 0;
48275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48277         return ret_ref;
48278 }
48279 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
48280         LDKChannelUsage arg_conv;
48281         arg_conv.inner = untag_ptr(arg);
48282         arg_conv.is_owned = ptr_is_owned(arg);
48283         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48284         arg_conv.is_owned = false;
48285         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
48286         return ret_conv;
48287 }
48288
48289 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
48290         LDKChannelUsage orig_conv;
48291         orig_conv.inner = untag_ptr(orig);
48292         orig_conv.is_owned = ptr_is_owned(orig);
48293         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48294         orig_conv.is_owned = false;
48295         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
48296         uint64_t ret_ref = 0;
48297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48299         return ret_ref;
48300 }
48301
48302 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
48303         LDKFixedPenaltyScorer this_obj_conv;
48304         this_obj_conv.inner = untag_ptr(this_obj);
48305         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48307         FixedPenaltyScorer_free(this_obj_conv);
48308 }
48309
48310 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
48311         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
48312         uint64_t ret_ref = 0;
48313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48315         return ret_ref;
48316 }
48317 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
48318         LDKFixedPenaltyScorer arg_conv;
48319         arg_conv.inner = untag_ptr(arg);
48320         arg_conv.is_owned = ptr_is_owned(arg);
48321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48322         arg_conv.is_owned = false;
48323         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
48324         return ret_conv;
48325 }
48326
48327 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
48328         LDKFixedPenaltyScorer orig_conv;
48329         orig_conv.inner = untag_ptr(orig);
48330         orig_conv.is_owned = ptr_is_owned(orig);
48331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48332         orig_conv.is_owned = false;
48333         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
48334         uint64_t ret_ref = 0;
48335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48337         return ret_ref;
48338 }
48339
48340 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
48341         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
48342         uint64_t ret_ref = 0;
48343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48345         return ret_ref;
48346 }
48347
48348 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
48349         LDKFixedPenaltyScorer this_arg_conv;
48350         this_arg_conv.inner = untag_ptr(this_arg);
48351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48353         this_arg_conv.is_owned = false;
48354         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48355         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
48356         return tag_ptr(ret_ret, true);
48357 }
48358
48359 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
48360         LDKFixedPenaltyScorer obj_conv;
48361         obj_conv.inner = untag_ptr(obj);
48362         obj_conv.is_owned = ptr_is_owned(obj);
48363         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48364         obj_conv.is_owned = false;
48365         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
48366         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48367         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48368         CVec_u8Z_free(ret_var);
48369         return ret_arr;
48370 }
48371
48372 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
48373         LDKu8slice ser_ref;
48374         ser_ref.datalen = ser->arr_len;
48375         ser_ref.data = ser->elems;
48376         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
48377         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
48378         FREE(ser);
48379         return tag_ptr(ret_conv, true);
48380 }
48381
48382 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
48383         LDKProbabilisticScorer this_obj_conv;
48384         this_obj_conv.inner = untag_ptr(this_obj);
48385         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48387         ProbabilisticScorer_free(this_obj_conv);
48388 }
48389
48390 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
48391         LDKProbabilisticScoringParameters this_obj_conv;
48392         this_obj_conv.inner = untag_ptr(this_obj);
48393         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48395         ProbabilisticScoringParameters_free(this_obj_conv);
48396 }
48397
48398 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
48399         LDKProbabilisticScoringParameters this_ptr_conv;
48400         this_ptr_conv.inner = untag_ptr(this_ptr);
48401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48403         this_ptr_conv.is_owned = false;
48404         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
48405         return ret_conv;
48406 }
48407
48408 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
48409         LDKProbabilisticScoringParameters this_ptr_conv;
48410         this_ptr_conv.inner = untag_ptr(this_ptr);
48411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48413         this_ptr_conv.is_owned = false;
48414         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
48415 }
48416
48417 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) {
48418         LDKProbabilisticScoringParameters this_ptr_conv;
48419         this_ptr_conv.inner = untag_ptr(this_ptr);
48420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48422         this_ptr_conv.is_owned = false;
48423         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
48424         return ret_conv;
48425 }
48426
48427 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) {
48428         LDKProbabilisticScoringParameters this_ptr_conv;
48429         this_ptr_conv.inner = untag_ptr(this_ptr);
48430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48432         this_ptr_conv.is_owned = false;
48433         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48434 }
48435
48436 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
48437         LDKProbabilisticScoringParameters this_ptr_conv;
48438         this_ptr_conv.inner = untag_ptr(this_ptr);
48439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48441         this_ptr_conv.is_owned = false;
48442         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
48443         return ret_conv;
48444 }
48445
48446 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) {
48447         LDKProbabilisticScoringParameters this_ptr_conv;
48448         this_ptr_conv.inner = untag_ptr(this_ptr);
48449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48451         this_ptr_conv.is_owned = false;
48452         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
48453 }
48454
48455 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
48456         LDKProbabilisticScoringParameters this_ptr_conv;
48457         this_ptr_conv.inner = untag_ptr(this_ptr);
48458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48460         this_ptr_conv.is_owned = false;
48461         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
48462         return ret_conv;
48463 }
48464
48465 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) {
48466         LDKProbabilisticScoringParameters this_ptr_conv;
48467         this_ptr_conv.inner = untag_ptr(this_ptr);
48468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48470         this_ptr_conv.is_owned = false;
48471         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
48472 }
48473
48474 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) {
48475         LDKProbabilisticScoringParameters this_ptr_conv;
48476         this_ptr_conv.inner = untag_ptr(this_ptr);
48477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48479         this_ptr_conv.is_owned = false;
48480         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
48481         return ret_conv;
48482 }
48483
48484 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) {
48485         LDKProbabilisticScoringParameters this_ptr_conv;
48486         this_ptr_conv.inner = untag_ptr(this_ptr);
48487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48489         this_ptr_conv.is_owned = false;
48490         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48491 }
48492
48493 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) {
48494         LDKProbabilisticScoringParameters this_ptr_conv;
48495         this_ptr_conv.inner = untag_ptr(this_ptr);
48496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48498         this_ptr_conv.is_owned = false;
48499         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
48500         return ret_conv;
48501 }
48502
48503 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) {
48504         LDKProbabilisticScoringParameters this_ptr_conv;
48505         this_ptr_conv.inner = untag_ptr(this_ptr);
48506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48508         this_ptr_conv.is_owned = false;
48509         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
48510 }
48511
48512 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) {
48513         LDKProbabilisticScoringParameters this_ptr_conv;
48514         this_ptr_conv.inner = untag_ptr(this_ptr);
48515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48517         this_ptr_conv.is_owned = false;
48518         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
48519         return ret_conv;
48520 }
48521
48522 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) {
48523         LDKProbabilisticScoringParameters this_ptr_conv;
48524         this_ptr_conv.inner = untag_ptr(this_ptr);
48525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48527         this_ptr_conv.is_owned = false;
48528         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48529 }
48530
48531 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) {
48532         LDKProbabilisticScoringParameters this_ptr_conv;
48533         this_ptr_conv.inner = untag_ptr(this_ptr);
48534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48536         this_ptr_conv.is_owned = false;
48537         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
48538         return ret_conv;
48539 }
48540
48541 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) {
48542         LDKProbabilisticScoringParameters this_ptr_conv;
48543         this_ptr_conv.inner = untag_ptr(this_ptr);
48544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48546         this_ptr_conv.is_owned = false;
48547         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
48548 }
48549
48550 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
48551         LDKProbabilisticScoringParameters this_ptr_conv;
48552         this_ptr_conv.inner = untag_ptr(this_ptr);
48553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48555         this_ptr_conv.is_owned = false;
48556         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
48557         return ret_conv;
48558 }
48559
48560 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) {
48561         LDKProbabilisticScoringParameters this_ptr_conv;
48562         this_ptr_conv.inner = untag_ptr(this_ptr);
48563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48565         this_ptr_conv.is_owned = false;
48566         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
48567 }
48568
48569 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
48570         LDKProbabilisticScoringParameters this_ptr_conv;
48571         this_ptr_conv.inner = untag_ptr(this_ptr);
48572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48574         this_ptr_conv.is_owned = false;
48575         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
48576         return ret_conv;
48577 }
48578
48579 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) {
48580         LDKProbabilisticScoringParameters this_ptr_conv;
48581         this_ptr_conv.inner = untag_ptr(this_ptr);
48582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48584         this_ptr_conv.is_owned = false;
48585         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
48586 }
48587
48588 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
48589         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
48590         uint64_t ret_ref = 0;
48591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48593         return ret_ref;
48594 }
48595 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
48596         LDKProbabilisticScoringParameters arg_conv;
48597         arg_conv.inner = untag_ptr(arg);
48598         arg_conv.is_owned = ptr_is_owned(arg);
48599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48600         arg_conv.is_owned = false;
48601         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
48602         return ret_conv;
48603 }
48604
48605 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
48606         LDKProbabilisticScoringParameters orig_conv;
48607         orig_conv.inner = untag_ptr(orig);
48608         orig_conv.is_owned = ptr_is_owned(orig);
48609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48610         orig_conv.is_owned = false;
48611         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
48612         uint64_t ret_ref = 0;
48613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48615         return ret_ref;
48616 }
48617
48618 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
48619         LDKProbabilisticScoringParameters params_conv;
48620         params_conv.inner = untag_ptr(params);
48621         params_conv.is_owned = ptr_is_owned(params);
48622         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
48623         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
48624         LDKNetworkGraph network_graph_conv;
48625         network_graph_conv.inner = untag_ptr(network_graph);
48626         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48627         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48628         network_graph_conv.is_owned = false;
48629         void* logger_ptr = untag_ptr(logger);
48630         CHECK_ACCESS(logger_ptr);
48631         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48632         if (logger_conv.free == LDKLogger_JCalls_free) {
48633                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48634                 LDKLogger_JCalls_cloned(&logger_conv);
48635         }
48636         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
48637         uint64_t ret_ref = 0;
48638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48640         return ret_ref;
48641 }
48642
48643 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
48644         LDKProbabilisticScorer this_arg_conv;
48645         this_arg_conv.inner = untag_ptr(this_arg);
48646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48648         this_arg_conv.is_owned = false;
48649         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
48650 }
48651
48652 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) {
48653         LDKProbabilisticScorer this_arg_conv;
48654         this_arg_conv.inner = untag_ptr(this_arg);
48655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48657         this_arg_conv.is_owned = false;
48658         LDKNodeId target_conv;
48659         target_conv.inner = untag_ptr(target);
48660         target_conv.is_owned = ptr_is_owned(target);
48661         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
48662         target_conv.is_owned = false;
48663         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
48664         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
48665         uint64_t ret_ref = tag_ptr(ret_copy, true);
48666         return ret_ref;
48667 }
48668
48669 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) {
48670         LDKProbabilisticScorer this_arg_conv;
48671         this_arg_conv.inner = untag_ptr(this_arg);
48672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48674         this_arg_conv.is_owned = false;
48675         LDKNodeId target_conv;
48676         target_conv.inner = untag_ptr(target);
48677         target_conv.is_owned = ptr_is_owned(target);
48678         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
48679         target_conv.is_owned = false;
48680         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
48681         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
48682         uint64_t ret_ref = tag_ptr(ret_copy, true);
48683         return ret_ref;
48684 }
48685
48686 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
48687         LDKProbabilisticScorer this_arg_conv;
48688         this_arg_conv.inner = untag_ptr(this_arg);
48689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48691         this_arg_conv.is_owned = false;
48692         LDKNodeId node_id_conv;
48693         node_id_conv.inner = untag_ptr(node_id);
48694         node_id_conv.is_owned = ptr_is_owned(node_id);
48695         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48696         node_id_conv.is_owned = false;
48697         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
48698 }
48699
48700 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
48701         LDKProbabilisticScorer this_arg_conv;
48702         this_arg_conv.inner = untag_ptr(this_arg);
48703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48705         this_arg_conv.is_owned = false;
48706         LDKNodeId node_id_conv;
48707         node_id_conv.inner = untag_ptr(node_id);
48708         node_id_conv.is_owned = ptr_is_owned(node_id);
48709         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48710         node_id_conv.is_owned = false;
48711         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
48712 }
48713
48714 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) {
48715         LDKProbabilisticScorer this_arg_conv;
48716         this_arg_conv.inner = untag_ptr(this_arg);
48717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48719         this_arg_conv.is_owned = false;
48720         LDKNodeId node_id_conv;
48721         node_id_conv.inner = untag_ptr(node_id);
48722         node_id_conv.is_owned = ptr_is_owned(node_id);
48723         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48724         node_id_conv.is_owned = false;
48725         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
48726 }
48727
48728 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
48729         LDKProbabilisticScorer this_arg_conv;
48730         this_arg_conv.inner = untag_ptr(this_arg);
48731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48733         this_arg_conv.is_owned = false;
48734         LDKNodeId node_id_conv;
48735         node_id_conv.inner = untag_ptr(node_id);
48736         node_id_conv.is_owned = ptr_is_owned(node_id);
48737         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48738         node_id_conv.is_owned = false;
48739         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
48740 }
48741
48742 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
48743         LDKProbabilisticScorer this_arg_conv;
48744         this_arg_conv.inner = untag_ptr(this_arg);
48745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48747         this_arg_conv.is_owned = false;
48748         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
48749 }
48750
48751 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
48752         LDKProbabilisticScoringParameters this_arg_conv;
48753         this_arg_conv.inner = untag_ptr(this_arg);
48754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48756         this_arg_conv.is_owned = false;
48757         LDKCVec_NodeIdZ node_ids_constr;
48758         node_ids_constr.datalen = node_ids->arr_len;
48759         if (node_ids_constr.datalen > 0)
48760                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
48761         else
48762                 node_ids_constr.data = NULL;
48763         uint64_t* node_ids_vals = node_ids->elems;
48764         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
48765                 uint64_t node_ids_conv_8 = node_ids_vals[i];
48766                 LDKNodeId node_ids_conv_8_conv;
48767                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
48768                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
48769                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
48770                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
48771                 node_ids_constr.data[i] = node_ids_conv_8_conv;
48772         }
48773         FREE(node_ids);
48774         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
48775 }
48776
48777 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
48778         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
48779         uint64_t ret_ref = 0;
48780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48782         return ret_ref;
48783 }
48784
48785 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
48786         LDKProbabilisticScorer this_arg_conv;
48787         this_arg_conv.inner = untag_ptr(this_arg);
48788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48790         this_arg_conv.is_owned = false;
48791         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48792         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
48793         return tag_ptr(ret_ret, true);
48794 }
48795
48796 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
48797         LDKProbabilisticScorer obj_conv;
48798         obj_conv.inner = untag_ptr(obj);
48799         obj_conv.is_owned = ptr_is_owned(obj);
48800         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48801         obj_conv.is_owned = false;
48802         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
48803         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48804         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48805         CVec_u8Z_free(ret_var);
48806         return ret_arr;
48807 }
48808
48809 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) {
48810         LDKu8slice ser_ref;
48811         ser_ref.datalen = ser->arr_len;
48812         ser_ref.data = ser->elems;
48813         LDKProbabilisticScoringParameters arg_a_conv;
48814         arg_a_conv.inner = untag_ptr(arg_a);
48815         arg_a_conv.is_owned = ptr_is_owned(arg_a);
48816         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
48817         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
48818         LDKNetworkGraph arg_b_conv;
48819         arg_b_conv.inner = untag_ptr(arg_b);
48820         arg_b_conv.is_owned = ptr_is_owned(arg_b);
48821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
48822         arg_b_conv.is_owned = false;
48823         void* arg_c_ptr = untag_ptr(arg_c);
48824         CHECK_ACCESS(arg_c_ptr);
48825         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
48826         if (arg_c_conv.free == LDKLogger_JCalls_free) {
48827                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48828                 LDKLogger_JCalls_cloned(&arg_c_conv);
48829         }
48830         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
48831         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
48832         FREE(ser);
48833         return tag_ptr(ret_conv, true);
48834 }
48835
48836 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
48837         LDKOnionMessenger this_obj_conv;
48838         this_obj_conv.inner = untag_ptr(this_obj);
48839         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48841         OnionMessenger_free(this_obj_conv);
48842 }
48843
48844 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
48845         if (!ptr_is_owned(this_ptr)) return;
48846         void* this_ptr_ptr = untag_ptr(this_ptr);
48847         CHECK_ACCESS(this_ptr_ptr);
48848         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
48849         FREE(untag_ptr(this_ptr));
48850         Destination_free(this_ptr_conv);
48851 }
48852
48853 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
48854         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48855         *ret_copy = Destination_clone(arg);
48856         uint64_t ret_ref = tag_ptr(ret_copy, true);
48857         return ret_ref;
48858 }
48859 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
48860         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
48861         int64_t ret_conv = Destination_clone_ptr(arg_conv);
48862         return ret_conv;
48863 }
48864
48865 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
48866         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
48867         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48868         *ret_copy = Destination_clone(orig_conv);
48869         uint64_t ret_ref = tag_ptr(ret_copy, true);
48870         return ret_ref;
48871 }
48872
48873 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
48874         LDKPublicKey a_ref;
48875         CHECK(a->arr_len == 33);
48876         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
48877         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48878         *ret_copy = Destination_node(a_ref);
48879         uint64_t ret_ref = tag_ptr(ret_copy, true);
48880         return ret_ref;
48881 }
48882
48883 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
48884         LDKBlindedPath a_conv;
48885         a_conv.inner = untag_ptr(a);
48886         a_conv.is_owned = ptr_is_owned(a);
48887         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48888         a_conv = BlindedPath_clone(&a_conv);
48889         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48890         *ret_copy = Destination_blinded_path(a_conv);
48891         uint64_t ret_ref = tag_ptr(ret_copy, true);
48892         return ret_ref;
48893 }
48894
48895 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
48896         if (!ptr_is_owned(this_ptr)) return;
48897         void* this_ptr_ptr = untag_ptr(this_ptr);
48898         CHECK_ACCESS(this_ptr_ptr);
48899         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
48900         FREE(untag_ptr(this_ptr));
48901         SendError_free(this_ptr_conv);
48902 }
48903
48904 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
48905         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48906         *ret_copy = SendError_clone(arg);
48907         uint64_t ret_ref = tag_ptr(ret_copy, true);
48908         return ret_ref;
48909 }
48910 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
48911         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
48912         int64_t ret_conv = SendError_clone_ptr(arg_conv);
48913         return ret_conv;
48914 }
48915
48916 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
48917         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
48918         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48919         *ret_copy = SendError_clone(orig_conv);
48920         uint64_t ret_ref = tag_ptr(ret_copy, true);
48921         return ret_ref;
48922 }
48923
48924 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
48925         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
48926         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48927         *ret_copy = SendError_secp256k1(a_conv);
48928         uint64_t ret_ref = tag_ptr(ret_copy, true);
48929         return ret_ref;
48930 }
48931
48932 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
48933         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48934         *ret_copy = SendError_too_big_packet();
48935         uint64_t ret_ref = tag_ptr(ret_copy, true);
48936         return ret_ref;
48937 }
48938
48939 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
48940         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48941         *ret_copy = SendError_too_few_blinded_hops();
48942         uint64_t ret_ref = tag_ptr(ret_copy, true);
48943         return ret_ref;
48944 }
48945
48946 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
48947         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48948         *ret_copy = SendError_invalid_first_hop();
48949         uint64_t ret_ref = tag_ptr(ret_copy, true);
48950         return ret_ref;
48951 }
48952
48953 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
48954         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48955         *ret_copy = SendError_invalid_message();
48956         uint64_t ret_ref = tag_ptr(ret_copy, true);
48957         return ret_ref;
48958 }
48959
48960 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
48961         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48962         *ret_copy = SendError_buffer_full();
48963         uint64_t ret_ref = tag_ptr(ret_copy, true);
48964         return ret_ref;
48965 }
48966
48967 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
48968         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48969         *ret_copy = SendError_get_node_id_failed();
48970         uint64_t ret_ref = tag_ptr(ret_copy, true);
48971         return ret_ref;
48972 }
48973
48974 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
48975         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48976         *ret_copy = SendError_blinded_path_advance_failed();
48977         uint64_t ret_ref = tag_ptr(ret_copy, true);
48978         return ret_ref;
48979 }
48980
48981 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
48982         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
48983         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
48984         jboolean ret_conv = SendError_eq(a_conv, b_conv);
48985         return ret_conv;
48986 }
48987
48988 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
48989         if (!ptr_is_owned(this_ptr)) return;
48990         void* this_ptr_ptr = untag_ptr(this_ptr);
48991         CHECK_ACCESS(this_ptr_ptr);
48992         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
48993         FREE(untag_ptr(this_ptr));
48994         CustomOnionMessageHandler_free(this_ptr_conv);
48995 }
48996
48997 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) {
48998         void* entropy_source_ptr = untag_ptr(entropy_source);
48999         CHECK_ACCESS(entropy_source_ptr);
49000         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
49001         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
49002                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49003                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
49004         }
49005         void* node_signer_ptr = untag_ptr(node_signer);
49006         CHECK_ACCESS(node_signer_ptr);
49007         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
49008         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
49009                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49010                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
49011         }
49012         void* logger_ptr = untag_ptr(logger);
49013         CHECK_ACCESS(logger_ptr);
49014         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49015         if (logger_conv.free == LDKLogger_JCalls_free) {
49016                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49017                 LDKLogger_JCalls_cloned(&logger_conv);
49018         }
49019         void* custom_handler_ptr = untag_ptr(custom_handler);
49020         CHECK_ACCESS(custom_handler_ptr);
49021         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
49022         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
49023                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49024                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
49025         }
49026         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_conv);
49027         uint64_t ret_ref = 0;
49028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49030         return ret_ref;
49031 }
49032
49033 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) {
49034         LDKOnionMessenger this_arg_conv;
49035         this_arg_conv.inner = untag_ptr(this_arg);
49036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49038         this_arg_conv.is_owned = false;
49039         LDKCVec_PublicKeyZ intermediate_nodes_constr;
49040         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
49041         if (intermediate_nodes_constr.datalen > 0)
49042                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
49043         else
49044                 intermediate_nodes_constr.data = NULL;
49045         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
49046         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
49047                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
49048                 LDKPublicKey intermediate_nodes_conv_12_ref;
49049                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
49050                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
49051                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
49052         }
49053         FREE(intermediate_nodes);
49054         void* destination_ptr = untag_ptr(destination);
49055         CHECK_ACCESS(destination_ptr);
49056         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
49057         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
49058         void* message_ptr = untag_ptr(message);
49059         CHECK_ACCESS(message_ptr);
49060         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
49061         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
49062         LDKBlindedPath reply_path_conv;
49063         reply_path_conv.inner = untag_ptr(reply_path);
49064         reply_path_conv.is_owned = ptr_is_owned(reply_path);
49065         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
49066         reply_path_conv = BlindedPath_clone(&reply_path_conv);
49067         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
49068         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
49069         return tag_ptr(ret_conv, true);
49070 }
49071
49072 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
49073         LDKOnionMessenger this_arg_conv;
49074         this_arg_conv.inner = untag_ptr(this_arg);
49075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49077         this_arg_conv.is_owned = false;
49078         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
49079         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
49080         return tag_ptr(ret_ret, true);
49081 }
49082
49083 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
49084         LDKOnionMessenger this_arg_conv;
49085         this_arg_conv.inner = untag_ptr(this_arg);
49086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49088         this_arg_conv.is_owned = false;
49089         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
49090         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
49091         return tag_ptr(ret_ret, true);
49092 }
49093
49094 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
49095         if (!ptr_is_owned(this_ptr)) return;
49096         void* this_ptr_ptr = untag_ptr(this_ptr);
49097         CHECK_ACCESS(this_ptr_ptr);
49098         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
49099         FREE(untag_ptr(this_ptr));
49100         OnionMessageContents_free(this_ptr_conv);
49101 }
49102
49103 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
49104         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49105         *ret_copy = OnionMessageContents_clone(arg);
49106         uint64_t ret_ref = tag_ptr(ret_copy, true);
49107         return ret_ref;
49108 }
49109 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
49110         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
49111         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
49112         return ret_conv;
49113 }
49114
49115 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
49116         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
49117         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49118         *ret_copy = OnionMessageContents_clone(orig_conv);
49119         uint64_t ret_ref = tag_ptr(ret_copy, true);
49120         return ret_ref;
49121 }
49122
49123 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
49124         void* a_ptr = untag_ptr(a);
49125         CHECK_ACCESS(a_ptr);
49126         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
49127         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
49128                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49129                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
49130         }
49131         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49132         *ret_copy = OnionMessageContents_custom(a_conv);
49133         uint64_t ret_ref = tag_ptr(ret_copy, true);
49134         return ret_ref;
49135 }
49136
49137 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
49138         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
49139         *ret_ret = CustomOnionMessageContents_clone(arg);
49140         return tag_ptr(ret_ret, true);
49141 }
49142 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
49143         void* arg_ptr = untag_ptr(arg);
49144         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
49145         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
49146         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
49147         return ret_conv;
49148 }
49149
49150 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
49151         void* orig_ptr = untag_ptr(orig);
49152         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
49153         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
49154         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
49155         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
49156         return tag_ptr(ret_ret, true);
49157 }
49158
49159 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
49160         if (!ptr_is_owned(this_ptr)) return;
49161         void* this_ptr_ptr = untag_ptr(this_ptr);
49162         CHECK_ACCESS(this_ptr_ptr);
49163         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
49164         FREE(untag_ptr(this_ptr));
49165         CustomOnionMessageContents_free(this_ptr_conv);
49166 }
49167
49168 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
49169         LDKBlindedPath this_obj_conv;
49170         this_obj_conv.inner = untag_ptr(this_obj);
49171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49173         BlindedPath_free(this_obj_conv);
49174 }
49175
49176 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
49177         LDKBlindedPath ret_var = BlindedPath_clone(arg);
49178         uint64_t ret_ref = 0;
49179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49181         return ret_ref;
49182 }
49183 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
49184         LDKBlindedPath arg_conv;
49185         arg_conv.inner = untag_ptr(arg);
49186         arg_conv.is_owned = ptr_is_owned(arg);
49187         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49188         arg_conv.is_owned = false;
49189         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
49190         return ret_conv;
49191 }
49192
49193 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
49194         LDKBlindedPath orig_conv;
49195         orig_conv.inner = untag_ptr(orig);
49196         orig_conv.is_owned = ptr_is_owned(orig);
49197         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49198         orig_conv.is_owned = false;
49199         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
49200         uint64_t ret_ref = 0;
49201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49203         return ret_ref;
49204 }
49205
49206 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
49207         LDKBlindedPath o_conv;
49208         o_conv.inner = untag_ptr(o);
49209         o_conv.is_owned = ptr_is_owned(o);
49210         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49211         o_conv.is_owned = false;
49212         int64_t ret_conv = BlindedPath_hash(&o_conv);
49213         return ret_conv;
49214 }
49215
49216 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
49217         LDKBlindedPath a_conv;
49218         a_conv.inner = untag_ptr(a);
49219         a_conv.is_owned = ptr_is_owned(a);
49220         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49221         a_conv.is_owned = false;
49222         LDKBlindedPath b_conv;
49223         b_conv.inner = untag_ptr(b);
49224         b_conv.is_owned = ptr_is_owned(b);
49225         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49226         b_conv.is_owned = false;
49227         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
49228         return ret_conv;
49229 }
49230
49231 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
49232         LDKBlindedHop this_obj_conv;
49233         this_obj_conv.inner = untag_ptr(this_obj);
49234         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49236         BlindedHop_free(this_obj_conv);
49237 }
49238
49239 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
49240         LDKBlindedHop ret_var = BlindedHop_clone(arg);
49241         uint64_t ret_ref = 0;
49242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49244         return ret_ref;
49245 }
49246 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
49247         LDKBlindedHop arg_conv;
49248         arg_conv.inner = untag_ptr(arg);
49249         arg_conv.is_owned = ptr_is_owned(arg);
49250         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49251         arg_conv.is_owned = false;
49252         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
49253         return ret_conv;
49254 }
49255
49256 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
49257         LDKBlindedHop orig_conv;
49258         orig_conv.inner = untag_ptr(orig);
49259         orig_conv.is_owned = ptr_is_owned(orig);
49260         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49261         orig_conv.is_owned = false;
49262         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
49263         uint64_t ret_ref = 0;
49264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49266         return ret_ref;
49267 }
49268
49269 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
49270         LDKBlindedHop o_conv;
49271         o_conv.inner = untag_ptr(o);
49272         o_conv.is_owned = ptr_is_owned(o);
49273         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49274         o_conv.is_owned = false;
49275         int64_t ret_conv = BlindedHop_hash(&o_conv);
49276         return ret_conv;
49277 }
49278
49279 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
49280         LDKBlindedHop a_conv;
49281         a_conv.inner = untag_ptr(a);
49282         a_conv.is_owned = ptr_is_owned(a);
49283         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49284         a_conv.is_owned = false;
49285         LDKBlindedHop b_conv;
49286         b_conv.inner = untag_ptr(b);
49287         b_conv.is_owned = ptr_is_owned(b);
49288         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49289         b_conv.is_owned = false;
49290         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
49291         return ret_conv;
49292 }
49293
49294 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
49295         LDKCVec_PublicKeyZ node_pks_constr;
49296         node_pks_constr.datalen = node_pks->arr_len;
49297         if (node_pks_constr.datalen > 0)
49298                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
49299         else
49300                 node_pks_constr.data = NULL;
49301         int8_tArray* node_pks_vals = (void*) node_pks->elems;
49302         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
49303                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
49304                 LDKPublicKey node_pks_conv_12_ref;
49305                 CHECK(node_pks_conv_12->arr_len == 33);
49306                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
49307                 node_pks_constr.data[m] = node_pks_conv_12_ref;
49308         }
49309         FREE(node_pks);
49310         void* entropy_source_ptr = untag_ptr(entropy_source);
49311         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49312         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49313         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
49314         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
49315         return tag_ptr(ret_conv, true);
49316 }
49317
49318 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
49319         LDKBlindedPath obj_conv;
49320         obj_conv.inner = untag_ptr(obj);
49321         obj_conv.is_owned = ptr_is_owned(obj);
49322         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49323         obj_conv.is_owned = false;
49324         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
49325         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49326         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49327         CVec_u8Z_free(ret_var);
49328         return ret_arr;
49329 }
49330
49331 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
49332         LDKu8slice ser_ref;
49333         ser_ref.datalen = ser->arr_len;
49334         ser_ref.data = ser->elems;
49335         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
49336         *ret_conv = BlindedPath_read(ser_ref);
49337         FREE(ser);
49338         return tag_ptr(ret_conv, true);
49339 }
49340
49341 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
49342         LDKBlindedHop obj_conv;
49343         obj_conv.inner = untag_ptr(obj);
49344         obj_conv.is_owned = ptr_is_owned(obj);
49345         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49346         obj_conv.is_owned = false;
49347         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
49348         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49349         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49350         CVec_u8Z_free(ret_var);
49351         return ret_arr;
49352 }
49353
49354 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
49355         LDKu8slice ser_ref;
49356         ser_ref.datalen = ser->arr_len;
49357         ser_ref.data = ser->elems;
49358         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
49359         *ret_conv = BlindedHop_read(ser_ref);
49360         FREE(ser);
49361         return tag_ptr(ret_conv, true);
49362 }
49363
49364 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
49365         if (!ptr_is_owned(this_ptr)) return;
49366         void* this_ptr_ptr = untag_ptr(this_ptr);
49367         CHECK_ACCESS(this_ptr_ptr);
49368         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
49369         FREE(untag_ptr(this_ptr));
49370         PaymentPurpose_free(this_ptr_conv);
49371 }
49372
49373 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
49374         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49375         *ret_copy = PaymentPurpose_clone(arg);
49376         uint64_t ret_ref = tag_ptr(ret_copy, true);
49377         return ret_ref;
49378 }
49379 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
49380         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
49381         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
49382         return ret_conv;
49383 }
49384
49385 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
49386         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
49387         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49388         *ret_copy = PaymentPurpose_clone(orig_conv);
49389         uint64_t ret_ref = tag_ptr(ret_copy, true);
49390         return ret_ref;
49391 }
49392
49393 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
49394         LDKThirtyTwoBytes payment_preimage_ref;
49395         CHECK(payment_preimage->arr_len == 32);
49396         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
49397         LDKThirtyTwoBytes payment_secret_ref;
49398         CHECK(payment_secret->arr_len == 32);
49399         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
49400         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49401         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
49402         uint64_t ret_ref = tag_ptr(ret_copy, true);
49403         return ret_ref;
49404 }
49405
49406 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
49407         LDKThirtyTwoBytes a_ref;
49408         CHECK(a->arr_len == 32);
49409         memcpy(a_ref.data, a->elems, 32); FREE(a);
49410         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49411         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
49412         uint64_t ret_ref = tag_ptr(ret_copy, true);
49413         return ret_ref;
49414 }
49415
49416 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
49417         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
49418         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
49419         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
49420         return ret_conv;
49421 }
49422
49423 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
49424         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
49425         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
49426         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49427         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49428         CVec_u8Z_free(ret_var);
49429         return ret_arr;
49430 }
49431
49432 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
49433         LDKu8slice ser_ref;
49434         ser_ref.datalen = ser->arr_len;
49435         ser_ref.data = ser->elems;
49436         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
49437         *ret_conv = PaymentPurpose_read(ser_ref);
49438         FREE(ser);
49439         return tag_ptr(ret_conv, true);
49440 }
49441
49442 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
49443         if (!ptr_is_owned(this_ptr)) return;
49444         void* this_ptr_ptr = untag_ptr(this_ptr);
49445         CHECK_ACCESS(this_ptr_ptr);
49446         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
49447         FREE(untag_ptr(this_ptr));
49448         PathFailure_free(this_ptr_conv);
49449 }
49450
49451 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
49452         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49453         *ret_copy = PathFailure_clone(arg);
49454         uint64_t ret_ref = tag_ptr(ret_copy, true);
49455         return ret_ref;
49456 }
49457 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
49458         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
49459         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
49460         return ret_conv;
49461 }
49462
49463 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
49464         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
49465         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49466         *ret_copy = PathFailure_clone(orig_conv);
49467         uint64_t ret_ref = tag_ptr(ret_copy, true);
49468         return ret_ref;
49469 }
49470
49471 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
49472         void* err_ptr = untag_ptr(err);
49473         CHECK_ACCESS(err_ptr);
49474         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
49475         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
49476         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49477         *ret_copy = PathFailure_initial_send(err_conv);
49478         uint64_t ret_ref = tag_ptr(ret_copy, true);
49479         return ret_ref;
49480 }
49481
49482 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
49483         void* network_update_ptr = untag_ptr(network_update);
49484         CHECK_ACCESS(network_update_ptr);
49485         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
49486         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
49487         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49488         *ret_copy = PathFailure_on_path(network_update_conv);
49489         uint64_t ret_ref = tag_ptr(ret_copy, true);
49490         return ret_ref;
49491 }
49492
49493 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
49494         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
49495         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
49496         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
49497         return ret_conv;
49498 }
49499
49500 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
49501         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
49502         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
49503         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49504         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49505         CVec_u8Z_free(ret_var);
49506         return ret_arr;
49507 }
49508
49509 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
49510         LDKu8slice ser_ref;
49511         ser_ref.datalen = ser->arr_len;
49512         ser_ref.data = ser->elems;
49513         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
49514         *ret_conv = PathFailure_read(ser_ref);
49515         FREE(ser);
49516         return tag_ptr(ret_conv, true);
49517 }
49518
49519 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
49520         if (!ptr_is_owned(this_ptr)) return;
49521         void* this_ptr_ptr = untag_ptr(this_ptr);
49522         CHECK_ACCESS(this_ptr_ptr);
49523         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
49524         FREE(untag_ptr(this_ptr));
49525         ClosureReason_free(this_ptr_conv);
49526 }
49527
49528 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
49529         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49530         *ret_copy = ClosureReason_clone(arg);
49531         uint64_t ret_ref = tag_ptr(ret_copy, true);
49532         return ret_ref;
49533 }
49534 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
49535         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
49536         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
49537         return ret_conv;
49538 }
49539
49540 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
49541         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
49542         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49543         *ret_copy = ClosureReason_clone(orig_conv);
49544         uint64_t ret_ref = tag_ptr(ret_copy, true);
49545         return ret_ref;
49546 }
49547
49548 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
49549         LDKUntrustedString peer_msg_conv;
49550         peer_msg_conv.inner = untag_ptr(peer_msg);
49551         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
49552         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
49553         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
49554         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49555         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
49556         uint64_t ret_ref = tag_ptr(ret_copy, true);
49557         return ret_ref;
49558 }
49559
49560 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
49561         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49562         *ret_copy = ClosureReason_holder_force_closed();
49563         uint64_t ret_ref = tag_ptr(ret_copy, true);
49564         return ret_ref;
49565 }
49566
49567 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
49568         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49569         *ret_copy = ClosureReason_cooperative_closure();
49570         uint64_t ret_ref = tag_ptr(ret_copy, true);
49571         return ret_ref;
49572 }
49573
49574 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
49575         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49576         *ret_copy = ClosureReason_commitment_tx_confirmed();
49577         uint64_t ret_ref = tag_ptr(ret_copy, true);
49578         return ret_ref;
49579 }
49580
49581 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
49582         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49583         *ret_copy = ClosureReason_funding_timed_out();
49584         uint64_t ret_ref = tag_ptr(ret_copy, true);
49585         return ret_ref;
49586 }
49587
49588 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
49589         LDKStr err_conv = str_ref_to_owned_c(err);
49590         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49591         *ret_copy = ClosureReason_processing_error(err_conv);
49592         uint64_t ret_ref = tag_ptr(ret_copy, true);
49593         return ret_ref;
49594 }
49595
49596 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
49597         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49598         *ret_copy = ClosureReason_disconnected_peer();
49599         uint64_t ret_ref = tag_ptr(ret_copy, true);
49600         return ret_ref;
49601 }
49602
49603 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
49604         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49605         *ret_copy = ClosureReason_outdated_channel_manager();
49606         uint64_t ret_ref = tag_ptr(ret_copy, true);
49607         return ret_ref;
49608 }
49609
49610 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
49611         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
49612         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
49613         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
49614         return ret_conv;
49615 }
49616
49617 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
49618         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
49619         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
49620         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49621         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49622         CVec_u8Z_free(ret_var);
49623         return ret_arr;
49624 }
49625
49626 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
49627         LDKu8slice ser_ref;
49628         ser_ref.datalen = ser->arr_len;
49629         ser_ref.data = ser->elems;
49630         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
49631         *ret_conv = ClosureReason_read(ser_ref);
49632         FREE(ser);
49633         return tag_ptr(ret_conv, true);
49634 }
49635
49636 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
49637         if (!ptr_is_owned(this_ptr)) return;
49638         void* this_ptr_ptr = untag_ptr(this_ptr);
49639         CHECK_ACCESS(this_ptr_ptr);
49640         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
49641         FREE(untag_ptr(this_ptr));
49642         HTLCDestination_free(this_ptr_conv);
49643 }
49644
49645 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
49646         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49647         *ret_copy = HTLCDestination_clone(arg);
49648         uint64_t ret_ref = tag_ptr(ret_copy, true);
49649         return ret_ref;
49650 }
49651 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
49652         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
49653         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
49654         return ret_conv;
49655 }
49656
49657 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
49658         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
49659         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49660         *ret_copy = HTLCDestination_clone(orig_conv);
49661         uint64_t ret_ref = tag_ptr(ret_copy, true);
49662         return ret_ref;
49663 }
49664
49665 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
49666         LDKPublicKey node_id_ref;
49667         CHECK(node_id->arr_len == 33);
49668         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
49669         LDKThirtyTwoBytes channel_id_ref;
49670         CHECK(channel_id->arr_len == 32);
49671         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
49672         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49673         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
49674         uint64_t ret_ref = tag_ptr(ret_copy, true);
49675         return ret_ref;
49676 }
49677
49678 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
49679         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49680         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
49681         uint64_t ret_ref = tag_ptr(ret_copy, true);
49682         return ret_ref;
49683 }
49684
49685 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
49686         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49687         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
49688         uint64_t ret_ref = tag_ptr(ret_copy, true);
49689         return ret_ref;
49690 }
49691
49692 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
49693         LDKThirtyTwoBytes payment_hash_ref;
49694         CHECK(payment_hash->arr_len == 32);
49695         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49696         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49697         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
49698         uint64_t ret_ref = tag_ptr(ret_copy, true);
49699         return ret_ref;
49700 }
49701
49702 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
49703         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
49704         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
49705         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
49706         return ret_conv;
49707 }
49708
49709 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
49710         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
49711         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
49712         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49713         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49714         CVec_u8Z_free(ret_var);
49715         return ret_arr;
49716 }
49717
49718 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
49719         LDKu8slice ser_ref;
49720         ser_ref.datalen = ser->arr_len;
49721         ser_ref.data = ser->elems;
49722         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
49723         *ret_conv = HTLCDestination_read(ser_ref);
49724         FREE(ser);
49725         return tag_ptr(ret_conv, true);
49726 }
49727
49728 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
49729         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
49730         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
49731         return ret_conv;
49732 }
49733
49734 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
49735         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
49736         return ret_conv;
49737 }
49738
49739 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
49740         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
49741         return ret_conv;
49742 }
49743
49744 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
49745         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
49746         return ret_conv;
49747 }
49748
49749 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
49750         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
49751         return ret_conv;
49752 }
49753
49754 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
49755         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
49756         return ret_conv;
49757 }
49758
49759 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
49760         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
49761         return ret_conv;
49762 }
49763
49764 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
49765         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
49766         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
49767         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
49768         return ret_conv;
49769 }
49770
49771 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
49772         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
49773         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
49774         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49775         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49776         CVec_u8Z_free(ret_var);
49777         return ret_arr;
49778 }
49779
49780 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
49781         LDKu8slice ser_ref;
49782         ser_ref.datalen = ser->arr_len;
49783         ser_ref.data = ser->elems;
49784         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
49785         *ret_conv = PaymentFailureReason_read(ser_ref);
49786         FREE(ser);
49787         return tag_ptr(ret_conv, true);
49788 }
49789
49790 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
49791         if (!ptr_is_owned(this_ptr)) return;
49792         void* this_ptr_ptr = untag_ptr(this_ptr);
49793         CHECK_ACCESS(this_ptr_ptr);
49794         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
49795         FREE(untag_ptr(this_ptr));
49796         Event_free(this_ptr_conv);
49797 }
49798
49799 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
49800         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49801         *ret_copy = Event_clone(arg);
49802         uint64_t ret_ref = tag_ptr(ret_copy, true);
49803         return ret_ref;
49804 }
49805 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
49806         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
49807         int64_t ret_conv = Event_clone_ptr(arg_conv);
49808         return ret_conv;
49809 }
49810
49811 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
49812         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
49813         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49814         *ret_copy = Event_clone(orig_conv);
49815         uint64_t ret_ref = tag_ptr(ret_copy, true);
49816         return ret_ref;
49817 }
49818
49819 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) {
49820         LDKThirtyTwoBytes temporary_channel_id_ref;
49821         CHECK(temporary_channel_id->arr_len == 32);
49822         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
49823         LDKPublicKey counterparty_node_id_ref;
49824         CHECK(counterparty_node_id->arr_len == 33);
49825         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
49826         LDKCVec_u8Z output_script_ref;
49827         output_script_ref.datalen = output_script->arr_len;
49828         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
49829         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
49830         LDKU128 user_channel_id_ref;
49831         CHECK(user_channel_id->arr_len == 16);
49832         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
49833         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49834         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
49835         uint64_t ret_ref = tag_ptr(ret_copy, true);
49836         return ret_ref;
49837 }
49838
49839 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) {
49840         LDKPublicKey receiver_node_id_ref;
49841         CHECK(receiver_node_id->arr_len == 33);
49842         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
49843         LDKThirtyTwoBytes payment_hash_ref;
49844         CHECK(payment_hash->arr_len == 32);
49845         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49846         LDKRecipientOnionFields onion_fields_conv;
49847         onion_fields_conv.inner = untag_ptr(onion_fields);
49848         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
49849         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
49850         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
49851         void* purpose_ptr = untag_ptr(purpose);
49852         CHECK_ACCESS(purpose_ptr);
49853         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
49854         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
49855         LDKThirtyTwoBytes via_channel_id_ref;
49856         CHECK(via_channel_id->arr_len == 32);
49857         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
49858         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
49859         CHECK_ACCESS(via_user_channel_id_ptr);
49860         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
49861         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
49862         void* claim_deadline_ptr = untag_ptr(claim_deadline);
49863         CHECK_ACCESS(claim_deadline_ptr);
49864         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
49865         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
49866         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49867         *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);
49868         uint64_t ret_ref = tag_ptr(ret_copy, true);
49869         return ret_ref;
49870 }
49871
49872 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) {
49873         LDKPublicKey receiver_node_id_ref;
49874         CHECK(receiver_node_id->arr_len == 33);
49875         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
49876         LDKThirtyTwoBytes payment_hash_ref;
49877         CHECK(payment_hash->arr_len == 32);
49878         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49879         void* purpose_ptr = untag_ptr(purpose);
49880         CHECK_ACCESS(purpose_ptr);
49881         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
49882         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
49883         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49884         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
49885         uint64_t ret_ref = tag_ptr(ret_copy, true);
49886         return ret_ref;
49887 }
49888
49889 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) {
49890         LDKThirtyTwoBytes payment_id_ref;
49891         CHECK(payment_id->arr_len == 32);
49892         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49893         LDKThirtyTwoBytes payment_preimage_ref;
49894         CHECK(payment_preimage->arr_len == 32);
49895         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
49896         LDKThirtyTwoBytes payment_hash_ref;
49897         CHECK(payment_hash->arr_len == 32);
49898         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49899         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
49900         CHECK_ACCESS(fee_paid_msat_ptr);
49901         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
49902         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
49903         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49904         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
49905         uint64_t ret_ref = tag_ptr(ret_copy, true);
49906         return ret_ref;
49907 }
49908
49909 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
49910         LDKThirtyTwoBytes payment_id_ref;
49911         CHECK(payment_id->arr_len == 32);
49912         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49913         LDKThirtyTwoBytes payment_hash_ref;
49914         CHECK(payment_hash->arr_len == 32);
49915         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49916         void* reason_ptr = untag_ptr(reason);
49917         CHECK_ACCESS(reason_ptr);
49918         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
49919         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
49920         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49921         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
49922         uint64_t ret_ref = tag_ptr(ret_copy, true);
49923         return ret_ref;
49924 }
49925
49926 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) {
49927         LDKThirtyTwoBytes payment_id_ref;
49928         CHECK(payment_id->arr_len == 32);
49929         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49930         LDKThirtyTwoBytes payment_hash_ref;
49931         CHECK(payment_hash->arr_len == 32);
49932         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49933         LDKPath path_conv;
49934         path_conv.inner = untag_ptr(path);
49935         path_conv.is_owned = ptr_is_owned(path);
49936         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49937         path_conv = Path_clone(&path_conv);
49938         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49939         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_conv);
49940         uint64_t ret_ref = tag_ptr(ret_copy, true);
49941         return ret_ref;
49942 }
49943
49944 uint64_t  __attribute__((export_name("TS_Event_payment_path_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) {
49945         LDKThirtyTwoBytes payment_id_ref;
49946         CHECK(payment_id->arr_len == 32);
49947         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49948         LDKThirtyTwoBytes payment_hash_ref;
49949         CHECK(payment_hash->arr_len == 32);
49950         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49951         void* failure_ptr = untag_ptr(failure);
49952         CHECK_ACCESS(failure_ptr);
49953         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
49954         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
49955         LDKPath path_conv;
49956         path_conv.inner = untag_ptr(path);
49957         path_conv.is_owned = ptr_is_owned(path);
49958         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49959         path_conv = Path_clone(&path_conv);
49960         void* short_channel_id_ptr = untag_ptr(short_channel_id);
49961         CHECK_ACCESS(short_channel_id_ptr);
49962         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
49963         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
49964         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49965         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
49966         uint64_t ret_ref = tag_ptr(ret_copy, true);
49967         return ret_ref;
49968 }
49969
49970 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
49971         LDKThirtyTwoBytes payment_id_ref;
49972         CHECK(payment_id->arr_len == 32);
49973         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49974         LDKThirtyTwoBytes payment_hash_ref;
49975         CHECK(payment_hash->arr_len == 32);
49976         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49977         LDKPath path_conv;
49978         path_conv.inner = untag_ptr(path);
49979         path_conv.is_owned = ptr_is_owned(path);
49980         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49981         path_conv = Path_clone(&path_conv);
49982         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49983         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
49984         uint64_t ret_ref = tag_ptr(ret_copy, true);
49985         return ret_ref;
49986 }
49987
49988 uint64_t  __attribute__((export_name("TS_Event_probe_failed"))) TS_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path, uint64_t short_channel_id) {
49989         LDKThirtyTwoBytes payment_id_ref;
49990         CHECK(payment_id->arr_len == 32);
49991         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49992         LDKThirtyTwoBytes payment_hash_ref;
49993         CHECK(payment_hash->arr_len == 32);
49994         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49995         LDKPath path_conv;
49996         path_conv.inner = untag_ptr(path);
49997         path_conv.is_owned = ptr_is_owned(path);
49998         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49999         path_conv = Path_clone(&path_conv);
50000         void* short_channel_id_ptr = untag_ptr(short_channel_id);
50001         CHECK_ACCESS(short_channel_id_ptr);
50002         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
50003         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
50004         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50005         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
50006         uint64_t ret_ref = tag_ptr(ret_copy, true);
50007         return ret_ref;
50008 }
50009
50010 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
50011         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50012         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
50013         uint64_t ret_ref = tag_ptr(ret_copy, true);
50014         return ret_ref;
50015 }
50016
50017 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) {
50018         LDKThirtyTwoBytes intercept_id_ref;
50019         CHECK(intercept_id->arr_len == 32);
50020         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
50021         LDKThirtyTwoBytes payment_hash_ref;
50022         CHECK(payment_hash->arr_len == 32);
50023         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50024         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50025         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
50026         uint64_t ret_ref = tag_ptr(ret_copy, true);
50027         return ret_ref;
50028 }
50029
50030 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
50031         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
50032         outputs_constr.datalen = outputs->arr_len;
50033         if (outputs_constr.datalen > 0)
50034                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
50035         else
50036                 outputs_constr.data = NULL;
50037         uint64_t* outputs_vals = outputs->elems;
50038         for (size_t b = 0; b < outputs_constr.datalen; b++) {
50039                 uint64_t outputs_conv_27 = outputs_vals[b];
50040                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
50041                 CHECK_ACCESS(outputs_conv_27_ptr);
50042                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
50043                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
50044                 outputs_constr.data[b] = outputs_conv_27_conv;
50045         }
50046         FREE(outputs);
50047         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50048         *ret_copy = Event_spendable_outputs(outputs_constr);
50049         uint64_t ret_ref = tag_ptr(ret_copy, true);
50050         return ret_ref;
50051 }
50052
50053 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) {
50054         LDKThirtyTwoBytes prev_channel_id_ref;
50055         CHECK(prev_channel_id->arr_len == 32);
50056         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
50057         LDKThirtyTwoBytes next_channel_id_ref;
50058         CHECK(next_channel_id->arr_len == 32);
50059         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
50060         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
50061         CHECK_ACCESS(fee_earned_msat_ptr);
50062         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
50063         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
50064         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
50065         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
50066         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
50067         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
50068         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50069         *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);
50070         uint64_t ret_ref = tag_ptr(ret_copy, true);
50071         return ret_ref;
50072 }
50073
50074 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) {
50075         LDKThirtyTwoBytes channel_id_ref;
50076         CHECK(channel_id->arr_len == 32);
50077         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50078         LDKU128 user_channel_id_ref;
50079         CHECK(user_channel_id->arr_len == 16);
50080         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50081         LDKThirtyTwoBytes former_temporary_channel_id_ref;
50082         CHECK(former_temporary_channel_id->arr_len == 32);
50083         memcpy(former_temporary_channel_id_ref.data, former_temporary_channel_id->elems, 32); FREE(former_temporary_channel_id);
50084         LDKPublicKey counterparty_node_id_ref;
50085         CHECK(counterparty_node_id->arr_len == 33);
50086         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50087         LDKOutPoint funding_txo_conv;
50088         funding_txo_conv.inner = untag_ptr(funding_txo);
50089         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
50090         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
50091         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
50092         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50093         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_ref, counterparty_node_id_ref, funding_txo_conv);
50094         uint64_t ret_ref = tag_ptr(ret_copy, true);
50095         return ret_ref;
50096 }
50097
50098 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) {
50099         LDKThirtyTwoBytes channel_id_ref;
50100         CHECK(channel_id->arr_len == 32);
50101         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50102         LDKU128 user_channel_id_ref;
50103         CHECK(user_channel_id->arr_len == 16);
50104         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50105         LDKPublicKey counterparty_node_id_ref;
50106         CHECK(counterparty_node_id->arr_len == 33);
50107         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50108         LDKChannelTypeFeatures channel_type_conv;
50109         channel_type_conv.inner = untag_ptr(channel_type);
50110         channel_type_conv.is_owned = ptr_is_owned(channel_type);
50111         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
50112         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
50113         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50114         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
50115         uint64_t ret_ref = tag_ptr(ret_copy, true);
50116         return ret_ref;
50117 }
50118
50119 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) {
50120         LDKThirtyTwoBytes channel_id_ref;
50121         CHECK(channel_id->arr_len == 32);
50122         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50123         LDKU128 user_channel_id_ref;
50124         CHECK(user_channel_id->arr_len == 16);
50125         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50126         void* reason_ptr = untag_ptr(reason);
50127         CHECK_ACCESS(reason_ptr);
50128         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
50129         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
50130         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50131         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
50132         uint64_t ret_ref = tag_ptr(ret_copy, true);
50133         return ret_ref;
50134 }
50135
50136 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
50137         LDKThirtyTwoBytes channel_id_ref;
50138         CHECK(channel_id->arr_len == 32);
50139         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50140         LDKTransaction transaction_ref;
50141         transaction_ref.datalen = transaction->arr_len;
50142         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
50143         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
50144         transaction_ref.data_is_owned = true;
50145         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50146         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
50147         uint64_t ret_ref = tag_ptr(ret_copy, true);
50148         return ret_ref;
50149 }
50150
50151 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) {
50152         LDKThirtyTwoBytes temporary_channel_id_ref;
50153         CHECK(temporary_channel_id->arr_len == 32);
50154         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
50155         LDKPublicKey counterparty_node_id_ref;
50156         CHECK(counterparty_node_id->arr_len == 33);
50157         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50158         LDKChannelTypeFeatures channel_type_conv;
50159         channel_type_conv.inner = untag_ptr(channel_type);
50160         channel_type_conv.is_owned = ptr_is_owned(channel_type);
50161         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
50162         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
50163         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50164         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
50165         uint64_t ret_ref = tag_ptr(ret_copy, true);
50166         return ret_ref;
50167 }
50168
50169 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
50170         LDKThirtyTwoBytes prev_channel_id_ref;
50171         CHECK(prev_channel_id->arr_len == 32);
50172         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
50173         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
50174         CHECK_ACCESS(failed_next_destination_ptr);
50175         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
50176         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
50177         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50178         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
50179         uint64_t ret_ref = tag_ptr(ret_copy, true);
50180         return ret_ref;
50181 }
50182
50183 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
50184         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
50185         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
50186         jboolean ret_conv = Event_eq(a_conv, b_conv);
50187         return ret_conv;
50188 }
50189
50190 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
50191         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
50192         LDKCVec_u8Z ret_var = Event_write(obj_conv);
50193         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50194         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50195         CVec_u8Z_free(ret_var);
50196         return ret_arr;
50197 }
50198
50199 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
50200         LDKu8slice ser_ref;
50201         ser_ref.datalen = ser->arr_len;
50202         ser_ref.data = ser->elems;
50203         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
50204         *ret_conv = Event_read(ser_ref);
50205         FREE(ser);
50206         return tag_ptr(ret_conv, true);
50207 }
50208
50209 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
50210         if (!ptr_is_owned(this_ptr)) return;
50211         void* this_ptr_ptr = untag_ptr(this_ptr);
50212         CHECK_ACCESS(this_ptr_ptr);
50213         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
50214         FREE(untag_ptr(this_ptr));
50215         MessageSendEvent_free(this_ptr_conv);
50216 }
50217
50218 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
50219         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50220         *ret_copy = MessageSendEvent_clone(arg);
50221         uint64_t ret_ref = tag_ptr(ret_copy, true);
50222         return ret_ref;
50223 }
50224 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
50225         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
50226         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
50227         return ret_conv;
50228 }
50229
50230 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
50231         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
50232         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50233         *ret_copy = MessageSendEvent_clone(orig_conv);
50234         uint64_t ret_ref = tag_ptr(ret_copy, true);
50235         return ret_ref;
50236 }
50237
50238 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
50239         LDKPublicKey node_id_ref;
50240         CHECK(node_id->arr_len == 33);
50241         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50242         LDKAcceptChannel msg_conv;
50243         msg_conv.inner = untag_ptr(msg);
50244         msg_conv.is_owned = ptr_is_owned(msg);
50245         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50246         msg_conv = AcceptChannel_clone(&msg_conv);
50247         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50248         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
50249         uint64_t ret_ref = tag_ptr(ret_copy, true);
50250         return ret_ref;
50251 }
50252
50253 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
50254         LDKPublicKey node_id_ref;
50255         CHECK(node_id->arr_len == 33);
50256         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50257         LDKOpenChannel msg_conv;
50258         msg_conv.inner = untag_ptr(msg);
50259         msg_conv.is_owned = ptr_is_owned(msg);
50260         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50261         msg_conv = OpenChannel_clone(&msg_conv);
50262         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50263         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
50264         uint64_t ret_ref = tag_ptr(ret_copy, true);
50265         return ret_ref;
50266 }
50267
50268 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
50269         LDKPublicKey node_id_ref;
50270         CHECK(node_id->arr_len == 33);
50271         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50272         LDKFundingCreated msg_conv;
50273         msg_conv.inner = untag_ptr(msg);
50274         msg_conv.is_owned = ptr_is_owned(msg);
50275         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50276         msg_conv = FundingCreated_clone(&msg_conv);
50277         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50278         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
50279         uint64_t ret_ref = tag_ptr(ret_copy, true);
50280         return ret_ref;
50281 }
50282
50283 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
50284         LDKPublicKey node_id_ref;
50285         CHECK(node_id->arr_len == 33);
50286         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50287         LDKFundingSigned msg_conv;
50288         msg_conv.inner = untag_ptr(msg);
50289         msg_conv.is_owned = ptr_is_owned(msg);
50290         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50291         msg_conv = FundingSigned_clone(&msg_conv);
50292         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50293         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
50294         uint64_t ret_ref = tag_ptr(ret_copy, true);
50295         return ret_ref;
50296 }
50297
50298 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
50299         LDKPublicKey node_id_ref;
50300         CHECK(node_id->arr_len == 33);
50301         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50302         LDKChannelReady msg_conv;
50303         msg_conv.inner = untag_ptr(msg);
50304         msg_conv.is_owned = ptr_is_owned(msg);
50305         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50306         msg_conv = ChannelReady_clone(&msg_conv);
50307         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50308         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
50309         uint64_t ret_ref = tag_ptr(ret_copy, true);
50310         return ret_ref;
50311 }
50312
50313 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
50314         LDKPublicKey node_id_ref;
50315         CHECK(node_id->arr_len == 33);
50316         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50317         LDKAnnouncementSignatures msg_conv;
50318         msg_conv.inner = untag_ptr(msg);
50319         msg_conv.is_owned = ptr_is_owned(msg);
50320         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50321         msg_conv = AnnouncementSignatures_clone(&msg_conv);
50322         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50323         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
50324         uint64_t ret_ref = tag_ptr(ret_copy, true);
50325         return ret_ref;
50326 }
50327
50328 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
50329         LDKPublicKey node_id_ref;
50330         CHECK(node_id->arr_len == 33);
50331         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50332         LDKCommitmentUpdate updates_conv;
50333         updates_conv.inner = untag_ptr(updates);
50334         updates_conv.is_owned = ptr_is_owned(updates);
50335         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
50336         updates_conv = CommitmentUpdate_clone(&updates_conv);
50337         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50338         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
50339         uint64_t ret_ref = tag_ptr(ret_copy, true);
50340         return ret_ref;
50341 }
50342
50343 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
50344         LDKPublicKey node_id_ref;
50345         CHECK(node_id->arr_len == 33);
50346         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50347         LDKRevokeAndACK msg_conv;
50348         msg_conv.inner = untag_ptr(msg);
50349         msg_conv.is_owned = ptr_is_owned(msg);
50350         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50351         msg_conv = RevokeAndACK_clone(&msg_conv);
50352         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50353         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
50354         uint64_t ret_ref = tag_ptr(ret_copy, true);
50355         return ret_ref;
50356 }
50357
50358 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
50359         LDKPublicKey node_id_ref;
50360         CHECK(node_id->arr_len == 33);
50361         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50362         LDKClosingSigned msg_conv;
50363         msg_conv.inner = untag_ptr(msg);
50364         msg_conv.is_owned = ptr_is_owned(msg);
50365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50366         msg_conv = ClosingSigned_clone(&msg_conv);
50367         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50368         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
50369         uint64_t ret_ref = tag_ptr(ret_copy, true);
50370         return ret_ref;
50371 }
50372
50373 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
50374         LDKPublicKey node_id_ref;
50375         CHECK(node_id->arr_len == 33);
50376         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50377         LDKShutdown msg_conv;
50378         msg_conv.inner = untag_ptr(msg);
50379         msg_conv.is_owned = ptr_is_owned(msg);
50380         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50381         msg_conv = Shutdown_clone(&msg_conv);
50382         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50383         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
50384         uint64_t ret_ref = tag_ptr(ret_copy, true);
50385         return ret_ref;
50386 }
50387
50388 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
50389         LDKPublicKey node_id_ref;
50390         CHECK(node_id->arr_len == 33);
50391         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50392         LDKChannelReestablish msg_conv;
50393         msg_conv.inner = untag_ptr(msg);
50394         msg_conv.is_owned = ptr_is_owned(msg);
50395         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50396         msg_conv = ChannelReestablish_clone(&msg_conv);
50397         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50398         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
50399         uint64_t ret_ref = tag_ptr(ret_copy, true);
50400         return ret_ref;
50401 }
50402
50403 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) {
50404         LDKPublicKey node_id_ref;
50405         CHECK(node_id->arr_len == 33);
50406         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50407         LDKChannelAnnouncement msg_conv;
50408         msg_conv.inner = untag_ptr(msg);
50409         msg_conv.is_owned = ptr_is_owned(msg);
50410         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50411         msg_conv = ChannelAnnouncement_clone(&msg_conv);
50412         LDKChannelUpdate update_msg_conv;
50413         update_msg_conv.inner = untag_ptr(update_msg);
50414         update_msg_conv.is_owned = ptr_is_owned(update_msg);
50415         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
50416         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
50417         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50418         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
50419         uint64_t ret_ref = tag_ptr(ret_copy, true);
50420         return ret_ref;
50421 }
50422
50423 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
50424         LDKChannelAnnouncement msg_conv;
50425         msg_conv.inner = untag_ptr(msg);
50426         msg_conv.is_owned = ptr_is_owned(msg);
50427         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50428         msg_conv = ChannelAnnouncement_clone(&msg_conv);
50429         LDKChannelUpdate update_msg_conv;
50430         update_msg_conv.inner = untag_ptr(update_msg);
50431         update_msg_conv.is_owned = ptr_is_owned(update_msg);
50432         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
50433         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
50434         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50435         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
50436         uint64_t ret_ref = tag_ptr(ret_copy, true);
50437         return ret_ref;
50438 }
50439
50440 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
50441         LDKChannelUpdate msg_conv;
50442         msg_conv.inner = untag_ptr(msg);
50443         msg_conv.is_owned = ptr_is_owned(msg);
50444         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50445         msg_conv = ChannelUpdate_clone(&msg_conv);
50446         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50447         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
50448         uint64_t ret_ref = tag_ptr(ret_copy, true);
50449         return ret_ref;
50450 }
50451
50452 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
50453         LDKNodeAnnouncement msg_conv;
50454         msg_conv.inner = untag_ptr(msg);
50455         msg_conv.is_owned = ptr_is_owned(msg);
50456         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50457         msg_conv = NodeAnnouncement_clone(&msg_conv);
50458         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50459         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
50460         uint64_t ret_ref = tag_ptr(ret_copy, true);
50461         return ret_ref;
50462 }
50463
50464 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
50465         LDKPublicKey node_id_ref;
50466         CHECK(node_id->arr_len == 33);
50467         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50468         LDKChannelUpdate msg_conv;
50469         msg_conv.inner = untag_ptr(msg);
50470         msg_conv.is_owned = ptr_is_owned(msg);
50471         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50472         msg_conv = ChannelUpdate_clone(&msg_conv);
50473         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50474         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
50475         uint64_t ret_ref = tag_ptr(ret_copy, true);
50476         return ret_ref;
50477 }
50478
50479 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
50480         LDKPublicKey node_id_ref;
50481         CHECK(node_id->arr_len == 33);
50482         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50483         void* action_ptr = untag_ptr(action);
50484         CHECK_ACCESS(action_ptr);
50485         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
50486         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
50487         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50488         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
50489         uint64_t ret_ref = tag_ptr(ret_copy, true);
50490         return ret_ref;
50491 }
50492
50493 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
50494         LDKPublicKey node_id_ref;
50495         CHECK(node_id->arr_len == 33);
50496         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50497         LDKQueryChannelRange msg_conv;
50498         msg_conv.inner = untag_ptr(msg);
50499         msg_conv.is_owned = ptr_is_owned(msg);
50500         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50501         msg_conv = QueryChannelRange_clone(&msg_conv);
50502         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50503         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
50504         uint64_t ret_ref = tag_ptr(ret_copy, true);
50505         return ret_ref;
50506 }
50507
50508 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
50509         LDKPublicKey node_id_ref;
50510         CHECK(node_id->arr_len == 33);
50511         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50512         LDKQueryShortChannelIds msg_conv;
50513         msg_conv.inner = untag_ptr(msg);
50514         msg_conv.is_owned = ptr_is_owned(msg);
50515         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50516         msg_conv = QueryShortChannelIds_clone(&msg_conv);
50517         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50518         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
50519         uint64_t ret_ref = tag_ptr(ret_copy, true);
50520         return ret_ref;
50521 }
50522
50523 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
50524         LDKPublicKey node_id_ref;
50525         CHECK(node_id->arr_len == 33);
50526         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50527         LDKReplyChannelRange msg_conv;
50528         msg_conv.inner = untag_ptr(msg);
50529         msg_conv.is_owned = ptr_is_owned(msg);
50530         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50531         msg_conv = ReplyChannelRange_clone(&msg_conv);
50532         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50533         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
50534         uint64_t ret_ref = tag_ptr(ret_copy, true);
50535         return ret_ref;
50536 }
50537
50538 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
50539         LDKPublicKey node_id_ref;
50540         CHECK(node_id->arr_len == 33);
50541         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50542         LDKGossipTimestampFilter msg_conv;
50543         msg_conv.inner = untag_ptr(msg);
50544         msg_conv.is_owned = ptr_is_owned(msg);
50545         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50546         msg_conv = GossipTimestampFilter_clone(&msg_conv);
50547         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50548         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
50549         uint64_t ret_ref = tag_ptr(ret_copy, true);
50550         return ret_ref;
50551 }
50552
50553 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
50554         if (!ptr_is_owned(this_ptr)) return;
50555         void* this_ptr_ptr = untag_ptr(this_ptr);
50556         CHECK_ACCESS(this_ptr_ptr);
50557         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
50558         FREE(untag_ptr(this_ptr));
50559         MessageSendEventsProvider_free(this_ptr_conv);
50560 }
50561
50562 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
50563         if (!ptr_is_owned(this_ptr)) return;
50564         void* this_ptr_ptr = untag_ptr(this_ptr);
50565         CHECK_ACCESS(this_ptr_ptr);
50566         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
50567         FREE(untag_ptr(this_ptr));
50568         OnionMessageProvider_free(this_ptr_conv);
50569 }
50570
50571 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
50572         if (!ptr_is_owned(this_ptr)) return;
50573         void* this_ptr_ptr = untag_ptr(this_ptr);
50574         CHECK_ACCESS(this_ptr_ptr);
50575         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
50576         FREE(untag_ptr(this_ptr));
50577         EventsProvider_free(this_ptr_conv);
50578 }
50579
50580 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
50581         if (!ptr_is_owned(this_ptr)) return;
50582         void* this_ptr_ptr = untag_ptr(this_ptr);
50583         CHECK_ACCESS(this_ptr_ptr);
50584         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
50585         FREE(untag_ptr(this_ptr));
50586         EventHandler_free(this_ptr_conv);
50587 }
50588
50589 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
50590         if (!ptr_is_owned(this_ptr)) return;
50591         void* this_ptr_ptr = untag_ptr(this_ptr);
50592         CHECK_ACCESS(this_ptr_ptr);
50593         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
50594         FREE(untag_ptr(this_ptr));
50595         GossipSync_free(this_ptr_conv);
50596 }
50597
50598 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
50599         LDKP2PGossipSync a_conv;
50600         a_conv.inner = untag_ptr(a);
50601         a_conv.is_owned = ptr_is_owned(a);
50602         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50603         a_conv.is_owned = false;
50604         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50605         *ret_copy = GossipSync_p2_p(&a_conv);
50606         uint64_t ret_ref = tag_ptr(ret_copy, true);
50607         return ret_ref;
50608 }
50609
50610 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
50611         LDKRapidGossipSync a_conv;
50612         a_conv.inner = untag_ptr(a);
50613         a_conv.is_owned = ptr_is_owned(a);
50614         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50615         a_conv.is_owned = false;
50616         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50617         *ret_copy = GossipSync_rapid(&a_conv);
50618         uint64_t ret_ref = tag_ptr(ret_copy, true);
50619         return ret_ref;
50620 }
50621
50622 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
50623         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50624         *ret_copy = GossipSync_none();
50625         uint64_t ret_ref = tag_ptr(ret_copy, true);
50626         return ret_ref;
50627 }
50628
50629 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
50630         LDKRapidGossipSync this_obj_conv;
50631         this_obj_conv.inner = untag_ptr(this_obj);
50632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50634         RapidGossipSync_free(this_obj_conv);
50635 }
50636
50637 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
50638         LDKNetworkGraph network_graph_conv;
50639         network_graph_conv.inner = untag_ptr(network_graph);
50640         network_graph_conv.is_owned = ptr_is_owned(network_graph);
50641         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
50642         network_graph_conv.is_owned = false;
50643         void* logger_ptr = untag_ptr(logger);
50644         CHECK_ACCESS(logger_ptr);
50645         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50646         if (logger_conv.free == LDKLogger_JCalls_free) {
50647                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50648                 LDKLogger_JCalls_cloned(&logger_conv);
50649         }
50650         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
50651         uint64_t ret_ref = 0;
50652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50654         return ret_ref;
50655 }
50656
50657 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) {
50658         LDKRapidGossipSync this_arg_conv;
50659         this_arg_conv.inner = untag_ptr(this_arg);
50660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50662         this_arg_conv.is_owned = false;
50663         LDKu8slice update_data_ref;
50664         update_data_ref.datalen = update_data->arr_len;
50665         update_data_ref.data = update_data->elems;
50666         void* current_time_unix_ptr = untag_ptr(current_time_unix);
50667         CHECK_ACCESS(current_time_unix_ptr);
50668         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
50669         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
50670         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
50671         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
50672         FREE(update_data);
50673         return tag_ptr(ret_conv, true);
50674 }
50675
50676 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
50677         LDKRapidGossipSync this_arg_conv;
50678         this_arg_conv.inner = untag_ptr(this_arg);
50679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50681         this_arg_conv.is_owned = false;
50682         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
50683         return ret_conv;
50684 }
50685
50686 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
50687         if (!ptr_is_owned(this_ptr)) return;
50688         void* this_ptr_ptr = untag_ptr(this_ptr);
50689         CHECK_ACCESS(this_ptr_ptr);
50690         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
50691         FREE(untag_ptr(this_ptr));
50692         GraphSyncError_free(this_ptr_conv);
50693 }
50694
50695 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
50696         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50697         *ret_copy = GraphSyncError_clone(arg);
50698         uint64_t ret_ref = tag_ptr(ret_copy, true);
50699         return ret_ref;
50700 }
50701 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
50702         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
50703         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
50704         return ret_conv;
50705 }
50706
50707 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
50708         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
50709         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50710         *ret_copy = GraphSyncError_clone(orig_conv);
50711         uint64_t ret_ref = tag_ptr(ret_copy, true);
50712         return ret_ref;
50713 }
50714
50715 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
50716         void* a_ptr = untag_ptr(a);
50717         CHECK_ACCESS(a_ptr);
50718         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
50719         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
50720         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50721         *ret_copy = GraphSyncError_decode_error(a_conv);
50722         uint64_t ret_ref = tag_ptr(ret_copy, true);
50723         return ret_ref;
50724 }
50725
50726 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
50727         LDKLightningError a_conv;
50728         a_conv.inner = untag_ptr(a);
50729         a_conv.is_owned = ptr_is_owned(a);
50730         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50731         a_conv = LightningError_clone(&a_conv);
50732         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50733         *ret_copy = GraphSyncError_lightning_error(a_conv);
50734         uint64_t ret_ref = tag_ptr(ret_copy, true);
50735         return ret_ref;
50736 }
50737
50738 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
50739         if (!ptr_is_owned(this_ptr)) return;
50740         void* this_ptr_ptr = untag_ptr(this_ptr);
50741         CHECK_ACCESS(this_ptr_ptr);
50742         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
50743         FREE(untag_ptr(this_ptr));
50744         ParseError_free(this_ptr_conv);
50745 }
50746
50747 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
50748         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50749         *ret_copy = ParseError_clone(arg);
50750         uint64_t ret_ref = tag_ptr(ret_copy, true);
50751         return ret_ref;
50752 }
50753 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
50754         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
50755         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
50756         return ret_conv;
50757 }
50758
50759 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
50760         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
50761         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50762         *ret_copy = ParseError_clone(orig_conv);
50763         uint64_t ret_ref = tag_ptr(ret_copy, true);
50764         return ret_ref;
50765 }
50766
50767 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
50768         void* a_ptr = untag_ptr(a);
50769         CHECK_ACCESS(a_ptr);
50770         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
50771         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
50772         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50773         *ret_copy = ParseError_bech32_error(a_conv);
50774         uint64_t ret_ref = tag_ptr(ret_copy, true);
50775         return ret_ref;
50776 }
50777
50778 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
50779         
50780         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50781         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
50782         uint64_t ret_ref = tag_ptr(ret_copy, true);
50783         return ret_ref;
50784 }
50785
50786 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
50787         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
50788         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50789         *ret_copy = ParseError_malformed_signature(a_conv);
50790         uint64_t ret_ref = tag_ptr(ret_copy, true);
50791         return ret_ref;
50792 }
50793
50794 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
50795         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50796         *ret_copy = ParseError_bad_prefix();
50797         uint64_t ret_ref = tag_ptr(ret_copy, true);
50798         return ret_ref;
50799 }
50800
50801 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
50802         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50803         *ret_copy = ParseError_unknown_currency();
50804         uint64_t ret_ref = tag_ptr(ret_copy, true);
50805         return ret_ref;
50806 }
50807
50808 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
50809         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50810         *ret_copy = ParseError_unknown_si_prefix();
50811         uint64_t ret_ref = tag_ptr(ret_copy, true);
50812         return ret_ref;
50813 }
50814
50815 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
50816         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50817         *ret_copy = ParseError_malformed_hrp();
50818         uint64_t ret_ref = tag_ptr(ret_copy, true);
50819         return ret_ref;
50820 }
50821
50822 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
50823         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50824         *ret_copy = ParseError_too_short_data_part();
50825         uint64_t ret_ref = tag_ptr(ret_copy, true);
50826         return ret_ref;
50827 }
50828
50829 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
50830         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50831         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
50832         uint64_t ret_ref = tag_ptr(ret_copy, true);
50833         return ret_ref;
50834 }
50835
50836 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
50837         
50838         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50839         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
50840         uint64_t ret_ref = tag_ptr(ret_copy, true);
50841         return ret_ref;
50842 }
50843
50844 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
50845         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50846         *ret_copy = ParseError_padding_error();
50847         uint64_t ret_ref = tag_ptr(ret_copy, true);
50848         return ret_ref;
50849 }
50850
50851 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
50852         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50853         *ret_copy = ParseError_integer_overflow_error();
50854         uint64_t ret_ref = tag_ptr(ret_copy, true);
50855         return ret_ref;
50856 }
50857
50858 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
50859         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50860         *ret_copy = ParseError_invalid_seg_wit_program_length();
50861         uint64_t ret_ref = tag_ptr(ret_copy, true);
50862         return ret_ref;
50863 }
50864
50865 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
50866         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50867         *ret_copy = ParseError_invalid_pub_key_hash_length();
50868         uint64_t ret_ref = tag_ptr(ret_copy, true);
50869         return ret_ref;
50870 }
50871
50872 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
50873         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50874         *ret_copy = ParseError_invalid_script_hash_length();
50875         uint64_t ret_ref = tag_ptr(ret_copy, true);
50876         return ret_ref;
50877 }
50878
50879 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
50880         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50881         *ret_copy = ParseError_invalid_recovery_id();
50882         uint64_t ret_ref = tag_ptr(ret_copy, true);
50883         return ret_ref;
50884 }
50885
50886 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
50887         LDKStr a_conv = str_ref_to_owned_c(a);
50888         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50889         *ret_copy = ParseError_invalid_slice_length(a_conv);
50890         uint64_t ret_ref = tag_ptr(ret_copy, true);
50891         return ret_ref;
50892 }
50893
50894 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
50895         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50896         *ret_copy = ParseError_skip();
50897         uint64_t ret_ref = tag_ptr(ret_copy, true);
50898         return ret_ref;
50899 }
50900
50901 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
50902         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
50903         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
50904         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
50905         return ret_conv;
50906 }
50907
50908 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
50909         if (!ptr_is_owned(this_ptr)) return;
50910         void* this_ptr_ptr = untag_ptr(this_ptr);
50911         CHECK_ACCESS(this_ptr_ptr);
50912         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
50913         FREE(untag_ptr(this_ptr));
50914         ParseOrSemanticError_free(this_ptr_conv);
50915 }
50916
50917 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
50918         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50919         *ret_copy = ParseOrSemanticError_clone(arg);
50920         uint64_t ret_ref = tag_ptr(ret_copy, true);
50921         return ret_ref;
50922 }
50923 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
50924         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
50925         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
50926         return ret_conv;
50927 }
50928
50929 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
50930         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
50931         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50932         *ret_copy = ParseOrSemanticError_clone(orig_conv);
50933         uint64_t ret_ref = tag_ptr(ret_copy, true);
50934         return ret_ref;
50935 }
50936
50937 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
50938         void* a_ptr = untag_ptr(a);
50939         CHECK_ACCESS(a_ptr);
50940         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
50941         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
50942         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50943         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
50944         uint64_t ret_ref = tag_ptr(ret_copy, true);
50945         return ret_ref;
50946 }
50947
50948 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
50949         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
50950         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50951         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
50952         uint64_t ret_ref = tag_ptr(ret_copy, true);
50953         return ret_ref;
50954 }
50955
50956 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
50957         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
50958         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
50959         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
50960         return ret_conv;
50961 }
50962
50963 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
50964         LDKInvoice this_obj_conv;
50965         this_obj_conv.inner = untag_ptr(this_obj);
50966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50968         Invoice_free(this_obj_conv);
50969 }
50970
50971 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
50972         LDKInvoice a_conv;
50973         a_conv.inner = untag_ptr(a);
50974         a_conv.is_owned = ptr_is_owned(a);
50975         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50976         a_conv.is_owned = false;
50977         LDKInvoice b_conv;
50978         b_conv.inner = untag_ptr(b);
50979         b_conv.is_owned = ptr_is_owned(b);
50980         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50981         b_conv.is_owned = false;
50982         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
50983         return ret_conv;
50984 }
50985
50986 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
50987         LDKInvoice ret_var = Invoice_clone(arg);
50988         uint64_t ret_ref = 0;
50989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50991         return ret_ref;
50992 }
50993 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
50994         LDKInvoice arg_conv;
50995         arg_conv.inner = untag_ptr(arg);
50996         arg_conv.is_owned = ptr_is_owned(arg);
50997         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50998         arg_conv.is_owned = false;
50999         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
51000         return ret_conv;
51001 }
51002
51003 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
51004         LDKInvoice orig_conv;
51005         orig_conv.inner = untag_ptr(orig);
51006         orig_conv.is_owned = ptr_is_owned(orig);
51007         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51008         orig_conv.is_owned = false;
51009         LDKInvoice ret_var = Invoice_clone(&orig_conv);
51010         uint64_t ret_ref = 0;
51011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51013         return ret_ref;
51014 }
51015
51016 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
51017         LDKInvoice o_conv;
51018         o_conv.inner = untag_ptr(o);
51019         o_conv.is_owned = ptr_is_owned(o);
51020         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51021         o_conv.is_owned = false;
51022         int64_t ret_conv = Invoice_hash(&o_conv);
51023         return ret_conv;
51024 }
51025
51026 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
51027         LDKSignedRawInvoice this_obj_conv;
51028         this_obj_conv.inner = untag_ptr(this_obj);
51029         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51031         SignedRawInvoice_free(this_obj_conv);
51032 }
51033
51034 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
51035         LDKSignedRawInvoice a_conv;
51036         a_conv.inner = untag_ptr(a);
51037         a_conv.is_owned = ptr_is_owned(a);
51038         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51039         a_conv.is_owned = false;
51040         LDKSignedRawInvoice b_conv;
51041         b_conv.inner = untag_ptr(b);
51042         b_conv.is_owned = ptr_is_owned(b);
51043         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51044         b_conv.is_owned = false;
51045         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
51046         return ret_conv;
51047 }
51048
51049 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
51050         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
51051         uint64_t ret_ref = 0;
51052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51054         return ret_ref;
51055 }
51056 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
51057         LDKSignedRawInvoice arg_conv;
51058         arg_conv.inner = untag_ptr(arg);
51059         arg_conv.is_owned = ptr_is_owned(arg);
51060         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51061         arg_conv.is_owned = false;
51062         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
51063         return ret_conv;
51064 }
51065
51066 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
51067         LDKSignedRawInvoice orig_conv;
51068         orig_conv.inner = untag_ptr(orig);
51069         orig_conv.is_owned = ptr_is_owned(orig);
51070         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51071         orig_conv.is_owned = false;
51072         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
51073         uint64_t ret_ref = 0;
51074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51076         return ret_ref;
51077 }
51078
51079 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
51080         LDKSignedRawInvoice o_conv;
51081         o_conv.inner = untag_ptr(o);
51082         o_conv.is_owned = ptr_is_owned(o);
51083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51084         o_conv.is_owned = false;
51085         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
51086         return ret_conv;
51087 }
51088
51089 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
51090         LDKRawInvoice this_obj_conv;
51091         this_obj_conv.inner = untag_ptr(this_obj);
51092         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51094         RawInvoice_free(this_obj_conv);
51095 }
51096
51097 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
51098         LDKRawInvoice this_ptr_conv;
51099         this_ptr_conv.inner = untag_ptr(this_ptr);
51100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51102         this_ptr_conv.is_owned = false;
51103         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
51104         uint64_t ret_ref = 0;
51105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51107         return ret_ref;
51108 }
51109
51110 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
51111         LDKRawInvoice this_ptr_conv;
51112         this_ptr_conv.inner = untag_ptr(this_ptr);
51113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51115         this_ptr_conv.is_owned = false;
51116         LDKRawDataPart val_conv;
51117         val_conv.inner = untag_ptr(val);
51118         val_conv.is_owned = ptr_is_owned(val);
51119         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51120         val_conv = RawDataPart_clone(&val_conv);
51121         RawInvoice_set_data(&this_ptr_conv, val_conv);
51122 }
51123
51124 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
51125         LDKRawInvoice a_conv;
51126         a_conv.inner = untag_ptr(a);
51127         a_conv.is_owned = ptr_is_owned(a);
51128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51129         a_conv.is_owned = false;
51130         LDKRawInvoice b_conv;
51131         b_conv.inner = untag_ptr(b);
51132         b_conv.is_owned = ptr_is_owned(b);
51133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51134         b_conv.is_owned = false;
51135         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
51136         return ret_conv;
51137 }
51138
51139 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
51140         LDKRawInvoice ret_var = RawInvoice_clone(arg);
51141         uint64_t ret_ref = 0;
51142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51144         return ret_ref;
51145 }
51146 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
51147         LDKRawInvoice arg_conv;
51148         arg_conv.inner = untag_ptr(arg);
51149         arg_conv.is_owned = ptr_is_owned(arg);
51150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51151         arg_conv.is_owned = false;
51152         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
51153         return ret_conv;
51154 }
51155
51156 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
51157         LDKRawInvoice orig_conv;
51158         orig_conv.inner = untag_ptr(orig);
51159         orig_conv.is_owned = ptr_is_owned(orig);
51160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51161         orig_conv.is_owned = false;
51162         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
51163         uint64_t ret_ref = 0;
51164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51166         return ret_ref;
51167 }
51168
51169 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
51170         LDKRawInvoice o_conv;
51171         o_conv.inner = untag_ptr(o);
51172         o_conv.is_owned = ptr_is_owned(o);
51173         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51174         o_conv.is_owned = false;
51175         int64_t ret_conv = RawInvoice_hash(&o_conv);
51176         return ret_conv;
51177 }
51178
51179 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
51180         LDKRawDataPart this_obj_conv;
51181         this_obj_conv.inner = untag_ptr(this_obj);
51182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51184         RawDataPart_free(this_obj_conv);
51185 }
51186
51187 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
51188         LDKRawDataPart this_ptr_conv;
51189         this_ptr_conv.inner = untag_ptr(this_ptr);
51190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51192         this_ptr_conv.is_owned = false;
51193         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
51194         uint64_t ret_ref = 0;
51195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51197         return ret_ref;
51198 }
51199
51200 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
51201         LDKRawDataPart this_ptr_conv;
51202         this_ptr_conv.inner = untag_ptr(this_ptr);
51203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51205         this_ptr_conv.is_owned = false;
51206         LDKPositiveTimestamp val_conv;
51207         val_conv.inner = untag_ptr(val);
51208         val_conv.is_owned = ptr_is_owned(val);
51209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51210         val_conv = PositiveTimestamp_clone(&val_conv);
51211         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
51212 }
51213
51214 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
51215         LDKRawDataPart a_conv;
51216         a_conv.inner = untag_ptr(a);
51217         a_conv.is_owned = ptr_is_owned(a);
51218         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51219         a_conv.is_owned = false;
51220         LDKRawDataPart b_conv;
51221         b_conv.inner = untag_ptr(b);
51222         b_conv.is_owned = ptr_is_owned(b);
51223         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51224         b_conv.is_owned = false;
51225         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
51226         return ret_conv;
51227 }
51228
51229 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
51230         LDKRawDataPart ret_var = RawDataPart_clone(arg);
51231         uint64_t ret_ref = 0;
51232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51234         return ret_ref;
51235 }
51236 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
51237         LDKRawDataPart arg_conv;
51238         arg_conv.inner = untag_ptr(arg);
51239         arg_conv.is_owned = ptr_is_owned(arg);
51240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51241         arg_conv.is_owned = false;
51242         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
51243         return ret_conv;
51244 }
51245
51246 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
51247         LDKRawDataPart orig_conv;
51248         orig_conv.inner = untag_ptr(orig);
51249         orig_conv.is_owned = ptr_is_owned(orig);
51250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51251         orig_conv.is_owned = false;
51252         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
51253         uint64_t ret_ref = 0;
51254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51256         return ret_ref;
51257 }
51258
51259 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
51260         LDKRawDataPart o_conv;
51261         o_conv.inner = untag_ptr(o);
51262         o_conv.is_owned = ptr_is_owned(o);
51263         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51264         o_conv.is_owned = false;
51265         int64_t ret_conv = RawDataPart_hash(&o_conv);
51266         return ret_conv;
51267 }
51268
51269 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
51270         LDKPositiveTimestamp this_obj_conv;
51271         this_obj_conv.inner = untag_ptr(this_obj);
51272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51274         PositiveTimestamp_free(this_obj_conv);
51275 }
51276
51277 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
51278         LDKPositiveTimestamp a_conv;
51279         a_conv.inner = untag_ptr(a);
51280         a_conv.is_owned = ptr_is_owned(a);
51281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51282         a_conv.is_owned = false;
51283         LDKPositiveTimestamp b_conv;
51284         b_conv.inner = untag_ptr(b);
51285         b_conv.is_owned = ptr_is_owned(b);
51286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51287         b_conv.is_owned = false;
51288         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
51289         return ret_conv;
51290 }
51291
51292 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
51293         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
51294         uint64_t ret_ref = 0;
51295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51297         return ret_ref;
51298 }
51299 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
51300         LDKPositiveTimestamp arg_conv;
51301         arg_conv.inner = untag_ptr(arg);
51302         arg_conv.is_owned = ptr_is_owned(arg);
51303         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51304         arg_conv.is_owned = false;
51305         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
51306         return ret_conv;
51307 }
51308
51309 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
51310         LDKPositiveTimestamp orig_conv;
51311         orig_conv.inner = untag_ptr(orig);
51312         orig_conv.is_owned = ptr_is_owned(orig);
51313         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51314         orig_conv.is_owned = false;
51315         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
51316         uint64_t ret_ref = 0;
51317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51319         return ret_ref;
51320 }
51321
51322 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
51323         LDKPositiveTimestamp o_conv;
51324         o_conv.inner = untag_ptr(o);
51325         o_conv.is_owned = ptr_is_owned(o);
51326         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51327         o_conv.is_owned = false;
51328         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
51329         return ret_conv;
51330 }
51331
51332 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
51333         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
51334         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
51335         return ret_conv;
51336 }
51337
51338 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
51339         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
51340         return ret_conv;
51341 }
51342
51343 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
51344         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
51345         return ret_conv;
51346 }
51347
51348 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
51349         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
51350         return ret_conv;
51351 }
51352
51353 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
51354         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
51355         return ret_conv;
51356 }
51357
51358 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
51359         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
51360         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
51361         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
51362         return ret_conv;
51363 }
51364
51365 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
51366         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
51367         int64_t ret_conv = SiPrefix_hash(o_conv);
51368         return ret_conv;
51369 }
51370
51371 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
51372         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
51373         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
51374         return ret_conv;
51375 }
51376
51377 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
51378         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
51379         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
51380         return ret_conv;
51381 }
51382
51383 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
51384         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
51385         return ret_conv;
51386 }
51387
51388 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
51389         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
51390         return ret_conv;
51391 }
51392
51393 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
51394         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
51395         return ret_conv;
51396 }
51397
51398 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
51399         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
51400         return ret_conv;
51401 }
51402
51403 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
51404         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
51405         return ret_conv;
51406 }
51407
51408 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
51409         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
51410         int64_t ret_conv = Currency_hash(o_conv);
51411         return ret_conv;
51412 }
51413
51414 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
51415         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
51416         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
51417         jboolean ret_conv = Currency_eq(a_conv, b_conv);
51418         return ret_conv;
51419 }
51420
51421 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
51422         LDKSha256 this_obj_conv;
51423         this_obj_conv.inner = untag_ptr(this_obj);
51424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51426         Sha256_free(this_obj_conv);
51427 }
51428
51429 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
51430         LDKSha256 ret_var = Sha256_clone(arg);
51431         uint64_t ret_ref = 0;
51432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51434         return ret_ref;
51435 }
51436 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
51437         LDKSha256 arg_conv;
51438         arg_conv.inner = untag_ptr(arg);
51439         arg_conv.is_owned = ptr_is_owned(arg);
51440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51441         arg_conv.is_owned = false;
51442         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
51443         return ret_conv;
51444 }
51445
51446 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
51447         LDKSha256 orig_conv;
51448         orig_conv.inner = untag_ptr(orig);
51449         orig_conv.is_owned = ptr_is_owned(orig);
51450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51451         orig_conv.is_owned = false;
51452         LDKSha256 ret_var = Sha256_clone(&orig_conv);
51453         uint64_t ret_ref = 0;
51454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51456         return ret_ref;
51457 }
51458
51459 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
51460         LDKSha256 o_conv;
51461         o_conv.inner = untag_ptr(o);
51462         o_conv.is_owned = ptr_is_owned(o);
51463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51464         o_conv.is_owned = false;
51465         int64_t ret_conv = Sha256_hash(&o_conv);
51466         return ret_conv;
51467 }
51468
51469 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
51470         LDKSha256 a_conv;
51471         a_conv.inner = untag_ptr(a);
51472         a_conv.is_owned = ptr_is_owned(a);
51473         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51474         a_conv.is_owned = false;
51475         LDKSha256 b_conv;
51476         b_conv.inner = untag_ptr(b);
51477         b_conv.is_owned = ptr_is_owned(b);
51478         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51479         b_conv.is_owned = false;
51480         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
51481         return ret_conv;
51482 }
51483
51484 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
51485         uint8_t bytes_arr[32];
51486         CHECK(bytes->arr_len == 32);
51487         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
51488         uint8_t (*bytes_ref)[32] = &bytes_arr;
51489         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
51490         uint64_t ret_ref = 0;
51491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51493         return ret_ref;
51494 }
51495
51496 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
51497         LDKDescription this_obj_conv;
51498         this_obj_conv.inner = untag_ptr(this_obj);
51499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51501         Description_free(this_obj_conv);
51502 }
51503
51504 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
51505         LDKDescription ret_var = Description_clone(arg);
51506         uint64_t ret_ref = 0;
51507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51509         return ret_ref;
51510 }
51511 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
51512         LDKDescription arg_conv;
51513         arg_conv.inner = untag_ptr(arg);
51514         arg_conv.is_owned = ptr_is_owned(arg);
51515         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51516         arg_conv.is_owned = false;
51517         int64_t ret_conv = Description_clone_ptr(&arg_conv);
51518         return ret_conv;
51519 }
51520
51521 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
51522         LDKDescription orig_conv;
51523         orig_conv.inner = untag_ptr(orig);
51524         orig_conv.is_owned = ptr_is_owned(orig);
51525         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51526         orig_conv.is_owned = false;
51527         LDKDescription ret_var = Description_clone(&orig_conv);
51528         uint64_t ret_ref = 0;
51529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51531         return ret_ref;
51532 }
51533
51534 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
51535         LDKDescription o_conv;
51536         o_conv.inner = untag_ptr(o);
51537         o_conv.is_owned = ptr_is_owned(o);
51538         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51539         o_conv.is_owned = false;
51540         int64_t ret_conv = Description_hash(&o_conv);
51541         return ret_conv;
51542 }
51543
51544 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
51545         LDKDescription a_conv;
51546         a_conv.inner = untag_ptr(a);
51547         a_conv.is_owned = ptr_is_owned(a);
51548         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51549         a_conv.is_owned = false;
51550         LDKDescription b_conv;
51551         b_conv.inner = untag_ptr(b);
51552         b_conv.is_owned = ptr_is_owned(b);
51553         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51554         b_conv.is_owned = false;
51555         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
51556         return ret_conv;
51557 }
51558
51559 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
51560         LDKPayeePubKey this_obj_conv;
51561         this_obj_conv.inner = untag_ptr(this_obj);
51562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51564         PayeePubKey_free(this_obj_conv);
51565 }
51566
51567 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
51568         LDKPayeePubKey this_ptr_conv;
51569         this_ptr_conv.inner = untag_ptr(this_ptr);
51570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51572         this_ptr_conv.is_owned = false;
51573         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51574         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
51575         return ret_arr;
51576 }
51577
51578 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
51579         LDKPayeePubKey this_ptr_conv;
51580         this_ptr_conv.inner = untag_ptr(this_ptr);
51581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51583         this_ptr_conv.is_owned = false;
51584         LDKPublicKey val_ref;
51585         CHECK(val->arr_len == 33);
51586         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51587         PayeePubKey_set_a(&this_ptr_conv, val_ref);
51588 }
51589
51590 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
51591         LDKPublicKey a_arg_ref;
51592         CHECK(a_arg->arr_len == 33);
51593         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
51594         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
51595         uint64_t ret_ref = 0;
51596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51598         return ret_ref;
51599 }
51600
51601 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
51602         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
51603         uint64_t ret_ref = 0;
51604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51606         return ret_ref;
51607 }
51608 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
51609         LDKPayeePubKey arg_conv;
51610         arg_conv.inner = untag_ptr(arg);
51611         arg_conv.is_owned = ptr_is_owned(arg);
51612         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51613         arg_conv.is_owned = false;
51614         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
51615         return ret_conv;
51616 }
51617
51618 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
51619         LDKPayeePubKey orig_conv;
51620         orig_conv.inner = untag_ptr(orig);
51621         orig_conv.is_owned = ptr_is_owned(orig);
51622         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51623         orig_conv.is_owned = false;
51624         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
51625         uint64_t ret_ref = 0;
51626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51628         return ret_ref;
51629 }
51630
51631 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
51632         LDKPayeePubKey o_conv;
51633         o_conv.inner = untag_ptr(o);
51634         o_conv.is_owned = ptr_is_owned(o);
51635         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51636         o_conv.is_owned = false;
51637         int64_t ret_conv = PayeePubKey_hash(&o_conv);
51638         return ret_conv;
51639 }
51640
51641 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
51642         LDKPayeePubKey a_conv;
51643         a_conv.inner = untag_ptr(a);
51644         a_conv.is_owned = ptr_is_owned(a);
51645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51646         a_conv.is_owned = false;
51647         LDKPayeePubKey b_conv;
51648         b_conv.inner = untag_ptr(b);
51649         b_conv.is_owned = ptr_is_owned(b);
51650         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51651         b_conv.is_owned = false;
51652         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
51653         return ret_conv;
51654 }
51655
51656 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
51657         LDKExpiryTime this_obj_conv;
51658         this_obj_conv.inner = untag_ptr(this_obj);
51659         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51661         ExpiryTime_free(this_obj_conv);
51662 }
51663
51664 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
51665         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
51666         uint64_t ret_ref = 0;
51667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51669         return ret_ref;
51670 }
51671 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
51672         LDKExpiryTime arg_conv;
51673         arg_conv.inner = untag_ptr(arg);
51674         arg_conv.is_owned = ptr_is_owned(arg);
51675         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51676         arg_conv.is_owned = false;
51677         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
51678         return ret_conv;
51679 }
51680
51681 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
51682         LDKExpiryTime orig_conv;
51683         orig_conv.inner = untag_ptr(orig);
51684         orig_conv.is_owned = ptr_is_owned(orig);
51685         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51686         orig_conv.is_owned = false;
51687         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
51688         uint64_t ret_ref = 0;
51689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51691         return ret_ref;
51692 }
51693
51694 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
51695         LDKExpiryTime o_conv;
51696         o_conv.inner = untag_ptr(o);
51697         o_conv.is_owned = ptr_is_owned(o);
51698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51699         o_conv.is_owned = false;
51700         int64_t ret_conv = ExpiryTime_hash(&o_conv);
51701         return ret_conv;
51702 }
51703
51704 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
51705         LDKExpiryTime a_conv;
51706         a_conv.inner = untag_ptr(a);
51707         a_conv.is_owned = ptr_is_owned(a);
51708         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51709         a_conv.is_owned = false;
51710         LDKExpiryTime b_conv;
51711         b_conv.inner = untag_ptr(b);
51712         b_conv.is_owned = ptr_is_owned(b);
51713         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51714         b_conv.is_owned = false;
51715         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
51716         return ret_conv;
51717 }
51718
51719 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
51720         LDKMinFinalCltvExpiryDelta this_obj_conv;
51721         this_obj_conv.inner = untag_ptr(this_obj);
51722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51724         MinFinalCltvExpiryDelta_free(this_obj_conv);
51725 }
51726
51727 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
51728         LDKMinFinalCltvExpiryDelta this_ptr_conv;
51729         this_ptr_conv.inner = untag_ptr(this_ptr);
51730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51732         this_ptr_conv.is_owned = false;
51733         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
51734         return ret_conv;
51735 }
51736
51737 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
51738         LDKMinFinalCltvExpiryDelta this_ptr_conv;
51739         this_ptr_conv.inner = untag_ptr(this_ptr);
51740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51742         this_ptr_conv.is_owned = false;
51743         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
51744 }
51745
51746 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
51747         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
51748         uint64_t ret_ref = 0;
51749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51751         return ret_ref;
51752 }
51753
51754 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
51755         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
51756         uint64_t ret_ref = 0;
51757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51759         return ret_ref;
51760 }
51761 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
51762         LDKMinFinalCltvExpiryDelta arg_conv;
51763         arg_conv.inner = untag_ptr(arg);
51764         arg_conv.is_owned = ptr_is_owned(arg);
51765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51766         arg_conv.is_owned = false;
51767         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
51768         return ret_conv;
51769 }
51770
51771 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
51772         LDKMinFinalCltvExpiryDelta orig_conv;
51773         orig_conv.inner = untag_ptr(orig);
51774         orig_conv.is_owned = ptr_is_owned(orig);
51775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51776         orig_conv.is_owned = false;
51777         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
51778         uint64_t ret_ref = 0;
51779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51781         return ret_ref;
51782 }
51783
51784 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
51785         LDKMinFinalCltvExpiryDelta o_conv;
51786         o_conv.inner = untag_ptr(o);
51787         o_conv.is_owned = ptr_is_owned(o);
51788         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51789         o_conv.is_owned = false;
51790         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
51791         return ret_conv;
51792 }
51793
51794 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
51795         LDKMinFinalCltvExpiryDelta a_conv;
51796         a_conv.inner = untag_ptr(a);
51797         a_conv.is_owned = ptr_is_owned(a);
51798         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51799         a_conv.is_owned = false;
51800         LDKMinFinalCltvExpiryDelta b_conv;
51801         b_conv.inner = untag_ptr(b);
51802         b_conv.is_owned = ptr_is_owned(b);
51803         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51804         b_conv.is_owned = false;
51805         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
51806         return ret_conv;
51807 }
51808
51809 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
51810         if (!ptr_is_owned(this_ptr)) return;
51811         void* this_ptr_ptr = untag_ptr(this_ptr);
51812         CHECK_ACCESS(this_ptr_ptr);
51813         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
51814         FREE(untag_ptr(this_ptr));
51815         Fallback_free(this_ptr_conv);
51816 }
51817
51818 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
51819         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51820         *ret_copy = Fallback_clone(arg);
51821         uint64_t ret_ref = tag_ptr(ret_copy, true);
51822         return ret_ref;
51823 }
51824 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
51825         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
51826         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
51827         return ret_conv;
51828 }
51829
51830 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
51831         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
51832         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51833         *ret_copy = Fallback_clone(orig_conv);
51834         uint64_t ret_ref = tag_ptr(ret_copy, true);
51835         return ret_ref;
51836 }
51837
51838 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
51839         
51840         LDKCVec_u8Z program_ref;
51841         program_ref.datalen = program->arr_len;
51842         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
51843         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
51844         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51845         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
51846         uint64_t ret_ref = tag_ptr(ret_copy, true);
51847         return ret_ref;
51848 }
51849
51850 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
51851         LDKTwentyBytes a_ref;
51852         CHECK(a->arr_len == 20);
51853         memcpy(a_ref.data, a->elems, 20); FREE(a);
51854         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51855         *ret_copy = Fallback_pub_key_hash(a_ref);
51856         uint64_t ret_ref = tag_ptr(ret_copy, true);
51857         return ret_ref;
51858 }
51859
51860 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
51861         LDKTwentyBytes a_ref;
51862         CHECK(a->arr_len == 20);
51863         memcpy(a_ref.data, a->elems, 20); FREE(a);
51864         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51865         *ret_copy = Fallback_script_hash(a_ref);
51866         uint64_t ret_ref = tag_ptr(ret_copy, true);
51867         return ret_ref;
51868 }
51869
51870 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
51871         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
51872         int64_t ret_conv = Fallback_hash(o_conv);
51873         return ret_conv;
51874 }
51875
51876 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
51877         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
51878         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
51879         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
51880         return ret_conv;
51881 }
51882
51883 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
51884         LDKInvoiceSignature this_obj_conv;
51885         this_obj_conv.inner = untag_ptr(this_obj);
51886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51888         InvoiceSignature_free(this_obj_conv);
51889 }
51890
51891 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
51892         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
51893         uint64_t ret_ref = 0;
51894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51896         return ret_ref;
51897 }
51898 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
51899         LDKInvoiceSignature arg_conv;
51900         arg_conv.inner = untag_ptr(arg);
51901         arg_conv.is_owned = ptr_is_owned(arg);
51902         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51903         arg_conv.is_owned = false;
51904         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
51905         return ret_conv;
51906 }
51907
51908 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
51909         LDKInvoiceSignature orig_conv;
51910         orig_conv.inner = untag_ptr(orig);
51911         orig_conv.is_owned = ptr_is_owned(orig);
51912         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51913         orig_conv.is_owned = false;
51914         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
51915         uint64_t ret_ref = 0;
51916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51918         return ret_ref;
51919 }
51920
51921 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
51922         LDKInvoiceSignature o_conv;
51923         o_conv.inner = untag_ptr(o);
51924         o_conv.is_owned = ptr_is_owned(o);
51925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51926         o_conv.is_owned = false;
51927         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
51928         return ret_conv;
51929 }
51930
51931 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
51932         LDKInvoiceSignature a_conv;
51933         a_conv.inner = untag_ptr(a);
51934         a_conv.is_owned = ptr_is_owned(a);
51935         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51936         a_conv.is_owned = false;
51937         LDKInvoiceSignature b_conv;
51938         b_conv.inner = untag_ptr(b);
51939         b_conv.is_owned = ptr_is_owned(b);
51940         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51941         b_conv.is_owned = false;
51942         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
51943         return ret_conv;
51944 }
51945
51946 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
51947         LDKPrivateRoute this_obj_conv;
51948         this_obj_conv.inner = untag_ptr(this_obj);
51949         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51951         PrivateRoute_free(this_obj_conv);
51952 }
51953
51954 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
51955         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
51956         uint64_t ret_ref = 0;
51957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51959         return ret_ref;
51960 }
51961 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
51962         LDKPrivateRoute arg_conv;
51963         arg_conv.inner = untag_ptr(arg);
51964         arg_conv.is_owned = ptr_is_owned(arg);
51965         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51966         arg_conv.is_owned = false;
51967         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
51968         return ret_conv;
51969 }
51970
51971 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
51972         LDKPrivateRoute orig_conv;
51973         orig_conv.inner = untag_ptr(orig);
51974         orig_conv.is_owned = ptr_is_owned(orig);
51975         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51976         orig_conv.is_owned = false;
51977         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
51978         uint64_t ret_ref = 0;
51979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51981         return ret_ref;
51982 }
51983
51984 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
51985         LDKPrivateRoute o_conv;
51986         o_conv.inner = untag_ptr(o);
51987         o_conv.is_owned = ptr_is_owned(o);
51988         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51989         o_conv.is_owned = false;
51990         int64_t ret_conv = PrivateRoute_hash(&o_conv);
51991         return ret_conv;
51992 }
51993
51994 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
51995         LDKPrivateRoute a_conv;
51996         a_conv.inner = untag_ptr(a);
51997         a_conv.is_owned = ptr_is_owned(a);
51998         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51999         a_conv.is_owned = false;
52000         LDKPrivateRoute b_conv;
52001         b_conv.inner = untag_ptr(b);
52002         b_conv.is_owned = ptr_is_owned(b);
52003         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52004         b_conv.is_owned = false;
52005         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
52006         return ret_conv;
52007 }
52008
52009 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
52010         LDKSignedRawInvoice this_arg_conv;
52011         this_arg_conv.inner = untag_ptr(this_arg);
52012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52014         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
52015         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
52016         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
52017         return tag_ptr(ret_conv, true);
52018 }
52019
52020 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
52021         LDKSignedRawInvoice this_arg_conv;
52022         this_arg_conv.inner = untag_ptr(this_arg);
52023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52025         this_arg_conv.is_owned = false;
52026         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
52027         uint64_t ret_ref = 0;
52028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52030         return ret_ref;
52031 }
52032
52033 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
52034         LDKSignedRawInvoice this_arg_conv;
52035         this_arg_conv.inner = untag_ptr(this_arg);
52036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52038         this_arg_conv.is_owned = false;
52039         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52040         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
52041         return ret_arr;
52042 }
52043
52044 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
52045         LDKSignedRawInvoice this_arg_conv;
52046         this_arg_conv.inner = untag_ptr(this_arg);
52047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52049         this_arg_conv.is_owned = false;
52050         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
52051         uint64_t ret_ref = 0;
52052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52054         return ret_ref;
52055 }
52056
52057 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
52058         LDKSignedRawInvoice this_arg_conv;
52059         this_arg_conv.inner = untag_ptr(this_arg);
52060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52062         this_arg_conv.is_owned = false;
52063         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
52064         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
52065         return tag_ptr(ret_conv, true);
52066 }
52067
52068 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
52069         LDKSignedRawInvoice this_arg_conv;
52070         this_arg_conv.inner = untag_ptr(this_arg);
52071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52073         this_arg_conv.is_owned = false;
52074         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
52075         return ret_conv;
52076 }
52077
52078 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
52079         LDKRawInvoice this_arg_conv;
52080         this_arg_conv.inner = untag_ptr(this_arg);
52081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52083         this_arg_conv.is_owned = false;
52084         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52085         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
52086         return ret_arr;
52087 }
52088
52089 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
52090         LDKRawInvoice this_arg_conv;
52091         this_arg_conv.inner = untag_ptr(this_arg);
52092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52094         this_arg_conv.is_owned = false;
52095         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
52096         uint64_t ret_ref = 0;
52097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52099         return ret_ref;
52100 }
52101
52102 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
52103         LDKRawInvoice this_arg_conv;
52104         this_arg_conv.inner = untag_ptr(this_arg);
52105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52107         this_arg_conv.is_owned = false;
52108         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
52109         uint64_t ret_ref = 0;
52110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52112         return ret_ref;
52113 }
52114
52115 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
52116         LDKRawInvoice this_arg_conv;
52117         this_arg_conv.inner = untag_ptr(this_arg);
52118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52120         this_arg_conv.is_owned = false;
52121         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
52122         uint64_t ret_ref = 0;
52123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52125         return ret_ref;
52126 }
52127
52128 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
52129         LDKRawInvoice this_arg_conv;
52130         this_arg_conv.inner = untag_ptr(this_arg);
52131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52133         this_arg_conv.is_owned = false;
52134         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
52135         uint64_t ret_ref = 0;
52136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52138         return ret_ref;
52139 }
52140
52141 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
52142         LDKRawInvoice this_arg_conv;
52143         this_arg_conv.inner = untag_ptr(this_arg);
52144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52146         this_arg_conv.is_owned = false;
52147         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
52148         uint64_t ret_ref = 0;
52149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52151         return ret_ref;
52152 }
52153
52154 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry_delta"))) TS_RawInvoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
52155         LDKRawInvoice this_arg_conv;
52156         this_arg_conv.inner = untag_ptr(this_arg);
52157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52159         this_arg_conv.is_owned = false;
52160         LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&this_arg_conv);
52161         uint64_t ret_ref = 0;
52162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52164         return ret_ref;
52165 }
52166
52167 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
52168         LDKRawInvoice this_arg_conv;
52169         this_arg_conv.inner = untag_ptr(this_arg);
52170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52172         this_arg_conv.is_owned = false;
52173         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52174         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
52175         return ret_arr;
52176 }
52177
52178 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_metadata"))) TS_RawInvoice_payment_metadata(uint64_t this_arg) {
52179         LDKRawInvoice this_arg_conv;
52180         this_arg_conv.inner = untag_ptr(this_arg);
52181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52183         this_arg_conv.is_owned = false;
52184         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52185         *ret_copy = RawInvoice_payment_metadata(&this_arg_conv);
52186         uint64_t ret_ref = tag_ptr(ret_copy, true);
52187         return ret_ref;
52188 }
52189
52190 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
52191         LDKRawInvoice this_arg_conv;
52192         this_arg_conv.inner = untag_ptr(this_arg);
52193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52195         this_arg_conv.is_owned = false;
52196         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
52197         uint64_t ret_ref = 0;
52198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52200         return ret_ref;
52201 }
52202
52203 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
52204         LDKRawInvoice this_arg_conv;
52205         this_arg_conv.inner = untag_ptr(this_arg);
52206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52208         this_arg_conv.is_owned = false;
52209         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
52210         uint64_tArray ret_arr = NULL;
52211         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52212         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52213         for (size_t o = 0; o < ret_var.datalen; o++) {
52214                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
52215                 uint64_t ret_conv_14_ref = 0;
52216                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
52217                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
52218                 ret_arr_ptr[o] = ret_conv_14_ref;
52219         }
52220         
52221         FREE(ret_var.data);
52222         return ret_arr;
52223 }
52224
52225 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
52226         LDKRawInvoice this_arg_conv;
52227         this_arg_conv.inner = untag_ptr(this_arg);
52228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52230         this_arg_conv.is_owned = false;
52231         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52232         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
52233         uint64_t ret_ref = tag_ptr(ret_copy, true);
52234         return ret_ref;
52235 }
52236
52237 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
52238         LDKRawInvoice this_arg_conv;
52239         this_arg_conv.inner = untag_ptr(this_arg);
52240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52242         this_arg_conv.is_owned = false;
52243         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
52244         return ret_conv;
52245 }
52246
52247 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
52248         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
52249         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
52250         return tag_ptr(ret_conv, true);
52251 }
52252
52253 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
52254         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
52255         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
52256         return tag_ptr(ret_conv, true);
52257 }
52258
52259 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
52260         LDKPositiveTimestamp this_arg_conv;
52261         this_arg_conv.inner = untag_ptr(this_arg);
52262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52264         this_arg_conv.is_owned = false;
52265         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
52266         return ret_conv;
52267 }
52268
52269 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
52270         LDKPositiveTimestamp this_arg_conv;
52271         this_arg_conv.inner = untag_ptr(this_arg);
52272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52274         this_arg_conv.is_owned = false;
52275         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
52276         return ret_conv;
52277 }
52278
52279 int8_tArray  __attribute__((export_name("TS_Invoice_signable_hash"))) TS_Invoice_signable_hash(uint64_t this_arg) {
52280         LDKInvoice this_arg_conv;
52281         this_arg_conv.inner = untag_ptr(this_arg);
52282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52284         this_arg_conv.is_owned = false;
52285         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52286         memcpy(ret_arr->elems, Invoice_signable_hash(&this_arg_conv).data, 32);
52287         return ret_arr;
52288 }
52289
52290 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
52291         LDKInvoice this_arg_conv;
52292         this_arg_conv.inner = untag_ptr(this_arg);
52293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52295         this_arg_conv = Invoice_clone(&this_arg_conv);
52296         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
52297         uint64_t ret_ref = 0;
52298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52300         return ret_ref;
52301 }
52302
52303 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
52304         LDKInvoice this_arg_conv;
52305         this_arg_conv.inner = untag_ptr(this_arg);
52306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52308         this_arg_conv.is_owned = false;
52309         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
52310         *ret_conv = Invoice_check_signature(&this_arg_conv);
52311         return tag_ptr(ret_conv, true);
52312 }
52313
52314 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
52315         LDKSignedRawInvoice signed_invoice_conv;
52316         signed_invoice_conv.inner = untag_ptr(signed_invoice);
52317         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
52318         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
52319         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
52320         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
52321         *ret_conv = Invoice_from_signed(signed_invoice_conv);
52322         return tag_ptr(ret_conv, true);
52323 }
52324
52325 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
52326         LDKInvoice this_arg_conv;
52327         this_arg_conv.inner = untag_ptr(this_arg);
52328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52330         this_arg_conv.is_owned = false;
52331         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
52332         return ret_conv;
52333 }
52334
52335 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
52336         LDKInvoice this_arg_conv;
52337         this_arg_conv.inner = untag_ptr(this_arg);
52338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52340         this_arg_conv.is_owned = false;
52341         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52342         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
52343         return ret_arr;
52344 }
52345
52346 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
52347         LDKInvoice this_arg_conv;
52348         this_arg_conv.inner = untag_ptr(this_arg);
52349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52351         this_arg_conv.is_owned = false;
52352         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52353         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
52354         return ret_arr;
52355 }
52356
52357 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
52358         LDKInvoice this_arg_conv;
52359         this_arg_conv.inner = untag_ptr(this_arg);
52360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52362         this_arg_conv.is_owned = false;
52363         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52364         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
52365         return ret_arr;
52366 }
52367
52368 uint64_t  __attribute__((export_name("TS_Invoice_payment_metadata"))) TS_Invoice_payment_metadata(uint64_t this_arg) {
52369         LDKInvoice this_arg_conv;
52370         this_arg_conv.inner = untag_ptr(this_arg);
52371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52373         this_arg_conv.is_owned = false;
52374         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52375         *ret_copy = Invoice_payment_metadata(&this_arg_conv);
52376         uint64_t ret_ref = tag_ptr(ret_copy, true);
52377         return ret_ref;
52378 }
52379
52380 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
52381         LDKInvoice this_arg_conv;
52382         this_arg_conv.inner = untag_ptr(this_arg);
52383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52385         this_arg_conv.is_owned = false;
52386         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
52387         uint64_t ret_ref = 0;
52388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52390         return ret_ref;
52391 }
52392
52393 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
52394         LDKInvoice this_arg_conv;
52395         this_arg_conv.inner = untag_ptr(this_arg);
52396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52398         this_arg_conv.is_owned = false;
52399         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52400         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
52401         return ret_arr;
52402 }
52403
52404 uint64_t  __attribute__((export_name("TS_Invoice_expires_at"))) TS_Invoice_expires_at(uint64_t this_arg) {
52405         LDKInvoice this_arg_conv;
52406         this_arg_conv.inner = untag_ptr(this_arg);
52407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52409         this_arg_conv.is_owned = false;
52410         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
52411         *ret_copy = Invoice_expires_at(&this_arg_conv);
52412         uint64_t ret_ref = tag_ptr(ret_copy, true);
52413         return ret_ref;
52414 }
52415
52416 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
52417         LDKInvoice this_arg_conv;
52418         this_arg_conv.inner = untag_ptr(this_arg);
52419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52421         this_arg_conv.is_owned = false;
52422         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
52423         return ret_conv;
52424 }
52425
52426 int64_t  __attribute__((export_name("TS_Invoice_expiration_remaining_from_epoch"))) TS_Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
52427         LDKInvoice this_arg_conv;
52428         this_arg_conv.inner = untag_ptr(this_arg);
52429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52431         this_arg_conv.is_owned = false;
52432         int64_t ret_conv = Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
52433         return ret_conv;
52434 }
52435
52436 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
52437         LDKInvoice this_arg_conv;
52438         this_arg_conv.inner = untag_ptr(this_arg);
52439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52441         this_arg_conv.is_owned = false;
52442         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
52443         return ret_conv;
52444 }
52445
52446 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry_delta"))) TS_Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
52447         LDKInvoice this_arg_conv;
52448         this_arg_conv.inner = untag_ptr(this_arg);
52449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52451         this_arg_conv.is_owned = false;
52452         int64_t ret_conv = Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
52453         return ret_conv;
52454 }
52455
52456 ptrArray  __attribute__((export_name("TS_Invoice_fallback_addresses"))) TS_Invoice_fallback_addresses(uint64_t this_arg) {
52457         LDKInvoice this_arg_conv;
52458         this_arg_conv.inner = untag_ptr(this_arg);
52459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52461         this_arg_conv.is_owned = false;
52462         LDKCVec_AddressZ ret_var = Invoice_fallback_addresses(&this_arg_conv);
52463         ptrArray ret_arr = NULL;
52464         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
52465         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
52466         for (size_t i = 0; i < ret_var.datalen; i++) {
52467                 LDKStr ret_conv_8_str = ret_var.data[i];
52468                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
52469                 Str_free(ret_conv_8_str);
52470                 ret_arr_ptr[i] = ret_conv_8_conv;
52471         }
52472         
52473         FREE(ret_var.data);
52474         return ret_arr;
52475 }
52476
52477 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
52478         LDKInvoice this_arg_conv;
52479         this_arg_conv.inner = untag_ptr(this_arg);
52480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52482         this_arg_conv.is_owned = false;
52483         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
52484         uint64_tArray ret_arr = NULL;
52485         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52486         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52487         for (size_t o = 0; o < ret_var.datalen; o++) {
52488                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
52489                 uint64_t ret_conv_14_ref = 0;
52490                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
52491                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
52492                 ret_arr_ptr[o] = ret_conv_14_ref;
52493         }
52494         
52495         FREE(ret_var.data);
52496         return ret_arr;
52497 }
52498
52499 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
52500         LDKInvoice this_arg_conv;
52501         this_arg_conv.inner = untag_ptr(this_arg);
52502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52504         this_arg_conv.is_owned = false;
52505         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
52506         uint64_tArray ret_arr = NULL;
52507         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52508         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52509         for (size_t l = 0; l < ret_var.datalen; l++) {
52510                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
52511                 uint64_t ret_conv_11_ref = 0;
52512                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
52513                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
52514                 ret_arr_ptr[l] = ret_conv_11_ref;
52515         }
52516         
52517         FREE(ret_var.data);
52518         return ret_arr;
52519 }
52520
52521 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
52522         LDKInvoice this_arg_conv;
52523         this_arg_conv.inner = untag_ptr(this_arg);
52524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52526         this_arg_conv.is_owned = false;
52527         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
52528         return ret_conv;
52529 }
52530
52531 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
52532         LDKInvoice this_arg_conv;
52533         this_arg_conv.inner = untag_ptr(this_arg);
52534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52536         this_arg_conv.is_owned = false;
52537         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52538         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
52539         uint64_t ret_ref = tag_ptr(ret_copy, true);
52540         return ret_ref;
52541 }
52542
52543 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
52544         LDKStr description_conv = str_ref_to_owned_c(description);
52545         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
52546         *ret_conv = Description_new(description_conv);
52547         return tag_ptr(ret_conv, true);
52548 }
52549
52550 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
52551         LDKDescription this_arg_conv;
52552         this_arg_conv.inner = untag_ptr(this_arg);
52553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52555         this_arg_conv = Description_clone(&this_arg_conv);
52556         LDKStr ret_str = Description_into_inner(this_arg_conv);
52557         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52558         Str_free(ret_str);
52559         return ret_conv;
52560 }
52561
52562 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
52563         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
52564         uint64_t ret_ref = 0;
52565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52567         return ret_ref;
52568 }
52569
52570 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
52571         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
52572         uint64_t ret_ref = 0;
52573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52575         return ret_ref;
52576 }
52577
52578 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
52579         LDKExpiryTime this_arg_conv;
52580         this_arg_conv.inner = untag_ptr(this_arg);
52581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52583         this_arg_conv.is_owned = false;
52584         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
52585         return ret_conv;
52586 }
52587
52588 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
52589         LDKExpiryTime this_arg_conv;
52590         this_arg_conv.inner = untag_ptr(this_arg);
52591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52593         this_arg_conv.is_owned = false;
52594         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
52595         return ret_conv;
52596 }
52597
52598 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
52599         LDKRouteHint hops_conv;
52600         hops_conv.inner = untag_ptr(hops);
52601         hops_conv.is_owned = ptr_is_owned(hops);
52602         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
52603         hops_conv = RouteHint_clone(&hops_conv);
52604         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
52605         *ret_conv = PrivateRoute_new(hops_conv);
52606         return tag_ptr(ret_conv, true);
52607 }
52608
52609 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
52610         LDKPrivateRoute this_arg_conv;
52611         this_arg_conv.inner = untag_ptr(this_arg);
52612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52614         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
52615         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
52616         uint64_t ret_ref = 0;
52617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52619         return ret_ref;
52620 }
52621
52622 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
52623         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
52624         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
52625         return ret_conv;
52626 }
52627
52628 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
52629         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
52630         return ret_conv;
52631 }
52632
52633 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
52634         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
52635         return ret_conv;
52636 }
52637
52638 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
52639         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
52640         return ret_conv;
52641 }
52642
52643 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
52644         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
52645         return ret_conv;
52646 }
52647
52648 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
52649         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
52650         return ret_conv;
52651 }
52652
52653 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
52654         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
52655         return ret_conv;
52656 }
52657
52658 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
52659         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
52660         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
52661         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
52662         return ret_conv;
52663 }
52664
52665 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
52666         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
52667         LDKStr ret_str = CreationError_to_str(o_conv);
52668         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52669         Str_free(ret_str);
52670         return ret_conv;
52671 }
52672
52673 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
52674         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
52675         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
52676         return ret_conv;
52677 }
52678
52679 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
52680         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
52681         return ret_conv;
52682 }
52683
52684 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
52685         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
52686         return ret_conv;
52687 }
52688
52689 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
52690         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
52691         return ret_conv;
52692 }
52693
52694 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
52695         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
52696         return ret_conv;
52697 }
52698
52699 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
52700         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
52701         return ret_conv;
52702 }
52703
52704 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
52705         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
52706         return ret_conv;
52707 }
52708
52709 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
52710         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
52711         return ret_conv;
52712 }
52713
52714 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
52715         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
52716         return ret_conv;
52717 }
52718
52719 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
52720         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
52721         return ret_conv;
52722 }
52723
52724 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
52725         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
52726         return ret_conv;
52727 }
52728
52729 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
52730         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
52731         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
52732         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
52733         return ret_conv;
52734 }
52735
52736 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
52737         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
52738         LDKStr ret_str = SemanticError_to_str(o_conv);
52739         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52740         Str_free(ret_str);
52741         return ret_conv;
52742 }
52743
52744 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
52745         if (!ptr_is_owned(this_ptr)) return;
52746         void* this_ptr_ptr = untag_ptr(this_ptr);
52747         CHECK_ACCESS(this_ptr_ptr);
52748         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
52749         FREE(untag_ptr(this_ptr));
52750         SignOrCreationError_free(this_ptr_conv);
52751 }
52752
52753 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
52754         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52755         *ret_copy = SignOrCreationError_clone(arg);
52756         uint64_t ret_ref = tag_ptr(ret_copy, true);
52757         return ret_ref;
52758 }
52759 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
52760         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
52761         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
52762         return ret_conv;
52763 }
52764
52765 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
52766         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
52767         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52768         *ret_copy = SignOrCreationError_clone(orig_conv);
52769         uint64_t ret_ref = tag_ptr(ret_copy, true);
52770         return ret_ref;
52771 }
52772
52773 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
52774         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52775         *ret_copy = SignOrCreationError_sign_error();
52776         uint64_t ret_ref = tag_ptr(ret_copy, true);
52777         return ret_ref;
52778 }
52779
52780 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
52781         LDKCreationError a_conv = LDKCreationError_from_js(a);
52782         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52783         *ret_copy = SignOrCreationError_creation_error(a_conv);
52784         uint64_t ret_ref = tag_ptr(ret_copy, true);
52785         return ret_ref;
52786 }
52787
52788 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
52789         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
52790         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
52791         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
52792         return ret_conv;
52793 }
52794
52795 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
52796         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
52797         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
52798         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52799         Str_free(ret_str);
52800         return ret_conv;
52801 }
52802
52803 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
52804         LDKInvoice invoice_conv;
52805         invoice_conv.inner = untag_ptr(invoice);
52806         invoice_conv.is_owned = ptr_is_owned(invoice);
52807         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52808         invoice_conv.is_owned = false;
52809         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52810         CHECK_ACCESS(retry_strategy_ptr);
52811         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52812         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52813         LDKChannelManager channelmanager_conv;
52814         channelmanager_conv.inner = untag_ptr(channelmanager);
52815         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52816         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52817         channelmanager_conv.is_owned = false;
52818         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
52819         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
52820         return tag_ptr(ret_conv, true);
52821 }
52822
52823 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) {
52824         LDKInvoice invoice_conv;
52825         invoice_conv.inner = untag_ptr(invoice);
52826         invoice_conv.is_owned = ptr_is_owned(invoice);
52827         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52828         invoice_conv.is_owned = false;
52829         LDKThirtyTwoBytes payment_id_ref;
52830         CHECK(payment_id->arr_len == 32);
52831         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
52832         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52833         CHECK_ACCESS(retry_strategy_ptr);
52834         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52835         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52836         LDKChannelManager channelmanager_conv;
52837         channelmanager_conv.inner = untag_ptr(channelmanager);
52838         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52839         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52840         channelmanager_conv.is_owned = false;
52841         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
52842         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
52843         return tag_ptr(ret_conv, true);
52844 }
52845
52846 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) {
52847         LDKInvoice invoice_conv;
52848         invoice_conv.inner = untag_ptr(invoice);
52849         invoice_conv.is_owned = ptr_is_owned(invoice);
52850         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52851         invoice_conv.is_owned = false;
52852         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52853         CHECK_ACCESS(retry_strategy_ptr);
52854         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52855         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52856         LDKChannelManager channelmanager_conv;
52857         channelmanager_conv.inner = untag_ptr(channelmanager);
52858         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52859         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52860         channelmanager_conv.is_owned = false;
52861         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
52862         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
52863         return tag_ptr(ret_conv, true);
52864 }
52865
52866 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) {
52867         LDKInvoice invoice_conv;
52868         invoice_conv.inner = untag_ptr(invoice);
52869         invoice_conv.is_owned = ptr_is_owned(invoice);
52870         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52871         invoice_conv.is_owned = false;
52872         LDKThirtyTwoBytes payment_id_ref;
52873         CHECK(payment_id->arr_len == 32);
52874         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
52875         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52876         CHECK_ACCESS(retry_strategy_ptr);
52877         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52878         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52879         LDKChannelManager channelmanager_conv;
52880         channelmanager_conv.inner = untag_ptr(channelmanager);
52881         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52882         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52883         channelmanager_conv.is_owned = false;
52884         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
52885         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
52886         return tag_ptr(ret_conv, true);
52887 }
52888
52889 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
52890         if (!ptr_is_owned(this_ptr)) return;
52891         void* this_ptr_ptr = untag_ptr(this_ptr);
52892         CHECK_ACCESS(this_ptr_ptr);
52893         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
52894         FREE(untag_ptr(this_ptr));
52895         PaymentError_free(this_ptr_conv);
52896 }
52897
52898 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
52899         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52900         *ret_copy = PaymentError_clone(arg);
52901         uint64_t ret_ref = tag_ptr(ret_copy, true);
52902         return ret_ref;
52903 }
52904 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
52905         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
52906         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
52907         return ret_conv;
52908 }
52909
52910 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
52911         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
52912         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52913         *ret_copy = PaymentError_clone(orig_conv);
52914         uint64_t ret_ref = tag_ptr(ret_copy, true);
52915         return ret_ref;
52916 }
52917
52918 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
52919         LDKStr a_conv = str_ref_to_owned_c(a);
52920         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52921         *ret_copy = PaymentError_invoice(a_conv);
52922         uint64_t ret_ref = tag_ptr(ret_copy, true);
52923         return ret_ref;
52924 }
52925
52926 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
52927         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
52928         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52929         *ret_copy = PaymentError_sending(a_conv);
52930         uint64_t ret_ref = tag_ptr(ret_copy, true);
52931         return ret_ref;
52932 }
52933
52934 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) {
52935         void* amt_msat_ptr = untag_ptr(amt_msat);
52936         CHECK_ACCESS(amt_msat_ptr);
52937         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
52938         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
52939         LDKThirtyTwoBytes payment_hash_ref;
52940         CHECK(payment_hash->arr_len == 32);
52941         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
52942         LDKStr description_conv = str_ref_to_owned_c(description);
52943         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
52944         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
52945         if (phantom_route_hints_constr.datalen > 0)
52946                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
52947         else
52948                 phantom_route_hints_constr.data = NULL;
52949         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
52950         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
52951                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
52952                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
52953                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
52954                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
52955                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
52956                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
52957                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
52958         }
52959         FREE(phantom_route_hints);
52960         void* entropy_source_ptr = untag_ptr(entropy_source);
52961         CHECK_ACCESS(entropy_source_ptr);
52962         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
52963         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
52964                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52965                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
52966         }
52967         void* node_signer_ptr = untag_ptr(node_signer);
52968         CHECK_ACCESS(node_signer_ptr);
52969         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52970         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52971                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52972                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52973         }
52974         void* logger_ptr = untag_ptr(logger);
52975         CHECK_ACCESS(logger_ptr);
52976         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52977         if (logger_conv.free == LDKLogger_JCalls_free) {
52978                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52979                 LDKLogger_JCalls_cloned(&logger_conv);
52980         }
52981         LDKCurrency network_conv = LDKCurrency_from_js(network);
52982         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
52983         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
52984         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
52985         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
52986         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
52987         *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);
52988         return tag_ptr(ret_conv, true);
52989 }
52990
52991 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) {
52992         void* amt_msat_ptr = untag_ptr(amt_msat);
52993         CHECK_ACCESS(amt_msat_ptr);
52994         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
52995         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
52996         LDKThirtyTwoBytes payment_hash_ref;
52997         CHECK(payment_hash->arr_len == 32);
52998         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
52999         LDKSha256 description_hash_conv;
53000         description_hash_conv.inner = untag_ptr(description_hash);
53001         description_hash_conv.is_owned = ptr_is_owned(description_hash);
53002         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
53003         description_hash_conv = Sha256_clone(&description_hash_conv);
53004         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
53005         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
53006         if (phantom_route_hints_constr.datalen > 0)
53007                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
53008         else
53009                 phantom_route_hints_constr.data = NULL;
53010         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
53011         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
53012                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
53013                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
53014                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
53015                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
53016                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
53017                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
53018                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
53019         }
53020         FREE(phantom_route_hints);
53021         void* entropy_source_ptr = untag_ptr(entropy_source);
53022         CHECK_ACCESS(entropy_source_ptr);
53023         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
53024         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
53025                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53026                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
53027         }
53028         void* node_signer_ptr = untag_ptr(node_signer);
53029         CHECK_ACCESS(node_signer_ptr);
53030         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53031         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53032                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53033                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53034         }
53035         void* logger_ptr = untag_ptr(logger);
53036         CHECK_ACCESS(logger_ptr);
53037         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53038         if (logger_conv.free == LDKLogger_JCalls_free) {
53039                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53040                 LDKLogger_JCalls_cloned(&logger_conv);
53041         }
53042         LDKCurrency network_conv = LDKCurrency_from_js(network);
53043         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53044         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53045         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53046         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53047         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53048         *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);
53049         return tag_ptr(ret_conv, true);
53050 }
53051
53052 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) {
53053         LDKChannelManager channelmanager_conv;
53054         channelmanager_conv.inner = untag_ptr(channelmanager);
53055         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53056         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53057         channelmanager_conv.is_owned = false;
53058         void* node_signer_ptr = untag_ptr(node_signer);
53059         CHECK_ACCESS(node_signer_ptr);
53060         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53061         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53062                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53063                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53064         }
53065         void* logger_ptr = untag_ptr(logger);
53066         CHECK_ACCESS(logger_ptr);
53067         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53068         if (logger_conv.free == LDKLogger_JCalls_free) {
53069                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53070                 LDKLogger_JCalls_cloned(&logger_conv);
53071         }
53072         LDKCurrency network_conv = LDKCurrency_from_js(network);
53073         void* amt_msat_ptr = untag_ptr(amt_msat);
53074         CHECK_ACCESS(amt_msat_ptr);
53075         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53076         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53077         LDKSha256 description_hash_conv;
53078         description_hash_conv.inner = untag_ptr(description_hash);
53079         description_hash_conv.is_owned = ptr_is_owned(description_hash);
53080         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
53081         description_hash_conv = Sha256_clone(&description_hash_conv);
53082         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53083         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53084         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53085         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53086         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53087         *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);
53088         return tag_ptr(ret_conv, true);
53089 }
53090
53091 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) {
53092         LDKChannelManager channelmanager_conv;
53093         channelmanager_conv.inner = untag_ptr(channelmanager);
53094         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53095         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53096         channelmanager_conv.is_owned = false;
53097         void* node_signer_ptr = untag_ptr(node_signer);
53098         CHECK_ACCESS(node_signer_ptr);
53099         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53100         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53101                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53102                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53103         }
53104         void* logger_ptr = untag_ptr(logger);
53105         CHECK_ACCESS(logger_ptr);
53106         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53107         if (logger_conv.free == LDKLogger_JCalls_free) {
53108                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53109                 LDKLogger_JCalls_cloned(&logger_conv);
53110         }
53111         LDKCurrency network_conv = LDKCurrency_from_js(network);
53112         void* amt_msat_ptr = untag_ptr(amt_msat);
53113         CHECK_ACCESS(amt_msat_ptr);
53114         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53115         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53116         LDKStr description_conv = str_ref_to_owned_c(description);
53117         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53118         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53119         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53120         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53121         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53122         *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);
53123         return tag_ptr(ret_conv, true);
53124 }
53125
53126 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) {
53127         LDKChannelManager channelmanager_conv;
53128         channelmanager_conv.inner = untag_ptr(channelmanager);
53129         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53130         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53131         channelmanager_conv.is_owned = false;
53132         void* node_signer_ptr = untag_ptr(node_signer);
53133         CHECK_ACCESS(node_signer_ptr);
53134         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53135         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53136                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53137                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53138         }
53139         void* logger_ptr = untag_ptr(logger);
53140         CHECK_ACCESS(logger_ptr);
53141         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53142         if (logger_conv.free == LDKLogger_JCalls_free) {
53143                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53144                 LDKLogger_JCalls_cloned(&logger_conv);
53145         }
53146         LDKCurrency network_conv = LDKCurrency_from_js(network);
53147         void* amt_msat_ptr = untag_ptr(amt_msat);
53148         CHECK_ACCESS(amt_msat_ptr);
53149         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53150         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53151         LDKStr description_conv = str_ref_to_owned_c(description);
53152         LDKThirtyTwoBytes payment_hash_ref;
53153         CHECK(payment_hash->arr_len == 32);
53154         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
53155         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53156         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53157         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53158         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53159         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53160         *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);
53161         return tag_ptr(ret_conv, true);
53162 }
53163
53164 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
53165         LDKStr s_conv = str_ref_to_owned_c(s);
53166         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
53167         *ret_conv = SiPrefix_from_str(s_conv);
53168         return tag_ptr(ret_conv, true);
53169 }
53170
53171 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
53172         LDKStr s_conv = str_ref_to_owned_c(s);
53173         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
53174         *ret_conv = Invoice_from_str(s_conv);
53175         return tag_ptr(ret_conv, true);
53176 }
53177
53178 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
53179         LDKStr s_conv = str_ref_to_owned_c(s);
53180         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
53181         *ret_conv = SignedRawInvoice_from_str(s_conv);
53182         return tag_ptr(ret_conv, true);
53183 }
53184
53185 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
53186         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
53187         LDKStr ret_str = ParseError_to_str(o_conv);
53188         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53189         Str_free(ret_str);
53190         return ret_conv;
53191 }
53192
53193 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
53194         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
53195         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
53196         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53197         Str_free(ret_str);
53198         return ret_conv;
53199 }
53200
53201 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
53202         LDKInvoice o_conv;
53203         o_conv.inner = untag_ptr(o);
53204         o_conv.is_owned = ptr_is_owned(o);
53205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53206         o_conv.is_owned = false;
53207         LDKStr ret_str = Invoice_to_str(&o_conv);
53208         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53209         Str_free(ret_str);
53210         return ret_conv;
53211 }
53212
53213 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
53214         LDKSignedRawInvoice o_conv;
53215         o_conv.inner = untag_ptr(o);
53216         o_conv.is_owned = ptr_is_owned(o);
53217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53218         o_conv.is_owned = false;
53219         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
53220         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53221         Str_free(ret_str);
53222         return ret_conv;
53223 }
53224
53225 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
53226         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
53227         LDKStr ret_str = Currency_to_str(o_conv);
53228         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53229         Str_free(ret_str);
53230         return ret_conv;
53231 }
53232
53233 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
53234         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
53235         LDKStr ret_str = SiPrefix_to_str(o_conv);
53236         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53237         Str_free(ret_str);
53238         return ret_conv;
53239 }
53240