[TS] Update auto-generated bindings
[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         tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak));
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 static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) {
16625         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16626         *ret_copy = COption_ScalarZ_clone(arg);
16627         uint64_t ret_ref = tag_ptr(ret_copy, true);
16628         return ret_ref;
16629 }
16630 int64_t  __attribute__((export_name("TS_COption_ScalarZ_clone_ptr"))) TS_COption_ScalarZ_clone_ptr(uint64_t arg) {
16631         LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg);
16632         int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv);
16633         return ret_conv;
16634 }
16635
16636 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_clone"))) TS_COption_ScalarZ_clone(uint64_t orig) {
16637         LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig);
16638         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16639         *ret_copy = COption_ScalarZ_clone(orig_conv);
16640         uint64_t ret_ref = tag_ptr(ret_copy, true);
16641         return ret_ref;
16642 }
16643
16644 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
16645         LDKThirtyTwoBytes o_ref;
16646         CHECK(o->arr_len == 32);
16647         memcpy(o_ref.data, o->elems, 32); FREE(o);
16648         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16649         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
16650         return tag_ptr(ret_conv, true);
16651 }
16652
16653 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
16654         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16655         *ret_conv = CResult_SharedSecretNoneZ_err();
16656         return tag_ptr(ret_conv, true);
16657 }
16658
16659 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
16660         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
16661         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
16662         return ret_conv;
16663 }
16664
16665 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
16666         if (!ptr_is_owned(_res)) return;
16667         void* _res_ptr = untag_ptr(_res);
16668         CHECK_ACCESS(_res_ptr);
16669         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
16670         FREE(untag_ptr(_res));
16671         CResult_SharedSecretNoneZ_free(_res_conv);
16672 }
16673
16674 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16675         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16676         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16677         return tag_ptr(ret_conv, true);
16678 }
16679 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16680         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16681         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16682         return ret_conv;
16683 }
16684
16685 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16686         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16687         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16688         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16689         return tag_ptr(ret_conv, true);
16690 }
16691
16692 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16693         LDKCVec_U5Z _res_constr;
16694         _res_constr.datalen = _res->arr_len;
16695         if (_res_constr.datalen > 0)
16696                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16697         else
16698                 _res_constr.data = NULL;
16699         int8_t* _res_vals = (void*) _res->elems;
16700         for (size_t h = 0; h < _res_constr.datalen; h++) {
16701                 int8_t _res_conv_7 = _res_vals[h];
16702                 
16703                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16704         }
16705         FREE(_res);
16706         CVec_U5Z_free(_res_constr);
16707 }
16708
16709 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16710         LDKRecoverableSignature o_ref;
16711         CHECK(o->arr_len == 68);
16712         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16713         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16714         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16715         return tag_ptr(ret_conv, true);
16716 }
16717
16718 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16719         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16720         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16721         return tag_ptr(ret_conv, true);
16722 }
16723
16724 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16725         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16726         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16727         return ret_conv;
16728 }
16729
16730 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16731         if (!ptr_is_owned(_res)) return;
16732         void* _res_ptr = untag_ptr(_res);
16733         CHECK_ACCESS(_res_ptr);
16734         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16735         FREE(untag_ptr(_res));
16736         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16737 }
16738
16739 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16740         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16741         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16742         return tag_ptr(ret_conv, true);
16743 }
16744 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16745         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16746         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16747         return ret_conv;
16748 }
16749
16750 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16751         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16752         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16753         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16754         return tag_ptr(ret_conv, true);
16755 }
16756
16757 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16758         void* o_ptr = untag_ptr(o);
16759         CHECK_ACCESS(o_ptr);
16760         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16761         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16762                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16763                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16764         }
16765         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16766         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16767         return tag_ptr(ret_conv, true);
16768 }
16769
16770 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16771         void* e_ptr = untag_ptr(e);
16772         CHECK_ACCESS(e_ptr);
16773         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16774         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16775         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16776         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16777         return tag_ptr(ret_conv, true);
16778 }
16779
16780 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16781         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16782         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16783         return ret_conv;
16784 }
16785
16786 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16787         if (!ptr_is_owned(_res)) return;
16788         void* _res_ptr = untag_ptr(_res);
16789         CHECK_ACCESS(_res_ptr);
16790         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16791         FREE(untag_ptr(_res));
16792         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16793 }
16794
16795 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16796         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16797         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16798         return tag_ptr(ret_conv, true);
16799 }
16800 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16801         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16802         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16803         return ret_conv;
16804 }
16805
16806 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16807         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16808         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16809         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16810         return tag_ptr(ret_conv, true);
16811 }
16812
16813 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16814         LDKCVec_CVec_u8ZZ _res_constr;
16815         _res_constr.datalen = _res->arr_len;
16816         if (_res_constr.datalen > 0)
16817                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16818         else
16819                 _res_constr.data = NULL;
16820         int8_tArray* _res_vals = (void*) _res->elems;
16821         for (size_t m = 0; m < _res_constr.datalen; m++) {
16822                 int8_tArray _res_conv_12 = _res_vals[m];
16823                 LDKCVec_u8Z _res_conv_12_ref;
16824                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16825                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16826                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16827                 _res_constr.data[m] = _res_conv_12_ref;
16828         }
16829         FREE(_res);
16830         CVec_CVec_u8ZZ_free(_res_constr);
16831 }
16832
16833 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16834         LDKCVec_CVec_u8ZZ o_constr;
16835         o_constr.datalen = o->arr_len;
16836         if (o_constr.datalen > 0)
16837                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16838         else
16839                 o_constr.data = NULL;
16840         int8_tArray* o_vals = (void*) o->elems;
16841         for (size_t m = 0; m < o_constr.datalen; m++) {
16842                 int8_tArray o_conv_12 = o_vals[m];
16843                 LDKCVec_u8Z o_conv_12_ref;
16844                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16845                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16846                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16847                 o_constr.data[m] = o_conv_12_ref;
16848         }
16849         FREE(o);
16850         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16851         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16852         return tag_ptr(ret_conv, true);
16853 }
16854
16855 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16856         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16857         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16858         return tag_ptr(ret_conv, true);
16859 }
16860
16861 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16862         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16863         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16864         return ret_conv;
16865 }
16866
16867 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16868         if (!ptr_is_owned(_res)) return;
16869         void* _res_ptr = untag_ptr(_res);
16870         CHECK_ACCESS(_res_ptr);
16871         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16872         FREE(untag_ptr(_res));
16873         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16874 }
16875
16876 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16877         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16878         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16879         return tag_ptr(ret_conv, true);
16880 }
16881 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16882         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16883         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16884         return ret_conv;
16885 }
16886
16887 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16888         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16889         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16890         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16891         return tag_ptr(ret_conv, true);
16892 }
16893
16894 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16895         LDKInMemorySigner o_conv;
16896         o_conv.inner = untag_ptr(o);
16897         o_conv.is_owned = ptr_is_owned(o);
16898         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16899         o_conv = InMemorySigner_clone(&o_conv);
16900         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16901         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16902         return tag_ptr(ret_conv, true);
16903 }
16904
16905 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16906         void* e_ptr = untag_ptr(e);
16907         CHECK_ACCESS(e_ptr);
16908         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16909         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16910         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16911         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16912         return tag_ptr(ret_conv, true);
16913 }
16914
16915 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16916         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16917         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16918         return ret_conv;
16919 }
16920
16921 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16922         if (!ptr_is_owned(_res)) return;
16923         void* _res_ptr = untag_ptr(_res);
16924         CHECK_ACCESS(_res_ptr);
16925         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16926         FREE(untag_ptr(_res));
16927         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16928 }
16929
16930 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16931         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16932         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16933         return tag_ptr(ret_conv, true);
16934 }
16935 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16936         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16937         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16938         return ret_conv;
16939 }
16940
16941 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16942         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16943         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16944         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16945         return tag_ptr(ret_conv, true);
16946 }
16947
16948 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16949         LDKCVec_TxOutZ _res_constr;
16950         _res_constr.datalen = _res->arr_len;
16951         if (_res_constr.datalen > 0)
16952                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16953         else
16954                 _res_constr.data = NULL;
16955         uint64_t* _res_vals = _res->elems;
16956         for (size_t h = 0; h < _res_constr.datalen; h++) {
16957                 uint64_t _res_conv_7 = _res_vals[h];
16958                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16959                 CHECK_ACCESS(_res_conv_7_ptr);
16960                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16961                 FREE(untag_ptr(_res_conv_7));
16962                 _res_constr.data[h] = _res_conv_7_conv;
16963         }
16964         FREE(_res);
16965         CVec_TxOutZ_free(_res_constr);
16966 }
16967
16968 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16969         LDKTransaction o_ref;
16970         o_ref.datalen = o->arr_len;
16971         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16972         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16973         o_ref.data_is_owned = true;
16974         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16975         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16976         return tag_ptr(ret_conv, true);
16977 }
16978
16979 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16980         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16981         *ret_conv = CResult_TransactionNoneZ_err();
16982         return tag_ptr(ret_conv, true);
16983 }
16984
16985 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16986         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16987         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16988         return ret_conv;
16989 }
16990
16991 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16992         if (!ptr_is_owned(_res)) return;
16993         void* _res_ptr = untag_ptr(_res);
16994         CHECK_ACCESS(_res_ptr);
16995         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16996         FREE(untag_ptr(_res));
16997         CResult_TransactionNoneZ_free(_res_conv);
16998 }
16999
17000 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
17001         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17002         *ret_conv = CResult_TransactionNoneZ_clone(arg);
17003         return tag_ptr(ret_conv, true);
17004 }
17005 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
17006         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
17007         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
17008         return ret_conv;
17009 }
17010
17011 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
17012         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
17013         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17014         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
17015         return tag_ptr(ret_conv, true);
17016 }
17017
17018 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
17019         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17020         *ret_copy = COption_u16Z_some(o);
17021         uint64_t ret_ref = tag_ptr(ret_copy, true);
17022         return ret_ref;
17023 }
17024
17025 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
17026         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17027         *ret_copy = COption_u16Z_none();
17028         uint64_t ret_ref = tag_ptr(ret_copy, true);
17029         return ret_ref;
17030 }
17031
17032 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
17033         if (!ptr_is_owned(_res)) return;
17034         void* _res_ptr = untag_ptr(_res);
17035         CHECK_ACCESS(_res_ptr);
17036         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17037         FREE(untag_ptr(_res));
17038         COption_u16Z_free(_res_conv);
17039 }
17040
17041 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17042         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17043         *ret_copy = COption_u16Z_clone(arg);
17044         uint64_t ret_ref = tag_ptr(ret_copy, true);
17045         return ret_ref;
17046 }
17047 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
17048         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
17049         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
17050         return ret_conv;
17051 }
17052
17053 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
17054         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
17055         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17056         *ret_copy = COption_u16Z_clone(orig_conv);
17057         uint64_t ret_ref = tag_ptr(ret_copy, true);
17058         return ret_ref;
17059 }
17060
17061 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
17062         LDKThirtyTwoBytes o_ref;
17063         CHECK(o->arr_len == 32);
17064         memcpy(o_ref.data, o->elems, 32); FREE(o);
17065         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17066         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
17067         return tag_ptr(ret_conv, true);
17068 }
17069
17070 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
17071         void* e_ptr = untag_ptr(e);
17072         CHECK_ACCESS(e_ptr);
17073         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17074         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17075         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17076         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
17077         return tag_ptr(ret_conv, true);
17078 }
17079
17080 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
17081         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
17082         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
17083         return ret_conv;
17084 }
17085
17086 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
17087         if (!ptr_is_owned(_res)) return;
17088         void* _res_ptr = untag_ptr(_res);
17089         CHECK_ACCESS(_res_ptr);
17090         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
17091         FREE(untag_ptr(_res));
17092         CResult__u832APIErrorZ_free(_res_conv);
17093 }
17094
17095 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
17096         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17097         *ret_conv = CResult__u832APIErrorZ_clone(arg);
17098         return tag_ptr(ret_conv, true);
17099 }
17100 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
17101         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
17102         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
17103         return ret_conv;
17104 }
17105
17106 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
17107         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
17108         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17109         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
17110         return tag_ptr(ret_conv, true);
17111 }
17112
17113 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
17114         LDKCVec_RecentPaymentDetailsZ _res_constr;
17115         _res_constr.datalen = _res->arr_len;
17116         if (_res_constr.datalen > 0)
17117                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
17118         else
17119                 _res_constr.data = NULL;
17120         uint64_t* _res_vals = _res->elems;
17121         for (size_t w = 0; w < _res_constr.datalen; w++) {
17122                 uint64_t _res_conv_22 = _res_vals[w];
17123                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
17124                 CHECK_ACCESS(_res_conv_22_ptr);
17125                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
17126                 FREE(untag_ptr(_res_conv_22));
17127                 _res_constr.data[w] = _res_conv_22_conv;
17128         }
17129         FREE(_res);
17130         CVec_RecentPaymentDetailsZ_free(_res_constr);
17131 }
17132
17133 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
17134         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17135         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
17136         return tag_ptr(ret_conv, true);
17137 }
17138
17139 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
17140         void* e_ptr = untag_ptr(e);
17141         CHECK_ACCESS(e_ptr);
17142         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17143         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17144         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17145         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
17146         return tag_ptr(ret_conv, true);
17147 }
17148
17149 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
17150         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
17151         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
17152         return ret_conv;
17153 }
17154
17155 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
17156         if (!ptr_is_owned(_res)) return;
17157         void* _res_ptr = untag_ptr(_res);
17158         CHECK_ACCESS(_res_ptr);
17159         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
17160         FREE(untag_ptr(_res));
17161         CResult_NonePaymentSendFailureZ_free(_res_conv);
17162 }
17163
17164 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
17165         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17166         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
17167         return tag_ptr(ret_conv, true);
17168 }
17169 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
17170         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
17171         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
17172         return ret_conv;
17173 }
17174
17175 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
17176         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
17177         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17178         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
17179         return tag_ptr(ret_conv, true);
17180 }
17181
17182 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
17183         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17184         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
17185         return tag_ptr(ret_conv, true);
17186 }
17187
17188 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
17189         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
17190         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17191         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
17192         return tag_ptr(ret_conv, true);
17193 }
17194
17195 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
17196         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
17197         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
17198         return ret_conv;
17199 }
17200
17201 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
17202         if (!ptr_is_owned(_res)) return;
17203         void* _res_ptr = untag_ptr(_res);
17204         CHECK_ACCESS(_res_ptr);
17205         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
17206         FREE(untag_ptr(_res));
17207         CResult_NoneRetryableSendFailureZ_free(_res_conv);
17208 }
17209
17210 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
17211         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17212         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
17213         return tag_ptr(ret_conv, true);
17214 }
17215 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
17216         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
17217         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
17218         return ret_conv;
17219 }
17220
17221 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
17222         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
17223         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17224         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
17225         return tag_ptr(ret_conv, true);
17226 }
17227
17228 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
17229         LDKThirtyTwoBytes o_ref;
17230         CHECK(o->arr_len == 32);
17231         memcpy(o_ref.data, o->elems, 32); FREE(o);
17232         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17233         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
17234         return tag_ptr(ret_conv, true);
17235 }
17236
17237 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
17238         void* e_ptr = untag_ptr(e);
17239         CHECK_ACCESS(e_ptr);
17240         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17241         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17242         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17243         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
17244         return tag_ptr(ret_conv, true);
17245 }
17246
17247 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
17248         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
17249         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
17250         return ret_conv;
17251 }
17252
17253 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
17254         if (!ptr_is_owned(_res)) return;
17255         void* _res_ptr = untag_ptr(_res);
17256         CHECK_ACCESS(_res_ptr);
17257         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
17258         FREE(untag_ptr(_res));
17259         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
17260 }
17261
17262 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
17263         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17264         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
17265         return tag_ptr(ret_conv, true);
17266 }
17267 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
17268         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
17269         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
17270         return ret_conv;
17271 }
17272
17273 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
17274         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
17275         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17276         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
17277         return tag_ptr(ret_conv, true);
17278 }
17279
17280 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_ok(int8_tArray o) {
17281         LDKThirtyTwoBytes o_ref;
17282         CHECK(o->arr_len == 32);
17283         memcpy(o_ref.data, o->elems, 32); FREE(o);
17284         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17285         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
17286         return tag_ptr(ret_conv, true);
17287 }
17288
17289 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_err(uint32_t e) {
17290         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
17291         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17292         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
17293         return tag_ptr(ret_conv, true);
17294 }
17295
17296 jboolean  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_is_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_is_ok(uint64_t o) {
17297         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
17298         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
17299         return ret_conv;
17300 }
17301
17302 void  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_free"))) TS_CResult_PaymentHashRetryableSendFailureZ_free(uint64_t _res) {
17303         if (!ptr_is_owned(_res)) return;
17304         void* _res_ptr = untag_ptr(_res);
17305         CHECK_ACCESS(_res_ptr);
17306         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
17307         FREE(untag_ptr(_res));
17308         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
17309 }
17310
17311 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
17312         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17313         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
17314         return tag_ptr(ret_conv, true);
17315 }
17316 int64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr(uint64_t arg) {
17317         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
17318         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
17319         return ret_conv;
17320 }
17321
17322 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone(uint64_t orig) {
17323         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
17324         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17325         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
17326         return tag_ptr(ret_conv, true);
17327 }
17328
17329 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
17330         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17331         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
17332         return tag_ptr(ret_conv, true);
17333 }
17334 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
17335         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
17336         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
17337         return ret_conv;
17338 }
17339
17340 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
17341         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
17342         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17343         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
17344         return tag_ptr(ret_conv, true);
17345 }
17346
17347 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
17348         LDKThirtyTwoBytes a_ref;
17349         CHECK(a->arr_len == 32);
17350         memcpy(a_ref.data, a->elems, 32); FREE(a);
17351         LDKThirtyTwoBytes b_ref;
17352         CHECK(b->arr_len == 32);
17353         memcpy(b_ref.data, b->elems, 32); FREE(b);
17354         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17355         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
17356         return tag_ptr(ret_conv, true);
17357 }
17358
17359 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
17360         if (!ptr_is_owned(_res)) return;
17361         void* _res_ptr = untag_ptr(_res);
17362         CHECK_ACCESS(_res_ptr);
17363         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
17364         FREE(untag_ptr(_res));
17365         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
17366 }
17367
17368 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
17369         void* o_ptr = untag_ptr(o);
17370         CHECK_ACCESS(o_ptr);
17371         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
17372         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
17373         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17374         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
17375         return tag_ptr(ret_conv, true);
17376 }
17377
17378 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
17379         void* e_ptr = untag_ptr(e);
17380         CHECK_ACCESS(e_ptr);
17381         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17382         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17383         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17384         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
17385         return tag_ptr(ret_conv, true);
17386 }
17387
17388 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
17389         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
17390         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
17391         return ret_conv;
17392 }
17393
17394 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
17395         if (!ptr_is_owned(_res)) return;
17396         void* _res_ptr = untag_ptr(_res);
17397         CHECK_ACCESS(_res_ptr);
17398         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
17399         FREE(untag_ptr(_res));
17400         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
17401 }
17402
17403 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
17404         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17405         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
17406         return tag_ptr(ret_conv, true);
17407 }
17408 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
17409         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
17410         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
17411         return ret_conv;
17412 }
17413
17414 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
17415         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
17416         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17417         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
17418         return tag_ptr(ret_conv, true);
17419 }
17420
17421 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
17422         LDKCVec_ThirtyTwoBytesZ _res_constr;
17423         _res_constr.datalen = _res->arr_len;
17424         if (_res_constr.datalen > 0)
17425                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17426         else
17427                 _res_constr.data = NULL;
17428         int8_tArray* _res_vals = (void*) _res->elems;
17429         for (size_t m = 0; m < _res_constr.datalen; m++) {
17430                 int8_tArray _res_conv_12 = _res_vals[m];
17431                 LDKThirtyTwoBytes _res_conv_12_ref;
17432                 CHECK(_res_conv_12->arr_len == 32);
17433                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
17434                 _res_constr.data[m] = _res_conv_12_ref;
17435         }
17436         FREE(_res);
17437         CVec_ThirtyTwoBytesZ_free(_res_constr);
17438 }
17439
17440 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
17441         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17442         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
17443         return tag_ptr(ret_conv, true);
17444 }
17445 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
17446         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
17447         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
17448         return ret_conv;
17449 }
17450
17451 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
17452         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
17453         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17454         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
17455         return tag_ptr(ret_conv, true);
17456 }
17457
17458 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
17459         LDKThirtyTwoBytes a_ref;
17460         CHECK(a->arr_len == 32);
17461         memcpy(a_ref.data, a->elems, 32); FREE(a);
17462         LDKThirtyTwoBytes b_ref;
17463         CHECK(b->arr_len == 32);
17464         memcpy(b_ref.data, b->elems, 32); FREE(b);
17465         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17466         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
17467         return tag_ptr(ret_conv, true);
17468 }
17469
17470 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
17471         if (!ptr_is_owned(_res)) return;
17472         void* _res_ptr = untag_ptr(_res);
17473         CHECK_ACCESS(_res_ptr);
17474         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
17475         FREE(untag_ptr(_res));
17476         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
17477 }
17478
17479 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
17480         void* o_ptr = untag_ptr(o);
17481         CHECK_ACCESS(o_ptr);
17482         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17483         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
17484         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17485         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
17486         return tag_ptr(ret_conv, true);
17487 }
17488
17489 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
17490         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17491         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
17492         return tag_ptr(ret_conv, true);
17493 }
17494
17495 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
17496         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
17497         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
17498         return ret_conv;
17499 }
17500
17501 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
17502         if (!ptr_is_owned(_res)) return;
17503         void* _res_ptr = untag_ptr(_res);
17504         CHECK_ACCESS(_res_ptr);
17505         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
17506         FREE(untag_ptr(_res));
17507         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
17508 }
17509
17510 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
17511         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17512         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
17513         return tag_ptr(ret_conv, true);
17514 }
17515 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
17516         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
17517         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
17518         return ret_conv;
17519 }
17520
17521 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
17522         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
17523         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17524         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
17525         return tag_ptr(ret_conv, true);
17526 }
17527
17528 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
17529         void* o_ptr = untag_ptr(o);
17530         CHECK_ACCESS(o_ptr);
17531         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17532         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
17533         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17534         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
17535         return tag_ptr(ret_conv, true);
17536 }
17537
17538 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
17539         void* e_ptr = untag_ptr(e);
17540         CHECK_ACCESS(e_ptr);
17541         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17542         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17543         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17544         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
17545         return tag_ptr(ret_conv, true);
17546 }
17547
17548 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
17549         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
17550         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
17551         return ret_conv;
17552 }
17553
17554 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
17555         if (!ptr_is_owned(_res)) return;
17556         void* _res_ptr = untag_ptr(_res);
17557         CHECK_ACCESS(_res_ptr);
17558         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
17559         FREE(untag_ptr(_res));
17560         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
17561 }
17562
17563 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
17564         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17565         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
17566         return tag_ptr(ret_conv, true);
17567 }
17568 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
17569         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
17570         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
17571         return ret_conv;
17572 }
17573
17574 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
17575         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
17576         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17577         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
17578         return tag_ptr(ret_conv, true);
17579 }
17580
17581 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
17582         LDKThirtyTwoBytes o_ref;
17583         CHECK(o->arr_len == 32);
17584         memcpy(o_ref.data, o->elems, 32); FREE(o);
17585         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17586         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
17587         return tag_ptr(ret_conv, true);
17588 }
17589
17590 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
17591         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17592         *ret_conv = CResult_PaymentSecretNoneZ_err();
17593         return tag_ptr(ret_conv, true);
17594 }
17595
17596 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
17597         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
17598         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
17599         return ret_conv;
17600 }
17601
17602 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
17603         if (!ptr_is_owned(_res)) return;
17604         void* _res_ptr = untag_ptr(_res);
17605         CHECK_ACCESS(_res_ptr);
17606         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
17607         FREE(untag_ptr(_res));
17608         CResult_PaymentSecretNoneZ_free(_res_conv);
17609 }
17610
17611 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
17612         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17613         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
17614         return tag_ptr(ret_conv, true);
17615 }
17616 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
17617         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
17618         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
17619         return ret_conv;
17620 }
17621
17622 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
17623         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
17624         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17625         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
17626         return tag_ptr(ret_conv, true);
17627 }
17628
17629 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
17630         LDKThirtyTwoBytes o_ref;
17631         CHECK(o->arr_len == 32);
17632         memcpy(o_ref.data, o->elems, 32); FREE(o);
17633         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17634         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
17635         return tag_ptr(ret_conv, true);
17636 }
17637
17638 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
17639         void* e_ptr = untag_ptr(e);
17640         CHECK_ACCESS(e_ptr);
17641         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17642         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17643         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17644         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
17645         return tag_ptr(ret_conv, true);
17646 }
17647
17648 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
17649         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
17650         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
17651         return ret_conv;
17652 }
17653
17654 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
17655         if (!ptr_is_owned(_res)) return;
17656         void* _res_ptr = untag_ptr(_res);
17657         CHECK_ACCESS(_res_ptr);
17658         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
17659         FREE(untag_ptr(_res));
17660         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
17661 }
17662
17663 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
17664         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17665         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
17666         return tag_ptr(ret_conv, true);
17667 }
17668 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
17669         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
17670         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
17671         return ret_conv;
17672 }
17673
17674 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
17675         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
17676         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17677         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
17678         return tag_ptr(ret_conv, true);
17679 }
17680
17681 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
17682         LDKThirtyTwoBytes o_ref;
17683         CHECK(o->arr_len == 32);
17684         memcpy(o_ref.data, o->elems, 32); FREE(o);
17685         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17686         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
17687         return tag_ptr(ret_conv, true);
17688 }
17689
17690 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
17691         void* e_ptr = untag_ptr(e);
17692         CHECK_ACCESS(e_ptr);
17693         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17694         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17695         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17696         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17697         return tag_ptr(ret_conv, true);
17698 }
17699
17700 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
17701         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
17702         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17703         return ret_conv;
17704 }
17705
17706 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
17707         if (!ptr_is_owned(_res)) return;
17708         void* _res_ptr = untag_ptr(_res);
17709         CHECK_ACCESS(_res_ptr);
17710         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17711         FREE(untag_ptr(_res));
17712         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17713 }
17714
17715 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17716         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17717         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17718         return tag_ptr(ret_conv, true);
17719 }
17720 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
17721         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
17722         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17723         return ret_conv;
17724 }
17725
17726 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
17727         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
17728         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17729         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17730         return tag_ptr(ret_conv, true);
17731 }
17732
17733 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
17734         LDKCounterpartyForwardingInfo o_conv;
17735         o_conv.inner = untag_ptr(o);
17736         o_conv.is_owned = ptr_is_owned(o);
17737         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17738         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17739         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17740         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17741         return tag_ptr(ret_conv, true);
17742 }
17743
17744 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
17745         void* e_ptr = untag_ptr(e);
17746         CHECK_ACCESS(e_ptr);
17747         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17748         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17749         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17750         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17751         return tag_ptr(ret_conv, true);
17752 }
17753
17754 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
17755         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
17756         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17757         return ret_conv;
17758 }
17759
17760 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
17761         if (!ptr_is_owned(_res)) return;
17762         void* _res_ptr = untag_ptr(_res);
17763         CHECK_ACCESS(_res_ptr);
17764         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17765         FREE(untag_ptr(_res));
17766         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17767 }
17768
17769 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17770         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17771         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17772         return tag_ptr(ret_conv, true);
17773 }
17774 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17775         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
17776         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17777         return ret_conv;
17778 }
17779
17780 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
17781         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
17782         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17783         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17784         return tag_ptr(ret_conv, true);
17785 }
17786
17787 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
17788         LDKChannelCounterparty o_conv;
17789         o_conv.inner = untag_ptr(o);
17790         o_conv.is_owned = ptr_is_owned(o);
17791         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17792         o_conv = ChannelCounterparty_clone(&o_conv);
17793         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17794         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17795         return tag_ptr(ret_conv, true);
17796 }
17797
17798 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
17799         void* e_ptr = untag_ptr(e);
17800         CHECK_ACCESS(e_ptr);
17801         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17802         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17803         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17804         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17805         return tag_ptr(ret_conv, true);
17806 }
17807
17808 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
17809         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
17810         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17811         return ret_conv;
17812 }
17813
17814 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
17815         if (!ptr_is_owned(_res)) return;
17816         void* _res_ptr = untag_ptr(_res);
17817         CHECK_ACCESS(_res_ptr);
17818         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
17819         FREE(untag_ptr(_res));
17820         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
17821 }
17822
17823 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
17824         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17825         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
17826         return tag_ptr(ret_conv, true);
17827 }
17828 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
17829         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
17830         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
17831         return ret_conv;
17832 }
17833
17834 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
17835         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
17836         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17837         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
17838         return tag_ptr(ret_conv, true);
17839 }
17840
17841 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
17842         LDKChannelDetails o_conv;
17843         o_conv.inner = untag_ptr(o);
17844         o_conv.is_owned = ptr_is_owned(o);
17845         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17846         o_conv = ChannelDetails_clone(&o_conv);
17847         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17848         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
17849         return tag_ptr(ret_conv, true);
17850 }
17851
17852 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
17853         void* e_ptr = untag_ptr(e);
17854         CHECK_ACCESS(e_ptr);
17855         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17856         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17857         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17858         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
17859         return tag_ptr(ret_conv, true);
17860 }
17861
17862 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
17863         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
17864         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
17865         return ret_conv;
17866 }
17867
17868 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
17869         if (!ptr_is_owned(_res)) return;
17870         void* _res_ptr = untag_ptr(_res);
17871         CHECK_ACCESS(_res_ptr);
17872         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
17873         FREE(untag_ptr(_res));
17874         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
17875 }
17876
17877 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
17878         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17879         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
17880         return tag_ptr(ret_conv, true);
17881 }
17882 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
17883         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
17884         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
17885         return ret_conv;
17886 }
17887
17888 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
17889         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
17890         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17891         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
17892         return tag_ptr(ret_conv, true);
17893 }
17894
17895 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
17896         LDKPhantomRouteHints o_conv;
17897         o_conv.inner = untag_ptr(o);
17898         o_conv.is_owned = ptr_is_owned(o);
17899         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17900         o_conv = PhantomRouteHints_clone(&o_conv);
17901         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17902         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
17903         return tag_ptr(ret_conv, true);
17904 }
17905
17906 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
17907         void* e_ptr = untag_ptr(e);
17908         CHECK_ACCESS(e_ptr);
17909         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17910         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17911         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17912         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
17913         return tag_ptr(ret_conv, true);
17914 }
17915
17916 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
17917         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
17918         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
17919         return ret_conv;
17920 }
17921
17922 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
17923         if (!ptr_is_owned(_res)) return;
17924         void* _res_ptr = untag_ptr(_res);
17925         CHECK_ACCESS(_res_ptr);
17926         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
17927         FREE(untag_ptr(_res));
17928         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
17929 }
17930
17931 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
17932         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17933         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
17934         return tag_ptr(ret_conv, true);
17935 }
17936 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
17937         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
17938         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
17939         return ret_conv;
17940 }
17941
17942 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
17943         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
17944         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17945         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
17946         return tag_ptr(ret_conv, true);
17947 }
17948
17949 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
17950         LDKCVec_ChannelMonitorZ _res_constr;
17951         _res_constr.datalen = _res->arr_len;
17952         if (_res_constr.datalen > 0)
17953                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17954         else
17955                 _res_constr.data = NULL;
17956         uint64_t* _res_vals = _res->elems;
17957         for (size_t q = 0; q < _res_constr.datalen; q++) {
17958                 uint64_t _res_conv_16 = _res_vals[q];
17959                 LDKChannelMonitor _res_conv_16_conv;
17960                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17961                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17962                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17963                 _res_constr.data[q] = _res_conv_16_conv;
17964         }
17965         FREE(_res);
17966         CVec_ChannelMonitorZ_free(_res_constr);
17967 }
17968
17969 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
17970         LDKThirtyTwoBytes a_ref;
17971         CHECK(a->arr_len == 32);
17972         memcpy(a_ref.data, a->elems, 32); FREE(a);
17973         LDKChannelManager b_conv;
17974         b_conv.inner = untag_ptr(b);
17975         b_conv.is_owned = ptr_is_owned(b);
17976         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17977         // WARNING: we need a move here but no clone is available for LDKChannelManager
17978         
17979         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
17980         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
17981         return tag_ptr(ret_conv, true);
17982 }
17983
17984 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
17985         if (!ptr_is_owned(_res)) return;
17986         void* _res_ptr = untag_ptr(_res);
17987         CHECK_ACCESS(_res_ptr);
17988         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
17989         FREE(untag_ptr(_res));
17990         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
17991 }
17992
17993 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
17994         void* o_ptr = untag_ptr(o);
17995         CHECK_ACCESS(o_ptr);
17996         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
17997         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
17998         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17999         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
18000         return tag_ptr(ret_conv, true);
18001 }
18002
18003 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
18004         void* e_ptr = untag_ptr(e);
18005         CHECK_ACCESS(e_ptr);
18006         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18007         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18008         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18009         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
18010         return tag_ptr(ret_conv, true);
18011 }
18012
18013 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
18014         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
18015         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
18016         return ret_conv;
18017 }
18018
18019 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
18020         if (!ptr_is_owned(_res)) return;
18021         void* _res_ptr = untag_ptr(_res);
18022         CHECK_ACCESS(_res_ptr);
18023         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
18024         FREE(untag_ptr(_res));
18025         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
18026 }
18027
18028 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
18029         LDKChannelConfig o_conv;
18030         o_conv.inner = untag_ptr(o);
18031         o_conv.is_owned = ptr_is_owned(o);
18032         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18033         o_conv = ChannelConfig_clone(&o_conv);
18034         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18035         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
18036         return tag_ptr(ret_conv, true);
18037 }
18038
18039 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
18040         void* e_ptr = untag_ptr(e);
18041         CHECK_ACCESS(e_ptr);
18042         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18043         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18044         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18045         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
18046         return tag_ptr(ret_conv, true);
18047 }
18048
18049 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
18050         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
18051         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
18052         return ret_conv;
18053 }
18054
18055 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
18056         if (!ptr_is_owned(_res)) return;
18057         void* _res_ptr = untag_ptr(_res);
18058         CHECK_ACCESS(_res_ptr);
18059         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
18060         FREE(untag_ptr(_res));
18061         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
18062 }
18063
18064 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
18065         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18066         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
18067         return tag_ptr(ret_conv, true);
18068 }
18069 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
18070         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
18071         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
18072         return ret_conv;
18073 }
18074
18075 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
18076         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
18077         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18078         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
18079         return tag_ptr(ret_conv, true);
18080 }
18081
18082 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
18083         void* o_ptr = untag_ptr(o);
18084         CHECK_ACCESS(o_ptr);
18085         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
18086         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
18087         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18088         *ret_copy = COption_APIErrorZ_some(o_conv);
18089         uint64_t ret_ref = tag_ptr(ret_copy, true);
18090         return ret_ref;
18091 }
18092
18093 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
18094         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18095         *ret_copy = COption_APIErrorZ_none();
18096         uint64_t ret_ref = tag_ptr(ret_copy, true);
18097         return ret_ref;
18098 }
18099
18100 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
18101         if (!ptr_is_owned(_res)) return;
18102         void* _res_ptr = untag_ptr(_res);
18103         CHECK_ACCESS(_res_ptr);
18104         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
18105         FREE(untag_ptr(_res));
18106         COption_APIErrorZ_free(_res_conv);
18107 }
18108
18109 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
18110         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18111         *ret_copy = COption_APIErrorZ_clone(arg);
18112         uint64_t ret_ref = tag_ptr(ret_copy, true);
18113         return ret_ref;
18114 }
18115 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
18116         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
18117         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
18118         return ret_conv;
18119 }
18120
18121 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
18122         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
18123         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18124         *ret_copy = COption_APIErrorZ_clone(orig_conv);
18125         uint64_t ret_ref = tag_ptr(ret_copy, true);
18126         return ret_ref;
18127 }
18128
18129 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
18130         void* o_ptr = untag_ptr(o);
18131         CHECK_ACCESS(o_ptr);
18132         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
18133         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
18134         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18135         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
18136         return tag_ptr(ret_conv, true);
18137 }
18138
18139 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
18140         void* e_ptr = untag_ptr(e);
18141         CHECK_ACCESS(e_ptr);
18142         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18143         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18144         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18145         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
18146         return tag_ptr(ret_conv, true);
18147 }
18148
18149 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
18150         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
18151         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
18152         return ret_conv;
18153 }
18154
18155 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
18156         if (!ptr_is_owned(_res)) return;
18157         void* _res_ptr = untag_ptr(_res);
18158         CHECK_ACCESS(_res_ptr);
18159         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
18160         FREE(untag_ptr(_res));
18161         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
18162 }
18163
18164 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
18165         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18166         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
18167         return tag_ptr(ret_conv, true);
18168 }
18169 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18170         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
18171         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
18172         return ret_conv;
18173 }
18174
18175 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
18176         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
18177         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18178         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
18179         return tag_ptr(ret_conv, true);
18180 }
18181
18182 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
18183         LDKUntrustedString o_conv;
18184         o_conv.inner = untag_ptr(o);
18185         o_conv.is_owned = ptr_is_owned(o);
18186         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18187         o_conv = UntrustedString_clone(&o_conv);
18188         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18189         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
18190         return tag_ptr(ret_conv, true);
18191 }
18192
18193 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
18194         void* e_ptr = untag_ptr(e);
18195         CHECK_ACCESS(e_ptr);
18196         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18197         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18198         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18199         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
18200         return tag_ptr(ret_conv, true);
18201 }
18202
18203 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
18204         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
18205         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
18206         return ret_conv;
18207 }
18208
18209 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
18210         if (!ptr_is_owned(_res)) return;
18211         void* _res_ptr = untag_ptr(_res);
18212         CHECK_ACCESS(_res_ptr);
18213         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
18214         FREE(untag_ptr(_res));
18215         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
18216 }
18217
18218 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
18219         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18220         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
18221         return tag_ptr(ret_conv, true);
18222 }
18223 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
18224         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
18225         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
18226         return ret_conv;
18227 }
18228
18229 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
18230         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
18231         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18232         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
18233         return tag_ptr(ret_conv, true);
18234 }
18235
18236 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
18237         LDKOutPoint o_conv;
18238         o_conv.inner = untag_ptr(o);
18239         o_conv.is_owned = ptr_is_owned(o);
18240         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18241         o_conv = OutPoint_clone(&o_conv);
18242         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18243         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
18244         return tag_ptr(ret_conv, true);
18245 }
18246
18247 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
18248         void* e_ptr = untag_ptr(e);
18249         CHECK_ACCESS(e_ptr);
18250         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18251         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18252         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18253         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
18254         return tag_ptr(ret_conv, true);
18255 }
18256
18257 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
18258         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
18259         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
18260         return ret_conv;
18261 }
18262
18263 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
18264         if (!ptr_is_owned(_res)) return;
18265         void* _res_ptr = untag_ptr(_res);
18266         CHECK_ACCESS(_res_ptr);
18267         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
18268         FREE(untag_ptr(_res));
18269         CResult_OutPointDecodeErrorZ_free(_res_conv);
18270 }
18271
18272 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
18273         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18274         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
18275         return tag_ptr(ret_conv, true);
18276 }
18277 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
18278         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
18279         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
18280         return ret_conv;
18281 }
18282
18283 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
18284         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
18285         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18286         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
18287         return tag_ptr(ret_conv, true);
18288 }
18289
18290 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
18291         void* o_ptr = untag_ptr(o);
18292         CHECK_ACCESS(o_ptr);
18293         LDKType o_conv = *(LDKType*)(o_ptr);
18294         if (o_conv.free == LDKType_JCalls_free) {
18295                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18296                 LDKType_JCalls_cloned(&o_conv);
18297         }
18298         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18299         *ret_copy = COption_TypeZ_some(o_conv);
18300         uint64_t ret_ref = tag_ptr(ret_copy, true);
18301         return ret_ref;
18302 }
18303
18304 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
18305         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18306         *ret_copy = COption_TypeZ_none();
18307         uint64_t ret_ref = tag_ptr(ret_copy, true);
18308         return ret_ref;
18309 }
18310
18311 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
18312         if (!ptr_is_owned(_res)) return;
18313         void* _res_ptr = untag_ptr(_res);
18314         CHECK_ACCESS(_res_ptr);
18315         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
18316         FREE(untag_ptr(_res));
18317         COption_TypeZ_free(_res_conv);
18318 }
18319
18320 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
18321         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18322         *ret_copy = COption_TypeZ_clone(arg);
18323         uint64_t ret_ref = tag_ptr(ret_copy, true);
18324         return ret_ref;
18325 }
18326 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
18327         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
18328         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
18329         return ret_conv;
18330 }
18331
18332 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
18333         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
18334         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18335         *ret_copy = COption_TypeZ_clone(orig_conv);
18336         uint64_t ret_ref = tag_ptr(ret_copy, true);
18337         return ret_ref;
18338 }
18339
18340 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
18341         void* o_ptr = untag_ptr(o);
18342         CHECK_ACCESS(o_ptr);
18343         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
18344         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
18345         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18346         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
18347         return tag_ptr(ret_conv, true);
18348 }
18349
18350 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
18351         void* e_ptr = untag_ptr(e);
18352         CHECK_ACCESS(e_ptr);
18353         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18354         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18355         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18356         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
18357         return tag_ptr(ret_conv, true);
18358 }
18359
18360 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
18361         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
18362         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
18363         return ret_conv;
18364 }
18365
18366 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
18367         if (!ptr_is_owned(_res)) return;
18368         void* _res_ptr = untag_ptr(_res);
18369         CHECK_ACCESS(_res_ptr);
18370         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
18371         FREE(untag_ptr(_res));
18372         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
18373 }
18374
18375 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
18376         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18377         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
18378         return tag_ptr(ret_conv, true);
18379 }
18380 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
18381         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
18382         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
18383         return ret_conv;
18384 }
18385
18386 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
18387         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
18388         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18389         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
18390         return tag_ptr(ret_conv, true);
18391 }
18392
18393 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
18394         LDKThirtyTwoBytes o_ref;
18395         CHECK(o->arr_len == 32);
18396         memcpy(o_ref.data, o->elems, 32); FREE(o);
18397         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18398         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
18399         return tag_ptr(ret_conv, true);
18400 }
18401
18402 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
18403         void* e_ptr = untag_ptr(e);
18404         CHECK_ACCESS(e_ptr);
18405         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18406         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
18407         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18408         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
18409         return tag_ptr(ret_conv, true);
18410 }
18411
18412 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
18413         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
18414         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
18415         return ret_conv;
18416 }
18417
18418 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
18419         if (!ptr_is_owned(_res)) return;
18420         void* _res_ptr = untag_ptr(_res);
18421         CHECK_ACCESS(_res_ptr);
18422         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
18423         FREE(untag_ptr(_res));
18424         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
18425 }
18426
18427 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
18428         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18429         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
18430         return tag_ptr(ret_conv, true);
18431 }
18432 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
18433         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
18434         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
18435         return ret_conv;
18436 }
18437
18438 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
18439         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
18440         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18441         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
18442         return tag_ptr(ret_conv, true);
18443 }
18444
18445 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
18446         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18447         *ret_conv = CResult_NonePaymentErrorZ_ok();
18448         return tag_ptr(ret_conv, true);
18449 }
18450
18451 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
18452         void* e_ptr = untag_ptr(e);
18453         CHECK_ACCESS(e_ptr);
18454         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18455         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
18456         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18457         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
18458         return tag_ptr(ret_conv, true);
18459 }
18460
18461 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
18462         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
18463         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
18464         return ret_conv;
18465 }
18466
18467 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
18468         if (!ptr_is_owned(_res)) return;
18469         void* _res_ptr = untag_ptr(_res);
18470         CHECK_ACCESS(_res_ptr);
18471         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
18472         FREE(untag_ptr(_res));
18473         CResult_NonePaymentErrorZ_free(_res_conv);
18474 }
18475
18476 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
18477         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18478         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
18479         return tag_ptr(ret_conv, true);
18480 }
18481 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
18482         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
18483         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
18484         return ret_conv;
18485 }
18486
18487 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
18488         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
18489         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18490         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
18491         return tag_ptr(ret_conv, true);
18492 }
18493
18494 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
18495         LDKStr o_conv = str_ref_to_owned_c(o);
18496         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18497         *ret_conv = CResult_StringErrorZ_ok(o_conv);
18498         return tag_ptr(ret_conv, true);
18499 }
18500
18501 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
18502         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
18503         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18504         *ret_conv = CResult_StringErrorZ_err(e_conv);
18505         return tag_ptr(ret_conv, true);
18506 }
18507
18508 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
18509         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
18510         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
18511         return ret_conv;
18512 }
18513
18514 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
18515         if (!ptr_is_owned(_res)) return;
18516         void* _res_ptr = untag_ptr(_res);
18517         CHECK_ACCESS(_res_ptr);
18518         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
18519         FREE(untag_ptr(_res));
18520         CResult_StringErrorZ_free(_res_conv);
18521 }
18522
18523 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
18524         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18525         *ret_conv = CResult_StringErrorZ_clone(arg);
18526         return tag_ptr(ret_conv, true);
18527 }
18528 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
18529         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
18530         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
18531         return ret_conv;
18532 }
18533
18534 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
18535         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
18536         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18537         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
18538         return tag_ptr(ret_conv, true);
18539 }
18540
18541 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
18542         LDKChannelMonitorUpdate o_conv;
18543         o_conv.inner = untag_ptr(o);
18544         o_conv.is_owned = ptr_is_owned(o);
18545         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18546         o_conv = ChannelMonitorUpdate_clone(&o_conv);
18547         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18548         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
18549         return tag_ptr(ret_conv, true);
18550 }
18551
18552 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
18553         void* e_ptr = untag_ptr(e);
18554         CHECK_ACCESS(e_ptr);
18555         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18556         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18557         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18558         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
18559         return tag_ptr(ret_conv, true);
18560 }
18561
18562 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
18563         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
18564         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
18565         return ret_conv;
18566 }
18567
18568 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
18569         if (!ptr_is_owned(_res)) return;
18570         void* _res_ptr = untag_ptr(_res);
18571         CHECK_ACCESS(_res_ptr);
18572         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
18573         FREE(untag_ptr(_res));
18574         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
18575 }
18576
18577 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
18578         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18579         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
18580         return tag_ptr(ret_conv, true);
18581 }
18582 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18583         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
18584         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
18585         return ret_conv;
18586 }
18587
18588 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
18589         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
18590         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18591         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
18592         return tag_ptr(ret_conv, true);
18593 }
18594
18595 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
18596         void* o_ptr = untag_ptr(o);
18597         CHECK_ACCESS(o_ptr);
18598         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
18599         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
18600         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18601         *ret_copy = COption_MonitorEventZ_some(o_conv);
18602         uint64_t ret_ref = tag_ptr(ret_copy, true);
18603         return ret_ref;
18604 }
18605
18606 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
18607         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18608         *ret_copy = COption_MonitorEventZ_none();
18609         uint64_t ret_ref = tag_ptr(ret_copy, true);
18610         return ret_ref;
18611 }
18612
18613 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
18614         if (!ptr_is_owned(_res)) return;
18615         void* _res_ptr = untag_ptr(_res);
18616         CHECK_ACCESS(_res_ptr);
18617         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
18618         FREE(untag_ptr(_res));
18619         COption_MonitorEventZ_free(_res_conv);
18620 }
18621
18622 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
18623         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18624         *ret_copy = COption_MonitorEventZ_clone(arg);
18625         uint64_t ret_ref = tag_ptr(ret_copy, true);
18626         return ret_ref;
18627 }
18628 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
18629         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
18630         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
18631         return ret_conv;
18632 }
18633
18634 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
18635         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
18636         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18637         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
18638         uint64_t ret_ref = tag_ptr(ret_copy, true);
18639         return ret_ref;
18640 }
18641
18642 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
18643         void* o_ptr = untag_ptr(o);
18644         CHECK_ACCESS(o_ptr);
18645         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
18646         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
18647         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18648         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
18649         return tag_ptr(ret_conv, true);
18650 }
18651
18652 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
18653         void* e_ptr = untag_ptr(e);
18654         CHECK_ACCESS(e_ptr);
18655         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18656         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18657         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18658         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
18659         return tag_ptr(ret_conv, true);
18660 }
18661
18662 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
18663         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
18664         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
18665         return ret_conv;
18666 }
18667
18668 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
18669         if (!ptr_is_owned(_res)) return;
18670         void* _res_ptr = untag_ptr(_res);
18671         CHECK_ACCESS(_res_ptr);
18672         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
18673         FREE(untag_ptr(_res));
18674         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
18675 }
18676
18677 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
18678         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18679         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
18680         return tag_ptr(ret_conv, true);
18681 }
18682 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
18683         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
18684         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
18685         return ret_conv;
18686 }
18687
18688 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
18689         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
18690         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18691         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
18692         return tag_ptr(ret_conv, true);
18693 }
18694
18695 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
18696         LDKHTLCUpdate o_conv;
18697         o_conv.inner = untag_ptr(o);
18698         o_conv.is_owned = ptr_is_owned(o);
18699         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18700         o_conv = HTLCUpdate_clone(&o_conv);
18701         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18702         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
18703         return tag_ptr(ret_conv, true);
18704 }
18705
18706 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
18707         void* e_ptr = untag_ptr(e);
18708         CHECK_ACCESS(e_ptr);
18709         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18710         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18711         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18712         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
18713         return tag_ptr(ret_conv, true);
18714 }
18715
18716 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
18717         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
18718         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
18719         return ret_conv;
18720 }
18721
18722 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
18723         if (!ptr_is_owned(_res)) return;
18724         void* _res_ptr = untag_ptr(_res);
18725         CHECK_ACCESS(_res_ptr);
18726         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
18727         FREE(untag_ptr(_res));
18728         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
18729 }
18730
18731 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
18732         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18733         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
18734         return tag_ptr(ret_conv, true);
18735 }
18736 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18737         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
18738         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
18739         return ret_conv;
18740 }
18741
18742 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
18743         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
18744         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18745         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
18746         return tag_ptr(ret_conv, true);
18747 }
18748
18749 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
18750         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18751         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
18752         return tag_ptr(ret_conv, true);
18753 }
18754 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
18755         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
18756         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
18757         return ret_conv;
18758 }
18759
18760 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
18761         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
18762         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18763         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
18764         return tag_ptr(ret_conv, true);
18765 }
18766
18767 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
18768         LDKOutPoint a_conv;
18769         a_conv.inner = untag_ptr(a);
18770         a_conv.is_owned = ptr_is_owned(a);
18771         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18772         a_conv = OutPoint_clone(&a_conv);
18773         LDKCVec_u8Z b_ref;
18774         b_ref.datalen = b->arr_len;
18775         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18776         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18777         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18778         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
18779         return tag_ptr(ret_conv, true);
18780 }
18781
18782 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
18783         if (!ptr_is_owned(_res)) return;
18784         void* _res_ptr = untag_ptr(_res);
18785         CHECK_ACCESS(_res_ptr);
18786         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
18787         FREE(untag_ptr(_res));
18788         C2Tuple_OutPointScriptZ_free(_res_conv);
18789 }
18790
18791 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
18792         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18793         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
18794         return tag_ptr(ret_conv, true);
18795 }
18796 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
18797         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
18798         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
18799         return ret_conv;
18800 }
18801
18802 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
18803         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
18804         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18805         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
18806         return tag_ptr(ret_conv, true);
18807 }
18808
18809 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
18810         LDKCVec_u8Z b_ref;
18811         b_ref.datalen = b->arr_len;
18812         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18813         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18814         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18815         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
18816         return tag_ptr(ret_conv, true);
18817 }
18818
18819 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
18820         if (!ptr_is_owned(_res)) return;
18821         void* _res_ptr = untag_ptr(_res);
18822         CHECK_ACCESS(_res_ptr);
18823         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
18824         FREE(untag_ptr(_res));
18825         C2Tuple_u32ScriptZ_free(_res_conv);
18826 }
18827
18828 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
18829         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
18830         _res_constr.datalen = _res->arr_len;
18831         if (_res_constr.datalen > 0)
18832                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18833         else
18834                 _res_constr.data = NULL;
18835         uint64_t* _res_vals = _res->elems;
18836         for (size_t v = 0; v < _res_constr.datalen; v++) {
18837                 uint64_t _res_conv_21 = _res_vals[v];
18838                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
18839                 CHECK_ACCESS(_res_conv_21_ptr);
18840                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
18841                 FREE(untag_ptr(_res_conv_21));
18842                 _res_constr.data[v] = _res_conv_21_conv;
18843         }
18844         FREE(_res);
18845         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
18846 }
18847
18848 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
18849         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18850         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
18851         return tag_ptr(ret_conv, true);
18852 }
18853 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
18854         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
18855         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
18856         return ret_conv;
18857 }
18858
18859 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
18860         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
18861         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18862         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
18863         return tag_ptr(ret_conv, true);
18864 }
18865
18866 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
18867         LDKThirtyTwoBytes a_ref;
18868         CHECK(a->arr_len == 32);
18869         memcpy(a_ref.data, a->elems, 32); FREE(a);
18870         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
18871         b_constr.datalen = b->arr_len;
18872         if (b_constr.datalen > 0)
18873                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18874         else
18875                 b_constr.data = NULL;
18876         uint64_t* b_vals = b->elems;
18877         for (size_t v = 0; v < b_constr.datalen; v++) {
18878                 uint64_t b_conv_21 = b_vals[v];
18879                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
18880                 CHECK_ACCESS(b_conv_21_ptr);
18881                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
18882                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
18883                 b_constr.data[v] = b_conv_21_conv;
18884         }
18885         FREE(b);
18886         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18887         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
18888         return tag_ptr(ret_conv, true);
18889 }
18890
18891 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
18892         if (!ptr_is_owned(_res)) return;
18893         void* _res_ptr = untag_ptr(_res);
18894         CHECK_ACCESS(_res_ptr);
18895         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
18896         FREE(untag_ptr(_res));
18897         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
18898 }
18899
18900 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
18901         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
18902         _res_constr.datalen = _res->arr_len;
18903         if (_res_constr.datalen > 0)
18904                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
18905         else
18906                 _res_constr.data = NULL;
18907         uint64_t* _res_vals = _res->elems;
18908         for (size_t o = 0; o < _res_constr.datalen; o++) {
18909                 uint64_t _res_conv_40 = _res_vals[o];
18910                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18911                 CHECK_ACCESS(_res_conv_40_ptr);
18912                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
18913                 FREE(untag_ptr(_res_conv_40));
18914                 _res_constr.data[o] = _res_conv_40_conv;
18915         }
18916         FREE(_res);
18917         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
18918 }
18919
18920 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
18921         LDKCVec_EventZ _res_constr;
18922         _res_constr.datalen = _res->arr_len;
18923         if (_res_constr.datalen > 0)
18924                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
18925         else
18926                 _res_constr.data = NULL;
18927         uint64_t* _res_vals = _res->elems;
18928         for (size_t h = 0; h < _res_constr.datalen; h++) {
18929                 uint64_t _res_conv_7 = _res_vals[h];
18930                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18931                 CHECK_ACCESS(_res_conv_7_ptr);
18932                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
18933                 FREE(untag_ptr(_res_conv_7));
18934                 _res_constr.data[h] = _res_conv_7_conv;
18935         }
18936         FREE(_res);
18937         CVec_EventZ_free(_res_constr);
18938 }
18939
18940 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
18941         LDKCVec_TransactionZ _res_constr;
18942         _res_constr.datalen = _res->arr_len;
18943         if (_res_constr.datalen > 0)
18944                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18945         else
18946                 _res_constr.data = NULL;
18947         int8_tArray* _res_vals = (void*) _res->elems;
18948         for (size_t m = 0; m < _res_constr.datalen; m++) {
18949                 int8_tArray _res_conv_12 = _res_vals[m];
18950                 LDKTransaction _res_conv_12_ref;
18951                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18952                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18953                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18954                 _res_conv_12_ref.data_is_owned = true;
18955                 _res_constr.data[m] = _res_conv_12_ref;
18956         }
18957         FREE(_res);
18958         CVec_TransactionZ_free(_res_constr);
18959 }
18960
18961 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18962         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18963         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18964         return tag_ptr(ret_conv, true);
18965 }
18966 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18967         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18968         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18969         return ret_conv;
18970 }
18971
18972 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18973         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18974         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18975         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18976         return tag_ptr(ret_conv, true);
18977 }
18978
18979 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18980         void* b_ptr = untag_ptr(b);
18981         CHECK_ACCESS(b_ptr);
18982         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18983         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18984         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18985         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18986         return tag_ptr(ret_conv, true);
18987 }
18988
18989 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18990         if (!ptr_is_owned(_res)) return;
18991         void* _res_ptr = untag_ptr(_res);
18992         CHECK_ACCESS(_res_ptr);
18993         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18994         FREE(untag_ptr(_res));
18995         C2Tuple_u32TxOutZ_free(_res_conv);
18996 }
18997
18998 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18999         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
19000         _res_constr.datalen = _res->arr_len;
19001         if (_res_constr.datalen > 0)
19002                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19003         else
19004                 _res_constr.data = NULL;
19005         uint64_t* _res_vals = _res->elems;
19006         for (size_t u = 0; u < _res_constr.datalen; u++) {
19007                 uint64_t _res_conv_20 = _res_vals[u];
19008                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
19009                 CHECK_ACCESS(_res_conv_20_ptr);
19010                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
19011                 FREE(untag_ptr(_res_conv_20));
19012                 _res_constr.data[u] = _res_conv_20_conv;
19013         }
19014         FREE(_res);
19015         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
19016 }
19017
19018 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
19019         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19020         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
19021         return tag_ptr(ret_conv, true);
19022 }
19023 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
19024         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
19025         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
19026         return ret_conv;
19027 }
19028
19029 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
19030         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
19031         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19032         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
19033         return tag_ptr(ret_conv, true);
19034 }
19035
19036 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
19037         LDKThirtyTwoBytes a_ref;
19038         CHECK(a->arr_len == 32);
19039         memcpy(a_ref.data, a->elems, 32); FREE(a);
19040         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
19041         b_constr.datalen = b->arr_len;
19042         if (b_constr.datalen > 0)
19043                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19044         else
19045                 b_constr.data = NULL;
19046         uint64_t* b_vals = b->elems;
19047         for (size_t u = 0; u < b_constr.datalen; u++) {
19048                 uint64_t b_conv_20 = b_vals[u];
19049                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
19050                 CHECK_ACCESS(b_conv_20_ptr);
19051                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
19052                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
19053                 b_constr.data[u] = b_conv_20_conv;
19054         }
19055         FREE(b);
19056         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19057         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
19058         return tag_ptr(ret_conv, true);
19059 }
19060
19061 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
19062         if (!ptr_is_owned(_res)) return;
19063         void* _res_ptr = untag_ptr(_res);
19064         CHECK_ACCESS(_res_ptr);
19065         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
19066         FREE(untag_ptr(_res));
19067         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
19068 }
19069
19070 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
19071         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
19072         _res_constr.datalen = _res->arr_len;
19073         if (_res_constr.datalen > 0)
19074                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
19075         else
19076                 _res_constr.data = NULL;
19077         uint64_t* _res_vals = _res->elems;
19078         for (size_t n = 0; n < _res_constr.datalen; n++) {
19079                 uint64_t _res_conv_39 = _res_vals[n];
19080                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
19081                 CHECK_ACCESS(_res_conv_39_ptr);
19082                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
19083                 FREE(untag_ptr(_res_conv_39));
19084                 _res_constr.data[n] = _res_conv_39_conv;
19085         }
19086         FREE(_res);
19087         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
19088 }
19089
19090 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
19091         LDKCVec_BalanceZ _res_constr;
19092         _res_constr.datalen = _res->arr_len;
19093         if (_res_constr.datalen > 0)
19094                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
19095         else
19096                 _res_constr.data = NULL;
19097         uint64_t* _res_vals = _res->elems;
19098         for (size_t j = 0; j < _res_constr.datalen; j++) {
19099                 uint64_t _res_conv_9 = _res_vals[j];
19100                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
19101                 CHECK_ACCESS(_res_conv_9_ptr);
19102                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
19103                 FREE(untag_ptr(_res_conv_9));
19104                 _res_constr.data[j] = _res_conv_9_conv;
19105         }
19106         FREE(_res);
19107         CVec_BalanceZ_free(_res_constr);
19108 }
19109
19110 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
19111         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19112         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
19113         return tag_ptr(ret_conv, true);
19114 }
19115 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
19116         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
19117         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
19118         return ret_conv;
19119 }
19120
19121 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
19122         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
19123         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19124         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
19125         return tag_ptr(ret_conv, true);
19126 }
19127
19128 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
19129         LDKThirtyTwoBytes a_ref;
19130         CHECK(a->arr_len == 32);
19131         memcpy(a_ref.data, a->elems, 32); FREE(a);
19132         LDKChannelMonitor b_conv;
19133         b_conv.inner = untag_ptr(b);
19134         b_conv.is_owned = ptr_is_owned(b);
19135         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19136         b_conv = ChannelMonitor_clone(&b_conv);
19137         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19138         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
19139         return tag_ptr(ret_conv, true);
19140 }
19141
19142 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
19143         if (!ptr_is_owned(_res)) return;
19144         void* _res_ptr = untag_ptr(_res);
19145         CHECK_ACCESS(_res_ptr);
19146         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
19147         FREE(untag_ptr(_res));
19148         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
19149 }
19150
19151 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
19152         void* o_ptr = untag_ptr(o);
19153         CHECK_ACCESS(o_ptr);
19154         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
19155         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
19156         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19157         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
19158         return tag_ptr(ret_conv, true);
19159 }
19160
19161 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
19162         void* e_ptr = untag_ptr(e);
19163         CHECK_ACCESS(e_ptr);
19164         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19165         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19166         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19167         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
19168         return tag_ptr(ret_conv, true);
19169 }
19170
19171 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
19172         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
19173         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
19174         return ret_conv;
19175 }
19176
19177 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
19178         if (!ptr_is_owned(_res)) return;
19179         void* _res_ptr = untag_ptr(_res);
19180         CHECK_ACCESS(_res_ptr);
19181         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
19182         FREE(untag_ptr(_res));
19183         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
19184 }
19185
19186 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
19187         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19188         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
19189         return tag_ptr(ret_conv, true);
19190 }
19191 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
19192         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
19193         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
19194         return ret_conv;
19195 }
19196
19197 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
19198         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
19199         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19200         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
19201         return tag_ptr(ret_conv, true);
19202 }
19203
19204 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
19205         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19206         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
19207         return tag_ptr(ret_conv, true);
19208 }
19209 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
19210         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
19211         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
19212         return ret_conv;
19213 }
19214
19215 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
19216         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
19217         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19218         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
19219         return tag_ptr(ret_conv, true);
19220 }
19221
19222 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
19223         LDKPublicKey a_ref;
19224         CHECK(a->arr_len == 33);
19225         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
19226         void* b_ptr = untag_ptr(b);
19227         CHECK_ACCESS(b_ptr);
19228         LDKType b_conv = *(LDKType*)(b_ptr);
19229         if (b_conv.free == LDKType_JCalls_free) {
19230                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19231                 LDKType_JCalls_cloned(&b_conv);
19232         }
19233         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19234         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
19235         return tag_ptr(ret_conv, true);
19236 }
19237
19238 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
19239         if (!ptr_is_owned(_res)) return;
19240         void* _res_ptr = untag_ptr(_res);
19241         CHECK_ACCESS(_res_ptr);
19242         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
19243         FREE(untag_ptr(_res));
19244         C2Tuple_PublicKeyTypeZ_free(_res_conv);
19245 }
19246
19247 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
19248         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
19249         _res_constr.datalen = _res->arr_len;
19250         if (_res_constr.datalen > 0)
19251                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
19252         else
19253                 _res_constr.data = NULL;
19254         uint64_t* _res_vals = _res->elems;
19255         for (size_t z = 0; z < _res_constr.datalen; z++) {
19256                 uint64_t _res_conv_25 = _res_vals[z];
19257                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
19258                 CHECK_ACCESS(_res_conv_25_ptr);
19259                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
19260                 FREE(untag_ptr(_res_conv_25));
19261                 _res_constr.data[z] = _res_conv_25_conv;
19262         }
19263         FREE(_res);
19264         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
19265 }
19266
19267 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
19268         void* o_ptr = untag_ptr(o);
19269         CHECK_ACCESS(o_ptr);
19270         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
19271         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
19272                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19273                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
19274         }
19275         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19276         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
19277         uint64_t ret_ref = tag_ptr(ret_copy, true);
19278         return ret_ref;
19279 }
19280
19281 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
19282         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19283         *ret_copy = COption_CustomOnionMessageContentsZ_none();
19284         uint64_t ret_ref = tag_ptr(ret_copy, true);
19285         return ret_ref;
19286 }
19287
19288 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
19289         if (!ptr_is_owned(_res)) return;
19290         void* _res_ptr = untag_ptr(_res);
19291         CHECK_ACCESS(_res_ptr);
19292         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
19293         FREE(untag_ptr(_res));
19294         COption_CustomOnionMessageContentsZ_free(_res_conv);
19295 }
19296
19297 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
19298         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19299         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
19300         uint64_t ret_ref = tag_ptr(ret_copy, true);
19301         return ret_ref;
19302 }
19303 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
19304         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
19305         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
19306         return ret_conv;
19307 }
19308
19309 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
19310         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
19311         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19312         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
19313         uint64_t ret_ref = tag_ptr(ret_copy, true);
19314         return ret_ref;
19315 }
19316
19317 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
19318         void* o_ptr = untag_ptr(o);
19319         CHECK_ACCESS(o_ptr);
19320         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
19321         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
19322         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19323         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
19324         return tag_ptr(ret_conv, true);
19325 }
19326
19327 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
19328         void* e_ptr = untag_ptr(e);
19329         CHECK_ACCESS(e_ptr);
19330         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19331         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19332         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19333         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
19334         return tag_ptr(ret_conv, true);
19335 }
19336
19337 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
19338         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
19339         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
19340         return ret_conv;
19341 }
19342
19343 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
19344         if (!ptr_is_owned(_res)) return;
19345         void* _res_ptr = untag_ptr(_res);
19346         CHECK_ACCESS(_res_ptr);
19347         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
19348         FREE(untag_ptr(_res));
19349         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
19350 }
19351
19352 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
19353         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19354         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
19355         return tag_ptr(ret_conv, true);
19356 }
19357 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
19358         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
19359         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
19360         return ret_conv;
19361 }
19362
19363 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
19364         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
19365         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19366         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
19367         return tag_ptr(ret_conv, true);
19368 }
19369
19370 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
19371         void* o_ptr = untag_ptr(o);
19372         CHECK_ACCESS(o_ptr);
19373         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19374         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19375         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19376         *ret_copy = COption_NetAddressZ_some(o_conv);
19377         uint64_t ret_ref = tag_ptr(ret_copy, true);
19378         return ret_ref;
19379 }
19380
19381 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
19382         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19383         *ret_copy = COption_NetAddressZ_none();
19384         uint64_t ret_ref = tag_ptr(ret_copy, true);
19385         return ret_ref;
19386 }
19387
19388 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
19389         if (!ptr_is_owned(_res)) return;
19390         void* _res_ptr = untag_ptr(_res);
19391         CHECK_ACCESS(_res_ptr);
19392         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
19393         FREE(untag_ptr(_res));
19394         COption_NetAddressZ_free(_res_conv);
19395 }
19396
19397 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
19398         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19399         *ret_copy = COption_NetAddressZ_clone(arg);
19400         uint64_t ret_ref = tag_ptr(ret_copy, true);
19401         return ret_ref;
19402 }
19403 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
19404         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
19405         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
19406         return ret_conv;
19407 }
19408
19409 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
19410         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
19411         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19412         *ret_copy = COption_NetAddressZ_clone(orig_conv);
19413         uint64_t ret_ref = tag_ptr(ret_copy, true);
19414         return ret_ref;
19415 }
19416
19417 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
19418         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19419         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
19420         return tag_ptr(ret_conv, true);
19421 }
19422 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(uint64_t arg) {
19423         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
19424         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
19425         return ret_conv;
19426 }
19427
19428 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone(uint64_t orig) {
19429         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
19430         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19431         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
19432         return tag_ptr(ret_conv, true);
19433 }
19434
19435 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new(int8_tArray a, uint64_t b) {
19436         LDKPublicKey a_ref;
19437         CHECK(a->arr_len == 33);
19438         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
19439         void* b_ptr = untag_ptr(b);
19440         CHECK_ACCESS(b_ptr);
19441         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
19442         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
19443         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19444         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
19445         return tag_ptr(ret_conv, true);
19446 }
19447
19448 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free(uint64_t _res) {
19449         if (!ptr_is_owned(_res)) return;
19450         void* _res_ptr = untag_ptr(_res);
19451         CHECK_ACCESS(_res_ptr);
19452         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
19453         FREE(untag_ptr(_res));
19454         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
19455 }
19456
19457 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(uint64_tArray _res) {
19458         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
19459         _res_constr.datalen = _res->arr_len;
19460         if (_res_constr.datalen > 0)
19461                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
19462         else
19463                 _res_constr.data = NULL;
19464         uint64_t* _res_vals = _res->elems;
19465         for (size_t o = 0; o < _res_constr.datalen; o++) {
19466                 uint64_t _res_conv_40 = _res_vals[o];
19467                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
19468                 CHECK_ACCESS(_res_conv_40_ptr);
19469                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
19470                 FREE(untag_ptr(_res_conv_40));
19471                 _res_constr.data[o] = _res_conv_40_conv;
19472         }
19473         FREE(_res);
19474         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
19475 }
19476
19477 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
19478         LDKCVec_u8Z o_ref;
19479         o_ref.datalen = o->arr_len;
19480         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19481         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
19482         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19483         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
19484         return tag_ptr(ret_conv, true);
19485 }
19486
19487 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
19488         LDKPeerHandleError e_conv;
19489         e_conv.inner = untag_ptr(e);
19490         e_conv.is_owned = ptr_is_owned(e);
19491         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19492         e_conv = PeerHandleError_clone(&e_conv);
19493         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19494         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
19495         return tag_ptr(ret_conv, true);
19496 }
19497
19498 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
19499         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
19500         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
19501         return ret_conv;
19502 }
19503
19504 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
19505         if (!ptr_is_owned(_res)) return;
19506         void* _res_ptr = untag_ptr(_res);
19507         CHECK_ACCESS(_res_ptr);
19508         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
19509         FREE(untag_ptr(_res));
19510         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
19511 }
19512
19513 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
19514         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19515         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
19516         return tag_ptr(ret_conv, true);
19517 }
19518 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19519         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
19520         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
19521         return ret_conv;
19522 }
19523
19524 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
19525         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
19526         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19527         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
19528         return tag_ptr(ret_conv, true);
19529 }
19530
19531 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
19532         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19533         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
19534         return tag_ptr(ret_conv, true);
19535 }
19536
19537 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
19538         LDKPeerHandleError e_conv;
19539         e_conv.inner = untag_ptr(e);
19540         e_conv.is_owned = ptr_is_owned(e);
19541         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19542         e_conv = PeerHandleError_clone(&e_conv);
19543         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19544         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
19545         return tag_ptr(ret_conv, true);
19546 }
19547
19548 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
19549         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
19550         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
19551         return ret_conv;
19552 }
19553
19554 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
19555         if (!ptr_is_owned(_res)) return;
19556         void* _res_ptr = untag_ptr(_res);
19557         CHECK_ACCESS(_res_ptr);
19558         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
19559         FREE(untag_ptr(_res));
19560         CResult_NonePeerHandleErrorZ_free(_res_conv);
19561 }
19562
19563 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
19564         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19565         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
19566         return tag_ptr(ret_conv, true);
19567 }
19568 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
19569         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
19570         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
19571         return ret_conv;
19572 }
19573
19574 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
19575         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
19576         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19577         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
19578         return tag_ptr(ret_conv, true);
19579 }
19580
19581 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
19582         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19583         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
19584         return tag_ptr(ret_conv, true);
19585 }
19586
19587 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
19588         LDKPeerHandleError e_conv;
19589         e_conv.inner = untag_ptr(e);
19590         e_conv.is_owned = ptr_is_owned(e);
19591         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19592         e_conv = PeerHandleError_clone(&e_conv);
19593         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19594         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
19595         return tag_ptr(ret_conv, true);
19596 }
19597
19598 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
19599         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
19600         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
19601         return ret_conv;
19602 }
19603
19604 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
19605         if (!ptr_is_owned(_res)) return;
19606         void* _res_ptr = untag_ptr(_res);
19607         CHECK_ACCESS(_res_ptr);
19608         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
19609         FREE(untag_ptr(_res));
19610         CResult_boolPeerHandleErrorZ_free(_res_conv);
19611 }
19612
19613 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
19614         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19615         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
19616         return tag_ptr(ret_conv, true);
19617 }
19618 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19619         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
19620         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
19621         return ret_conv;
19622 }
19623
19624 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
19625         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
19626         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19627         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
19628         return tag_ptr(ret_conv, true);
19629 }
19630
19631 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
19632         void* o_ptr = untag_ptr(o);
19633         CHECK_ACCESS(o_ptr);
19634         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
19635         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
19636         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19637         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
19638         return tag_ptr(ret_conv, true);
19639 }
19640
19641 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
19642         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
19643         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19644         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
19645         return tag_ptr(ret_conv, true);
19646 }
19647
19648 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
19649         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
19650         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
19651         return ret_conv;
19652 }
19653
19654 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
19655         if (!ptr_is_owned(_res)) return;
19656         void* _res_ptr = untag_ptr(_res);
19657         CHECK_ACCESS(_res_ptr);
19658         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
19659         FREE(untag_ptr(_res));
19660         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
19661 }
19662
19663 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
19664         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19665         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
19666         return tag_ptr(ret_conv, true);
19667 }
19668 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
19669         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
19670         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
19671         return ret_conv;
19672 }
19673
19674 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
19675         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
19676         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19677         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
19678         return tag_ptr(ret_conv, true);
19679 }
19680
19681 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
19682         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19683         *ret_conv = CResult_NoneSendErrorZ_ok();
19684         return tag_ptr(ret_conv, true);
19685 }
19686
19687 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
19688         void* e_ptr = untag_ptr(e);
19689         CHECK_ACCESS(e_ptr);
19690         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
19691         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
19692         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19693         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
19694         return tag_ptr(ret_conv, true);
19695 }
19696
19697 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
19698         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
19699         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
19700         return ret_conv;
19701 }
19702
19703 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
19704         if (!ptr_is_owned(_res)) return;
19705         void* _res_ptr = untag_ptr(_res);
19706         CHECK_ACCESS(_res_ptr);
19707         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
19708         FREE(untag_ptr(_res));
19709         CResult_NoneSendErrorZ_free(_res_conv);
19710 }
19711
19712 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
19713         LDKBlindedPath o_conv;
19714         o_conv.inner = untag_ptr(o);
19715         o_conv.is_owned = ptr_is_owned(o);
19716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19717         o_conv = BlindedPath_clone(&o_conv);
19718         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19719         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
19720         return tag_ptr(ret_conv, true);
19721 }
19722
19723 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
19724         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19725         *ret_conv = CResult_BlindedPathNoneZ_err();
19726         return tag_ptr(ret_conv, true);
19727 }
19728
19729 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
19730         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
19731         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
19732         return ret_conv;
19733 }
19734
19735 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
19736         if (!ptr_is_owned(_res)) return;
19737         void* _res_ptr = untag_ptr(_res);
19738         CHECK_ACCESS(_res_ptr);
19739         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
19740         FREE(untag_ptr(_res));
19741         CResult_BlindedPathNoneZ_free(_res_conv);
19742 }
19743
19744 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
19745         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19746         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
19747         return tag_ptr(ret_conv, true);
19748 }
19749 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
19750         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
19751         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
19752         return ret_conv;
19753 }
19754
19755 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
19756         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
19757         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19758         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
19759         return tag_ptr(ret_conv, true);
19760 }
19761
19762 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
19763         LDKBlindedPath o_conv;
19764         o_conv.inner = untag_ptr(o);
19765         o_conv.is_owned = ptr_is_owned(o);
19766         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19767         o_conv = BlindedPath_clone(&o_conv);
19768         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19769         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
19770         return tag_ptr(ret_conv, true);
19771 }
19772
19773 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
19774         void* e_ptr = untag_ptr(e);
19775         CHECK_ACCESS(e_ptr);
19776         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19777         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19778         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19779         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
19780         return tag_ptr(ret_conv, true);
19781 }
19782
19783 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
19784         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
19785         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
19786         return ret_conv;
19787 }
19788
19789 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
19790         if (!ptr_is_owned(_res)) return;
19791         void* _res_ptr = untag_ptr(_res);
19792         CHECK_ACCESS(_res_ptr);
19793         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
19794         FREE(untag_ptr(_res));
19795         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
19796 }
19797
19798 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
19799         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19800         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
19801         return tag_ptr(ret_conv, true);
19802 }
19803 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
19804         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
19805         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
19806         return ret_conv;
19807 }
19808
19809 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
19810         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
19811         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19812         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
19813         return tag_ptr(ret_conv, true);
19814 }
19815
19816 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
19817         LDKBlindedHop o_conv;
19818         o_conv.inner = untag_ptr(o);
19819         o_conv.is_owned = ptr_is_owned(o);
19820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19821         o_conv = BlindedHop_clone(&o_conv);
19822         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19823         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
19824         return tag_ptr(ret_conv, true);
19825 }
19826
19827 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
19828         void* e_ptr = untag_ptr(e);
19829         CHECK_ACCESS(e_ptr);
19830         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19831         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19832         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19833         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
19834         return tag_ptr(ret_conv, true);
19835 }
19836
19837 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
19838         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
19839         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
19840         return ret_conv;
19841 }
19842
19843 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
19844         if (!ptr_is_owned(_res)) return;
19845         void* _res_ptr = untag_ptr(_res);
19846         CHECK_ACCESS(_res_ptr);
19847         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
19848         FREE(untag_ptr(_res));
19849         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
19850 }
19851
19852 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
19853         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19854         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
19855         return tag_ptr(ret_conv, true);
19856 }
19857 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
19858         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
19859         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
19860         return ret_conv;
19861 }
19862
19863 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
19864         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
19865         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19866         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
19867         return tag_ptr(ret_conv, true);
19868 }
19869
19870 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
19871         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19872         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
19873         return tag_ptr(ret_conv, true);
19874 }
19875
19876 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
19877         void* e_ptr = untag_ptr(e);
19878         CHECK_ACCESS(e_ptr);
19879         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
19880         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
19881         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19882         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
19883         return tag_ptr(ret_conv, true);
19884 }
19885
19886 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
19887         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
19888         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
19889         return ret_conv;
19890 }
19891
19892 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
19893         if (!ptr_is_owned(_res)) return;
19894         void* _res_ptr = untag_ptr(_res);
19895         CHECK_ACCESS(_res_ptr);
19896         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
19897         FREE(untag_ptr(_res));
19898         CResult_u32GraphSyncErrorZ_free(_res_conv);
19899 }
19900
19901 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
19902         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19903         *ret_conv = CResult_NoneErrorZ_ok();
19904         return tag_ptr(ret_conv, true);
19905 }
19906
19907 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
19908         LDKIOError e_conv = LDKIOError_from_js(e);
19909         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19910         *ret_conv = CResult_NoneErrorZ_err(e_conv);
19911         return tag_ptr(ret_conv, true);
19912 }
19913
19914 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
19915         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
19916         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
19917         return ret_conv;
19918 }
19919
19920 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
19921         if (!ptr_is_owned(_res)) return;
19922         void* _res_ptr = untag_ptr(_res);
19923         CHECK_ACCESS(_res_ptr);
19924         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
19925         FREE(untag_ptr(_res));
19926         CResult_NoneErrorZ_free(_res_conv);
19927 }
19928
19929 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
19930         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19931         *ret_conv = CResult_NoneErrorZ_clone(arg);
19932         return tag_ptr(ret_conv, true);
19933 }
19934 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
19935         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
19936         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
19937         return ret_conv;
19938 }
19939
19940 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
19941         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
19942         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19943         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
19944         return tag_ptr(ret_conv, true);
19945 }
19946
19947 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
19948         void* o_ptr = untag_ptr(o);
19949         CHECK_ACCESS(o_ptr);
19950         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19951         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19952         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19953         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
19954         return tag_ptr(ret_conv, true);
19955 }
19956
19957 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
19958         void* e_ptr = untag_ptr(e);
19959         CHECK_ACCESS(e_ptr);
19960         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19961         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19962         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19963         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
19964         return tag_ptr(ret_conv, true);
19965 }
19966
19967 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
19968         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
19969         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
19970         return ret_conv;
19971 }
19972
19973 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
19974         if (!ptr_is_owned(_res)) return;
19975         void* _res_ptr = untag_ptr(_res);
19976         CHECK_ACCESS(_res_ptr);
19977         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
19978         FREE(untag_ptr(_res));
19979         CResult_NetAddressDecodeErrorZ_free(_res_conv);
19980 }
19981
19982 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
19983         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19984         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
19985         return tag_ptr(ret_conv, true);
19986 }
19987 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
19988         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
19989         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
19990         return ret_conv;
19991 }
19992
19993 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
19994         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
19995         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19996         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
19997         return tag_ptr(ret_conv, true);
19998 }
19999
20000 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
20001         LDKCVec_UpdateAddHTLCZ _res_constr;
20002         _res_constr.datalen = _res->arr_len;
20003         if (_res_constr.datalen > 0)
20004                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20005         else
20006                 _res_constr.data = NULL;
20007         uint64_t* _res_vals = _res->elems;
20008         for (size_t p = 0; p < _res_constr.datalen; p++) {
20009                 uint64_t _res_conv_15 = _res_vals[p];
20010                 LDKUpdateAddHTLC _res_conv_15_conv;
20011                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
20012                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
20013                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
20014                 _res_constr.data[p] = _res_conv_15_conv;
20015         }
20016         FREE(_res);
20017         CVec_UpdateAddHTLCZ_free(_res_constr);
20018 }
20019
20020 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
20021         LDKCVec_UpdateFulfillHTLCZ _res_constr;
20022         _res_constr.datalen = _res->arr_len;
20023         if (_res_constr.datalen > 0)
20024                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20025         else
20026                 _res_constr.data = NULL;
20027         uint64_t* _res_vals = _res->elems;
20028         for (size_t t = 0; t < _res_constr.datalen; t++) {
20029                 uint64_t _res_conv_19 = _res_vals[t];
20030                 LDKUpdateFulfillHTLC _res_conv_19_conv;
20031                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
20032                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
20033                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
20034                 _res_constr.data[t] = _res_conv_19_conv;
20035         }
20036         FREE(_res);
20037         CVec_UpdateFulfillHTLCZ_free(_res_constr);
20038 }
20039
20040 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
20041         LDKCVec_UpdateFailHTLCZ _res_constr;
20042         _res_constr.datalen = _res->arr_len;
20043         if (_res_constr.datalen > 0)
20044                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20045         else
20046                 _res_constr.data = NULL;
20047         uint64_t* _res_vals = _res->elems;
20048         for (size_t q = 0; q < _res_constr.datalen; q++) {
20049                 uint64_t _res_conv_16 = _res_vals[q];
20050                 LDKUpdateFailHTLC _res_conv_16_conv;
20051                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20052                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20053                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20054                 _res_constr.data[q] = _res_conv_16_conv;
20055         }
20056         FREE(_res);
20057         CVec_UpdateFailHTLCZ_free(_res_constr);
20058 }
20059
20060 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
20061         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
20062         _res_constr.datalen = _res->arr_len;
20063         if (_res_constr.datalen > 0)
20064                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20065         else
20066                 _res_constr.data = NULL;
20067         uint64_t* _res_vals = _res->elems;
20068         for (size_t z = 0; z < _res_constr.datalen; z++) {
20069                 uint64_t _res_conv_25 = _res_vals[z];
20070                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
20071                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
20072                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
20073                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
20074                 _res_constr.data[z] = _res_conv_25_conv;
20075         }
20076         FREE(_res);
20077         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
20078 }
20079
20080 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
20081         LDKAcceptChannel o_conv;
20082         o_conv.inner = untag_ptr(o);
20083         o_conv.is_owned = ptr_is_owned(o);
20084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20085         o_conv = AcceptChannel_clone(&o_conv);
20086         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20087         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
20088         return tag_ptr(ret_conv, true);
20089 }
20090
20091 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
20092         void* e_ptr = untag_ptr(e);
20093         CHECK_ACCESS(e_ptr);
20094         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20095         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20096         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20097         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
20098         return tag_ptr(ret_conv, true);
20099 }
20100
20101 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
20102         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
20103         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
20104         return ret_conv;
20105 }
20106
20107 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
20108         if (!ptr_is_owned(_res)) return;
20109         void* _res_ptr = untag_ptr(_res);
20110         CHECK_ACCESS(_res_ptr);
20111         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
20112         FREE(untag_ptr(_res));
20113         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
20114 }
20115
20116 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
20117         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20118         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
20119         return tag_ptr(ret_conv, true);
20120 }
20121 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20122         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
20123         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
20124         return ret_conv;
20125 }
20126
20127 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
20128         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
20129         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20130         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
20131         return tag_ptr(ret_conv, true);
20132 }
20133
20134 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
20135         LDKAnnouncementSignatures o_conv;
20136         o_conv.inner = untag_ptr(o);
20137         o_conv.is_owned = ptr_is_owned(o);
20138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20139         o_conv = AnnouncementSignatures_clone(&o_conv);
20140         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20141         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
20142         return tag_ptr(ret_conv, true);
20143 }
20144
20145 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
20146         void* e_ptr = untag_ptr(e);
20147         CHECK_ACCESS(e_ptr);
20148         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20149         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20150         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20151         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
20152         return tag_ptr(ret_conv, true);
20153 }
20154
20155 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
20156         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
20157         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
20158         return ret_conv;
20159 }
20160
20161 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
20162         if (!ptr_is_owned(_res)) return;
20163         void* _res_ptr = untag_ptr(_res);
20164         CHECK_ACCESS(_res_ptr);
20165         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
20166         FREE(untag_ptr(_res));
20167         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
20168 }
20169
20170 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
20171         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20172         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
20173         return tag_ptr(ret_conv, true);
20174 }
20175 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20176         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
20177         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
20178         return ret_conv;
20179 }
20180
20181 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
20182         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
20183         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20184         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
20185         return tag_ptr(ret_conv, true);
20186 }
20187
20188 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
20189         LDKChannelReestablish o_conv;
20190         o_conv.inner = untag_ptr(o);
20191         o_conv.is_owned = ptr_is_owned(o);
20192         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20193         o_conv = ChannelReestablish_clone(&o_conv);
20194         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20195         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
20196         return tag_ptr(ret_conv, true);
20197 }
20198
20199 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
20200         void* e_ptr = untag_ptr(e);
20201         CHECK_ACCESS(e_ptr);
20202         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20203         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20204         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20205         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
20206         return tag_ptr(ret_conv, true);
20207 }
20208
20209 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
20210         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
20211         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
20212         return ret_conv;
20213 }
20214
20215 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
20216         if (!ptr_is_owned(_res)) return;
20217         void* _res_ptr = untag_ptr(_res);
20218         CHECK_ACCESS(_res_ptr);
20219         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
20220         FREE(untag_ptr(_res));
20221         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
20222 }
20223
20224 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
20225         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20226         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
20227         return tag_ptr(ret_conv, true);
20228 }
20229 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
20230         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
20231         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
20232         return ret_conv;
20233 }
20234
20235 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
20236         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
20237         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20238         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
20239         return tag_ptr(ret_conv, true);
20240 }
20241
20242 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
20243         LDKClosingSigned o_conv;
20244         o_conv.inner = untag_ptr(o);
20245         o_conv.is_owned = ptr_is_owned(o);
20246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20247         o_conv = ClosingSigned_clone(&o_conv);
20248         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20249         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
20250         return tag_ptr(ret_conv, true);
20251 }
20252
20253 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
20254         void* e_ptr = untag_ptr(e);
20255         CHECK_ACCESS(e_ptr);
20256         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20257         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20258         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20259         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
20260         return tag_ptr(ret_conv, true);
20261 }
20262
20263 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
20264         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
20265         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
20266         return ret_conv;
20267 }
20268
20269 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
20270         if (!ptr_is_owned(_res)) return;
20271         void* _res_ptr = untag_ptr(_res);
20272         CHECK_ACCESS(_res_ptr);
20273         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
20274         FREE(untag_ptr(_res));
20275         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
20276 }
20277
20278 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
20279         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20280         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
20281         return tag_ptr(ret_conv, true);
20282 }
20283 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20284         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
20285         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
20286         return ret_conv;
20287 }
20288
20289 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
20290         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
20291         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20292         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
20293         return tag_ptr(ret_conv, true);
20294 }
20295
20296 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
20297         LDKClosingSignedFeeRange o_conv;
20298         o_conv.inner = untag_ptr(o);
20299         o_conv.is_owned = ptr_is_owned(o);
20300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20301         o_conv = ClosingSignedFeeRange_clone(&o_conv);
20302         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20303         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
20304         return tag_ptr(ret_conv, true);
20305 }
20306
20307 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
20308         void* e_ptr = untag_ptr(e);
20309         CHECK_ACCESS(e_ptr);
20310         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20311         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20312         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20313         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
20314         return tag_ptr(ret_conv, true);
20315 }
20316
20317 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
20318         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
20319         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
20320         return ret_conv;
20321 }
20322
20323 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
20324         if (!ptr_is_owned(_res)) return;
20325         void* _res_ptr = untag_ptr(_res);
20326         CHECK_ACCESS(_res_ptr);
20327         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
20328         FREE(untag_ptr(_res));
20329         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
20330 }
20331
20332 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
20333         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20334         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
20335         return tag_ptr(ret_conv, true);
20336 }
20337 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20338         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
20339         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
20340         return ret_conv;
20341 }
20342
20343 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
20344         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
20345         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20346         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
20347         return tag_ptr(ret_conv, true);
20348 }
20349
20350 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
20351         LDKCommitmentSigned o_conv;
20352         o_conv.inner = untag_ptr(o);
20353         o_conv.is_owned = ptr_is_owned(o);
20354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20355         o_conv = CommitmentSigned_clone(&o_conv);
20356         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20357         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
20358         return tag_ptr(ret_conv, true);
20359 }
20360
20361 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
20362         void* e_ptr = untag_ptr(e);
20363         CHECK_ACCESS(e_ptr);
20364         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20365         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20366         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20367         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
20368         return tag_ptr(ret_conv, true);
20369 }
20370
20371 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
20372         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
20373         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
20374         return ret_conv;
20375 }
20376
20377 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
20378         if (!ptr_is_owned(_res)) return;
20379         void* _res_ptr = untag_ptr(_res);
20380         CHECK_ACCESS(_res_ptr);
20381         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
20382         FREE(untag_ptr(_res));
20383         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
20384 }
20385
20386 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
20387         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20388         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
20389         return tag_ptr(ret_conv, true);
20390 }
20391 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20392         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
20393         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
20394         return ret_conv;
20395 }
20396
20397 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
20398         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
20399         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20400         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
20401         return tag_ptr(ret_conv, true);
20402 }
20403
20404 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
20405         LDKFundingCreated o_conv;
20406         o_conv.inner = untag_ptr(o);
20407         o_conv.is_owned = ptr_is_owned(o);
20408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20409         o_conv = FundingCreated_clone(&o_conv);
20410         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20411         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
20412         return tag_ptr(ret_conv, true);
20413 }
20414
20415 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
20416         void* e_ptr = untag_ptr(e);
20417         CHECK_ACCESS(e_ptr);
20418         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20419         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20420         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20421         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
20422         return tag_ptr(ret_conv, true);
20423 }
20424
20425 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
20426         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
20427         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
20428         return ret_conv;
20429 }
20430
20431 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
20432         if (!ptr_is_owned(_res)) return;
20433         void* _res_ptr = untag_ptr(_res);
20434         CHECK_ACCESS(_res_ptr);
20435         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
20436         FREE(untag_ptr(_res));
20437         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
20438 }
20439
20440 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
20441         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20442         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
20443         return tag_ptr(ret_conv, true);
20444 }
20445 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
20446         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
20447         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
20448         return ret_conv;
20449 }
20450
20451 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
20452         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
20453         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20454         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
20455         return tag_ptr(ret_conv, true);
20456 }
20457
20458 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
20459         LDKFundingSigned o_conv;
20460         o_conv.inner = untag_ptr(o);
20461         o_conv.is_owned = ptr_is_owned(o);
20462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20463         o_conv = FundingSigned_clone(&o_conv);
20464         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20465         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
20466         return tag_ptr(ret_conv, true);
20467 }
20468
20469 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
20470         void* e_ptr = untag_ptr(e);
20471         CHECK_ACCESS(e_ptr);
20472         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20473         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20474         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20475         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
20476         return tag_ptr(ret_conv, true);
20477 }
20478
20479 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
20480         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
20481         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
20482         return ret_conv;
20483 }
20484
20485 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
20486         if (!ptr_is_owned(_res)) return;
20487         void* _res_ptr = untag_ptr(_res);
20488         CHECK_ACCESS(_res_ptr);
20489         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
20490         FREE(untag_ptr(_res));
20491         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
20492 }
20493
20494 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
20495         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20496         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
20497         return tag_ptr(ret_conv, true);
20498 }
20499 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20500         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
20501         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
20502         return ret_conv;
20503 }
20504
20505 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
20506         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
20507         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20508         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
20509         return tag_ptr(ret_conv, true);
20510 }
20511
20512 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
20513         LDKChannelReady o_conv;
20514         o_conv.inner = untag_ptr(o);
20515         o_conv.is_owned = ptr_is_owned(o);
20516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20517         o_conv = ChannelReady_clone(&o_conv);
20518         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20519         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
20520         return tag_ptr(ret_conv, true);
20521 }
20522
20523 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
20524         void* e_ptr = untag_ptr(e);
20525         CHECK_ACCESS(e_ptr);
20526         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20527         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20528         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20529         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
20530         return tag_ptr(ret_conv, true);
20531 }
20532
20533 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
20534         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
20535         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
20536         return ret_conv;
20537 }
20538
20539 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
20540         if (!ptr_is_owned(_res)) return;
20541         void* _res_ptr = untag_ptr(_res);
20542         CHECK_ACCESS(_res_ptr);
20543         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
20544         FREE(untag_ptr(_res));
20545         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
20546 }
20547
20548 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
20549         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20550         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
20551         return tag_ptr(ret_conv, true);
20552 }
20553 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
20554         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
20555         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
20556         return ret_conv;
20557 }
20558
20559 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
20560         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
20561         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20562         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
20563         return tag_ptr(ret_conv, true);
20564 }
20565
20566 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
20567         LDKInit o_conv;
20568         o_conv.inner = untag_ptr(o);
20569         o_conv.is_owned = ptr_is_owned(o);
20570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20571         o_conv = Init_clone(&o_conv);
20572         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20573         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
20574         return tag_ptr(ret_conv, true);
20575 }
20576
20577 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
20578         void* e_ptr = untag_ptr(e);
20579         CHECK_ACCESS(e_ptr);
20580         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20581         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20582         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20583         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
20584         return tag_ptr(ret_conv, true);
20585 }
20586
20587 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
20588         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
20589         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
20590         return ret_conv;
20591 }
20592
20593 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
20594         if (!ptr_is_owned(_res)) return;
20595         void* _res_ptr = untag_ptr(_res);
20596         CHECK_ACCESS(_res_ptr);
20597         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
20598         FREE(untag_ptr(_res));
20599         CResult_InitDecodeErrorZ_free(_res_conv);
20600 }
20601
20602 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
20603         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20604         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
20605         return tag_ptr(ret_conv, true);
20606 }
20607 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
20608         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
20609         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
20610         return ret_conv;
20611 }
20612
20613 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
20614         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
20615         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20616         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
20617         return tag_ptr(ret_conv, true);
20618 }
20619
20620 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
20621         LDKOpenChannel o_conv;
20622         o_conv.inner = untag_ptr(o);
20623         o_conv.is_owned = ptr_is_owned(o);
20624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20625         o_conv = OpenChannel_clone(&o_conv);
20626         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20627         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
20628         return tag_ptr(ret_conv, true);
20629 }
20630
20631 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
20632         void* e_ptr = untag_ptr(e);
20633         CHECK_ACCESS(e_ptr);
20634         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20635         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20636         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20637         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
20638         return tag_ptr(ret_conv, true);
20639 }
20640
20641 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
20642         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
20643         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
20644         return ret_conv;
20645 }
20646
20647 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
20648         if (!ptr_is_owned(_res)) return;
20649         void* _res_ptr = untag_ptr(_res);
20650         CHECK_ACCESS(_res_ptr);
20651         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
20652         FREE(untag_ptr(_res));
20653         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
20654 }
20655
20656 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
20657         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20658         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
20659         return tag_ptr(ret_conv, true);
20660 }
20661 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20662         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
20663         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
20664         return ret_conv;
20665 }
20666
20667 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
20668         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
20669         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20670         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
20671         return tag_ptr(ret_conv, true);
20672 }
20673
20674 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
20675         LDKRevokeAndACK o_conv;
20676         o_conv.inner = untag_ptr(o);
20677         o_conv.is_owned = ptr_is_owned(o);
20678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20679         o_conv = RevokeAndACK_clone(&o_conv);
20680         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20681         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
20682         return tag_ptr(ret_conv, true);
20683 }
20684
20685 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
20686         void* e_ptr = untag_ptr(e);
20687         CHECK_ACCESS(e_ptr);
20688         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20689         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20690         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20691         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
20692         return tag_ptr(ret_conv, true);
20693 }
20694
20695 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
20696         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
20697         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
20698         return ret_conv;
20699 }
20700
20701 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
20702         if (!ptr_is_owned(_res)) return;
20703         void* _res_ptr = untag_ptr(_res);
20704         CHECK_ACCESS(_res_ptr);
20705         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
20706         FREE(untag_ptr(_res));
20707         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
20708 }
20709
20710 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
20711         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20712         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
20713         return tag_ptr(ret_conv, true);
20714 }
20715 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
20716         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
20717         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
20718         return ret_conv;
20719 }
20720
20721 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
20722         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
20723         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20724         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
20725         return tag_ptr(ret_conv, true);
20726 }
20727
20728 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
20729         LDKShutdown o_conv;
20730         o_conv.inner = untag_ptr(o);
20731         o_conv.is_owned = ptr_is_owned(o);
20732         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20733         o_conv = Shutdown_clone(&o_conv);
20734         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20735         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
20736         return tag_ptr(ret_conv, true);
20737 }
20738
20739 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
20740         void* e_ptr = untag_ptr(e);
20741         CHECK_ACCESS(e_ptr);
20742         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20743         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20744         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20745         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
20746         return tag_ptr(ret_conv, true);
20747 }
20748
20749 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
20750         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
20751         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
20752         return ret_conv;
20753 }
20754
20755 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
20756         if (!ptr_is_owned(_res)) return;
20757         void* _res_ptr = untag_ptr(_res);
20758         CHECK_ACCESS(_res_ptr);
20759         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
20760         FREE(untag_ptr(_res));
20761         CResult_ShutdownDecodeErrorZ_free(_res_conv);
20762 }
20763
20764 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
20765         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20766         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
20767         return tag_ptr(ret_conv, true);
20768 }
20769 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
20770         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
20771         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
20772         return ret_conv;
20773 }
20774
20775 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
20776         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
20777         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20778         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
20779         return tag_ptr(ret_conv, true);
20780 }
20781
20782 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
20783         LDKUpdateFailHTLC o_conv;
20784         o_conv.inner = untag_ptr(o);
20785         o_conv.is_owned = ptr_is_owned(o);
20786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20787         o_conv = UpdateFailHTLC_clone(&o_conv);
20788         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20789         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
20790         return tag_ptr(ret_conv, true);
20791 }
20792
20793 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
20794         void* e_ptr = untag_ptr(e);
20795         CHECK_ACCESS(e_ptr);
20796         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20797         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20798         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20799         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
20800         return tag_ptr(ret_conv, true);
20801 }
20802
20803 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
20804         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
20805         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
20806         return ret_conv;
20807 }
20808
20809 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
20810         if (!ptr_is_owned(_res)) return;
20811         void* _res_ptr = untag_ptr(_res);
20812         CHECK_ACCESS(_res_ptr);
20813         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
20814         FREE(untag_ptr(_res));
20815         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
20816 }
20817
20818 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
20819         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20820         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
20821         return tag_ptr(ret_conv, true);
20822 }
20823 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20824         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
20825         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
20826         return ret_conv;
20827 }
20828
20829 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
20830         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
20831         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20832         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
20833         return tag_ptr(ret_conv, true);
20834 }
20835
20836 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
20837         LDKUpdateFailMalformedHTLC o_conv;
20838         o_conv.inner = untag_ptr(o);
20839         o_conv.is_owned = ptr_is_owned(o);
20840         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20841         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
20842         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20843         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
20844         return tag_ptr(ret_conv, true);
20845 }
20846
20847 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
20848         void* e_ptr = untag_ptr(e);
20849         CHECK_ACCESS(e_ptr);
20850         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20851         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20852         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20853         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
20854         return tag_ptr(ret_conv, true);
20855 }
20856
20857 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
20858         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
20859         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
20860         return ret_conv;
20861 }
20862
20863 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
20864         if (!ptr_is_owned(_res)) return;
20865         void* _res_ptr = untag_ptr(_res);
20866         CHECK_ACCESS(_res_ptr);
20867         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
20868         FREE(untag_ptr(_res));
20869         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
20870 }
20871
20872 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
20873         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20874         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
20875         return tag_ptr(ret_conv, true);
20876 }
20877 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20878         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
20879         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
20880         return ret_conv;
20881 }
20882
20883 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
20884         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
20885         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20886         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
20887         return tag_ptr(ret_conv, true);
20888 }
20889
20890 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
20891         LDKUpdateFee o_conv;
20892         o_conv.inner = untag_ptr(o);
20893         o_conv.is_owned = ptr_is_owned(o);
20894         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20895         o_conv = UpdateFee_clone(&o_conv);
20896         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20897         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
20898         return tag_ptr(ret_conv, true);
20899 }
20900
20901 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
20902         void* e_ptr = untag_ptr(e);
20903         CHECK_ACCESS(e_ptr);
20904         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20905         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20906         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20907         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
20908         return tag_ptr(ret_conv, true);
20909 }
20910
20911 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
20912         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
20913         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
20914         return ret_conv;
20915 }
20916
20917 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
20918         if (!ptr_is_owned(_res)) return;
20919         void* _res_ptr = untag_ptr(_res);
20920         CHECK_ACCESS(_res_ptr);
20921         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
20922         FREE(untag_ptr(_res));
20923         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
20924 }
20925
20926 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
20927         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20928         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
20929         return tag_ptr(ret_conv, true);
20930 }
20931 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
20932         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
20933         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
20934         return ret_conv;
20935 }
20936
20937 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
20938         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
20939         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20940         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
20941         return tag_ptr(ret_conv, true);
20942 }
20943
20944 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
20945         LDKUpdateFulfillHTLC o_conv;
20946         o_conv.inner = untag_ptr(o);
20947         o_conv.is_owned = ptr_is_owned(o);
20948         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20949         o_conv = UpdateFulfillHTLC_clone(&o_conv);
20950         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20951         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
20952         return tag_ptr(ret_conv, true);
20953 }
20954
20955 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
20956         void* e_ptr = untag_ptr(e);
20957         CHECK_ACCESS(e_ptr);
20958         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20959         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20960         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20961         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
20962         return tag_ptr(ret_conv, true);
20963 }
20964
20965 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
20966         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
20967         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
20968         return ret_conv;
20969 }
20970
20971 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
20972         if (!ptr_is_owned(_res)) return;
20973         void* _res_ptr = untag_ptr(_res);
20974         CHECK_ACCESS(_res_ptr);
20975         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
20976         FREE(untag_ptr(_res));
20977         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
20978 }
20979
20980 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
20981         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20982         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
20983         return tag_ptr(ret_conv, true);
20984 }
20985 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20986         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
20987         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
20988         return ret_conv;
20989 }
20990
20991 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
20992         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
20993         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20994         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
20995         return tag_ptr(ret_conv, true);
20996 }
20997
20998 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
20999         LDKUpdateAddHTLC o_conv;
21000         o_conv.inner = untag_ptr(o);
21001         o_conv.is_owned = ptr_is_owned(o);
21002         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21003         o_conv = UpdateAddHTLC_clone(&o_conv);
21004         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21005         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
21006         return tag_ptr(ret_conv, true);
21007 }
21008
21009 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
21010         void* e_ptr = untag_ptr(e);
21011         CHECK_ACCESS(e_ptr);
21012         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21013         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21014         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21015         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
21016         return tag_ptr(ret_conv, true);
21017 }
21018
21019 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
21020         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
21021         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
21022         return ret_conv;
21023 }
21024
21025 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
21026         if (!ptr_is_owned(_res)) return;
21027         void* _res_ptr = untag_ptr(_res);
21028         CHECK_ACCESS(_res_ptr);
21029         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
21030         FREE(untag_ptr(_res));
21031         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
21032 }
21033
21034 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
21035         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21036         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
21037         return tag_ptr(ret_conv, true);
21038 }
21039 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
21040         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
21041         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
21042         return ret_conv;
21043 }
21044
21045 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
21046         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
21047         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21048         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
21049         return tag_ptr(ret_conv, true);
21050 }
21051
21052 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
21053         LDKOnionMessage o_conv;
21054         o_conv.inner = untag_ptr(o);
21055         o_conv.is_owned = ptr_is_owned(o);
21056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21057         o_conv = OnionMessage_clone(&o_conv);
21058         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21059         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
21060         return tag_ptr(ret_conv, true);
21061 }
21062
21063 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
21064         void* e_ptr = untag_ptr(e);
21065         CHECK_ACCESS(e_ptr);
21066         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21067         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21068         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21069         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
21070         return tag_ptr(ret_conv, true);
21071 }
21072
21073 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
21074         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
21075         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
21076         return ret_conv;
21077 }
21078
21079 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
21080         if (!ptr_is_owned(_res)) return;
21081         void* _res_ptr = untag_ptr(_res);
21082         CHECK_ACCESS(_res_ptr);
21083         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
21084         FREE(untag_ptr(_res));
21085         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
21086 }
21087
21088 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
21089         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21090         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
21091         return tag_ptr(ret_conv, true);
21092 }
21093 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21094         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
21095         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
21096         return ret_conv;
21097 }
21098
21099 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
21100         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
21101         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21102         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
21103         return tag_ptr(ret_conv, true);
21104 }
21105
21106 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
21107         LDKPing o_conv;
21108         o_conv.inner = untag_ptr(o);
21109         o_conv.is_owned = ptr_is_owned(o);
21110         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21111         o_conv = Ping_clone(&o_conv);
21112         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21113         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
21114         return tag_ptr(ret_conv, true);
21115 }
21116
21117 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
21118         void* e_ptr = untag_ptr(e);
21119         CHECK_ACCESS(e_ptr);
21120         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21121         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21122         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21123         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
21124         return tag_ptr(ret_conv, true);
21125 }
21126
21127 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
21128         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
21129         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
21130         return ret_conv;
21131 }
21132
21133 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
21134         if (!ptr_is_owned(_res)) return;
21135         void* _res_ptr = untag_ptr(_res);
21136         CHECK_ACCESS(_res_ptr);
21137         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
21138         FREE(untag_ptr(_res));
21139         CResult_PingDecodeErrorZ_free(_res_conv);
21140 }
21141
21142 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
21143         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21144         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
21145         return tag_ptr(ret_conv, true);
21146 }
21147 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
21148         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
21149         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
21150         return ret_conv;
21151 }
21152
21153 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
21154         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
21155         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21156         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
21157         return tag_ptr(ret_conv, true);
21158 }
21159
21160 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
21161         LDKPong o_conv;
21162         o_conv.inner = untag_ptr(o);
21163         o_conv.is_owned = ptr_is_owned(o);
21164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21165         o_conv = Pong_clone(&o_conv);
21166         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21167         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
21168         return tag_ptr(ret_conv, true);
21169 }
21170
21171 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
21172         void* e_ptr = untag_ptr(e);
21173         CHECK_ACCESS(e_ptr);
21174         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21175         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21176         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21177         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
21178         return tag_ptr(ret_conv, true);
21179 }
21180
21181 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
21182         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
21183         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
21184         return ret_conv;
21185 }
21186
21187 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
21188         if (!ptr_is_owned(_res)) return;
21189         void* _res_ptr = untag_ptr(_res);
21190         CHECK_ACCESS(_res_ptr);
21191         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
21192         FREE(untag_ptr(_res));
21193         CResult_PongDecodeErrorZ_free(_res_conv);
21194 }
21195
21196 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
21197         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21198         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
21199         return tag_ptr(ret_conv, true);
21200 }
21201 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
21202         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
21203         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
21204         return ret_conv;
21205 }
21206
21207 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
21208         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
21209         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21210         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
21211         return tag_ptr(ret_conv, true);
21212 }
21213
21214 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21215         LDKUnsignedChannelAnnouncement o_conv;
21216         o_conv.inner = untag_ptr(o);
21217         o_conv.is_owned = ptr_is_owned(o);
21218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21219         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
21220         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21221         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
21222         return tag_ptr(ret_conv, true);
21223 }
21224
21225 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21226         void* e_ptr = untag_ptr(e);
21227         CHECK_ACCESS(e_ptr);
21228         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21229         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21230         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21231         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
21232         return tag_ptr(ret_conv, true);
21233 }
21234
21235 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21236         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21237         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21238         return ret_conv;
21239 }
21240
21241 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21242         if (!ptr_is_owned(_res)) return;
21243         void* _res_ptr = untag_ptr(_res);
21244         CHECK_ACCESS(_res_ptr);
21245         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21246         FREE(untag_ptr(_res));
21247         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
21248 }
21249
21250 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21251         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21252         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
21253         return tag_ptr(ret_conv, true);
21254 }
21255 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21256         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21257         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21258         return ret_conv;
21259 }
21260
21261 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21262         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21263         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21264         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21265         return tag_ptr(ret_conv, true);
21266 }
21267
21268 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21269         LDKChannelAnnouncement o_conv;
21270         o_conv.inner = untag_ptr(o);
21271         o_conv.is_owned = ptr_is_owned(o);
21272         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21273         o_conv = ChannelAnnouncement_clone(&o_conv);
21274         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21275         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
21276         return tag_ptr(ret_conv, true);
21277 }
21278
21279 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21280         void* e_ptr = untag_ptr(e);
21281         CHECK_ACCESS(e_ptr);
21282         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21283         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21284         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21285         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
21286         return tag_ptr(ret_conv, true);
21287 }
21288
21289 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21290         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21291         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21292         return ret_conv;
21293 }
21294
21295 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21296         if (!ptr_is_owned(_res)) return;
21297         void* _res_ptr = untag_ptr(_res);
21298         CHECK_ACCESS(_res_ptr);
21299         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21300         FREE(untag_ptr(_res));
21301         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
21302 }
21303
21304 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21305         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21306         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
21307         return tag_ptr(ret_conv, true);
21308 }
21309 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21310         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21311         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21312         return ret_conv;
21313 }
21314
21315 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21316         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21317         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21318         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21319         return tag_ptr(ret_conv, true);
21320 }
21321
21322 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21323         LDKUnsignedChannelUpdate o_conv;
21324         o_conv.inner = untag_ptr(o);
21325         o_conv.is_owned = ptr_is_owned(o);
21326         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21327         o_conv = UnsignedChannelUpdate_clone(&o_conv);
21328         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21329         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
21330         return tag_ptr(ret_conv, true);
21331 }
21332
21333 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
21334         void* e_ptr = untag_ptr(e);
21335         CHECK_ACCESS(e_ptr);
21336         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21337         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21338         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21339         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
21340         return tag_ptr(ret_conv, true);
21341 }
21342
21343 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21344         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
21345         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
21346         return ret_conv;
21347 }
21348
21349 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21350         if (!ptr_is_owned(_res)) return;
21351         void* _res_ptr = untag_ptr(_res);
21352         CHECK_ACCESS(_res_ptr);
21353         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
21354         FREE(untag_ptr(_res));
21355         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
21356 }
21357
21358 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21359         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21360         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
21361         return tag_ptr(ret_conv, true);
21362 }
21363 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21364         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21365         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21366         return ret_conv;
21367 }
21368
21369 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21370         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21371         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21372         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
21373         return tag_ptr(ret_conv, true);
21374 }
21375
21376 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21377         LDKChannelUpdate o_conv;
21378         o_conv.inner = untag_ptr(o);
21379         o_conv.is_owned = ptr_is_owned(o);
21380         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21381         o_conv = ChannelUpdate_clone(&o_conv);
21382         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21383         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
21384         return tag_ptr(ret_conv, true);
21385 }
21386
21387 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
21388         void* e_ptr = untag_ptr(e);
21389         CHECK_ACCESS(e_ptr);
21390         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21391         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21392         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21393         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
21394         return tag_ptr(ret_conv, true);
21395 }
21396
21397 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21398         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
21399         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
21400         return ret_conv;
21401 }
21402
21403 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21404         if (!ptr_is_owned(_res)) return;
21405         void* _res_ptr = untag_ptr(_res);
21406         CHECK_ACCESS(_res_ptr);
21407         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
21408         FREE(untag_ptr(_res));
21409         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
21410 }
21411
21412 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21413         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21414         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
21415         return tag_ptr(ret_conv, true);
21416 }
21417 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21418         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21419         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21420         return ret_conv;
21421 }
21422
21423 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21424         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21425         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21426         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
21427         return tag_ptr(ret_conv, true);
21428 }
21429
21430 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
21431         LDKErrorMessage o_conv;
21432         o_conv.inner = untag_ptr(o);
21433         o_conv.is_owned = ptr_is_owned(o);
21434         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21435         o_conv = ErrorMessage_clone(&o_conv);
21436         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21437         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
21438         return tag_ptr(ret_conv, true);
21439 }
21440
21441 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
21442         void* e_ptr = untag_ptr(e);
21443         CHECK_ACCESS(e_ptr);
21444         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21445         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21446         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21447         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
21448         return tag_ptr(ret_conv, true);
21449 }
21450
21451 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
21452         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
21453         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
21454         return ret_conv;
21455 }
21456
21457 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
21458         if (!ptr_is_owned(_res)) return;
21459         void* _res_ptr = untag_ptr(_res);
21460         CHECK_ACCESS(_res_ptr);
21461         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
21462         FREE(untag_ptr(_res));
21463         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
21464 }
21465
21466 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
21467         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21468         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
21469         return tag_ptr(ret_conv, true);
21470 }
21471 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21472         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
21473         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
21474         return ret_conv;
21475 }
21476
21477 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
21478         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
21479         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21480         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
21481         return tag_ptr(ret_conv, true);
21482 }
21483
21484 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
21485         LDKWarningMessage o_conv;
21486         o_conv.inner = untag_ptr(o);
21487         o_conv.is_owned = ptr_is_owned(o);
21488         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21489         o_conv = WarningMessage_clone(&o_conv);
21490         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21491         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
21492         return tag_ptr(ret_conv, true);
21493 }
21494
21495 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
21496         void* e_ptr = untag_ptr(e);
21497         CHECK_ACCESS(e_ptr);
21498         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21499         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21500         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21501         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
21502         return tag_ptr(ret_conv, true);
21503 }
21504
21505 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
21506         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
21507         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
21508         return ret_conv;
21509 }
21510
21511 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
21512         if (!ptr_is_owned(_res)) return;
21513         void* _res_ptr = untag_ptr(_res);
21514         CHECK_ACCESS(_res_ptr);
21515         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
21516         FREE(untag_ptr(_res));
21517         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
21518 }
21519
21520 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
21521         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21522         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
21523         return tag_ptr(ret_conv, true);
21524 }
21525 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21526         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
21527         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
21528         return ret_conv;
21529 }
21530
21531 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
21532         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
21533         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21534         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
21535         return tag_ptr(ret_conv, true);
21536 }
21537
21538 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21539         LDKUnsignedNodeAnnouncement o_conv;
21540         o_conv.inner = untag_ptr(o);
21541         o_conv.is_owned = ptr_is_owned(o);
21542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21543         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
21544         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21545         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
21546         return tag_ptr(ret_conv, true);
21547 }
21548
21549 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21550         void* e_ptr = untag_ptr(e);
21551         CHECK_ACCESS(e_ptr);
21552         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21553         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21554         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21555         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
21556         return tag_ptr(ret_conv, true);
21557 }
21558
21559 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21560         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21561         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21562         return ret_conv;
21563 }
21564
21565 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21566         if (!ptr_is_owned(_res)) return;
21567         void* _res_ptr = untag_ptr(_res);
21568         CHECK_ACCESS(_res_ptr);
21569         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
21570         FREE(untag_ptr(_res));
21571         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
21572 }
21573
21574 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21575         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21576         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
21577         return tag_ptr(ret_conv, true);
21578 }
21579 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21580         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21581         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21582         return ret_conv;
21583 }
21584
21585 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21586         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21587         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21588         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
21589         return tag_ptr(ret_conv, true);
21590 }
21591
21592 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21593         LDKNodeAnnouncement o_conv;
21594         o_conv.inner = untag_ptr(o);
21595         o_conv.is_owned = ptr_is_owned(o);
21596         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21597         o_conv = NodeAnnouncement_clone(&o_conv);
21598         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21599         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
21600         return tag_ptr(ret_conv, true);
21601 }
21602
21603 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21604         void* e_ptr = untag_ptr(e);
21605         CHECK_ACCESS(e_ptr);
21606         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21607         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21608         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21609         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
21610         return tag_ptr(ret_conv, true);
21611 }
21612
21613 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21614         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21615         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21616         return ret_conv;
21617 }
21618
21619 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21620         if (!ptr_is_owned(_res)) return;
21621         void* _res_ptr = untag_ptr(_res);
21622         CHECK_ACCESS(_res_ptr);
21623         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
21624         FREE(untag_ptr(_res));
21625         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
21626 }
21627
21628 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21629         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21630         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
21631         return tag_ptr(ret_conv, true);
21632 }
21633 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21634         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21635         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21636         return ret_conv;
21637 }
21638
21639 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21640         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21641         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21642         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
21643         return tag_ptr(ret_conv, true);
21644 }
21645
21646 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
21647         LDKQueryShortChannelIds o_conv;
21648         o_conv.inner = untag_ptr(o);
21649         o_conv.is_owned = ptr_is_owned(o);
21650         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21651         o_conv = QueryShortChannelIds_clone(&o_conv);
21652         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21653         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
21654         return tag_ptr(ret_conv, true);
21655 }
21656
21657 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
21658         void* e_ptr = untag_ptr(e);
21659         CHECK_ACCESS(e_ptr);
21660         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21661         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21662         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21663         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
21664         return tag_ptr(ret_conv, true);
21665 }
21666
21667 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
21668         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
21669         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
21670         return ret_conv;
21671 }
21672
21673 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
21674         if (!ptr_is_owned(_res)) return;
21675         void* _res_ptr = untag_ptr(_res);
21676         CHECK_ACCESS(_res_ptr);
21677         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
21678         FREE(untag_ptr(_res));
21679         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
21680 }
21681
21682 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
21683         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21684         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
21685         return tag_ptr(ret_conv, true);
21686 }
21687 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
21688         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
21689         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
21690         return ret_conv;
21691 }
21692
21693 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
21694         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
21695         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21696         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
21697         return tag_ptr(ret_conv, true);
21698 }
21699
21700 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
21701         LDKReplyShortChannelIdsEnd o_conv;
21702         o_conv.inner = untag_ptr(o);
21703         o_conv.is_owned = ptr_is_owned(o);
21704         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21705         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
21706         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21707         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
21708         return tag_ptr(ret_conv, true);
21709 }
21710
21711 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
21712         void* e_ptr = untag_ptr(e);
21713         CHECK_ACCESS(e_ptr);
21714         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21715         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21716         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21717         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
21718         return tag_ptr(ret_conv, true);
21719 }
21720
21721 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
21722         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
21723         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
21724         return ret_conv;
21725 }
21726
21727 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
21728         if (!ptr_is_owned(_res)) return;
21729         void* _res_ptr = untag_ptr(_res);
21730         CHECK_ACCESS(_res_ptr);
21731         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
21732         FREE(untag_ptr(_res));
21733         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
21734 }
21735
21736 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
21737         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21738         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
21739         return tag_ptr(ret_conv, true);
21740 }
21741 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
21742         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
21743         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
21744         return ret_conv;
21745 }
21746
21747 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
21748         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
21749         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21750         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
21751         return tag_ptr(ret_conv, true);
21752 }
21753
21754 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
21755         LDKQueryChannelRange o_conv;
21756         o_conv.inner = untag_ptr(o);
21757         o_conv.is_owned = ptr_is_owned(o);
21758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21759         o_conv = QueryChannelRange_clone(&o_conv);
21760         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21761         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
21762         return tag_ptr(ret_conv, true);
21763 }
21764
21765 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
21766         void* e_ptr = untag_ptr(e);
21767         CHECK_ACCESS(e_ptr);
21768         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21769         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21770         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21771         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
21772         return tag_ptr(ret_conv, true);
21773 }
21774
21775 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21776         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
21777         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
21778         return ret_conv;
21779 }
21780
21781 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
21782         if (!ptr_is_owned(_res)) return;
21783         void* _res_ptr = untag_ptr(_res);
21784         CHECK_ACCESS(_res_ptr);
21785         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
21786         FREE(untag_ptr(_res));
21787         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
21788 }
21789
21790 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21791         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21792         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
21793         return tag_ptr(ret_conv, true);
21794 }
21795 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21796         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
21797         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21798         return ret_conv;
21799 }
21800
21801 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21802         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
21803         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21804         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
21805         return tag_ptr(ret_conv, true);
21806 }
21807
21808 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
21809         LDKReplyChannelRange o_conv;
21810         o_conv.inner = untag_ptr(o);
21811         o_conv.is_owned = ptr_is_owned(o);
21812         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21813         o_conv = ReplyChannelRange_clone(&o_conv);
21814         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21815         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
21816         return tag_ptr(ret_conv, true);
21817 }
21818
21819 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
21820         void* e_ptr = untag_ptr(e);
21821         CHECK_ACCESS(e_ptr);
21822         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21823         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21824         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21825         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
21826         return tag_ptr(ret_conv, true);
21827 }
21828
21829 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21830         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
21831         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
21832         return ret_conv;
21833 }
21834
21835 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
21836         if (!ptr_is_owned(_res)) return;
21837         void* _res_ptr = untag_ptr(_res);
21838         CHECK_ACCESS(_res_ptr);
21839         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
21840         FREE(untag_ptr(_res));
21841         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
21842 }
21843
21844 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21845         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21846         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
21847         return tag_ptr(ret_conv, true);
21848 }
21849 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21850         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
21851         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21852         return ret_conv;
21853 }
21854
21855 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21856         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
21857         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21858         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
21859         return tag_ptr(ret_conv, true);
21860 }
21861
21862 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
21863         LDKGossipTimestampFilter o_conv;
21864         o_conv.inner = untag_ptr(o);
21865         o_conv.is_owned = ptr_is_owned(o);
21866         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21867         o_conv = GossipTimestampFilter_clone(&o_conv);
21868         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21869         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
21870         return tag_ptr(ret_conv, true);
21871 }
21872
21873 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
21874         void* e_ptr = untag_ptr(e);
21875         CHECK_ACCESS(e_ptr);
21876         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21877         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21878         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21879         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
21880         return tag_ptr(ret_conv, true);
21881 }
21882
21883 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
21884         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
21885         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
21886         return ret_conv;
21887 }
21888
21889 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
21890         if (!ptr_is_owned(_res)) return;
21891         void* _res_ptr = untag_ptr(_res);
21892         CHECK_ACCESS(_res_ptr);
21893         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
21894         FREE(untag_ptr(_res));
21895         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
21896 }
21897
21898 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
21899         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21900         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
21901         return tag_ptr(ret_conv, true);
21902 }
21903 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
21904         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
21905         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
21906         return ret_conv;
21907 }
21908
21909 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
21910         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
21911         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21912         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
21913         return tag_ptr(ret_conv, true);
21914 }
21915
21916 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
21917         void* o_ptr = untag_ptr(o);
21918         CHECK_ACCESS(o_ptr);
21919         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
21920         if (o_conv.free == LDKFilter_JCalls_free) {
21921                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21922                 LDKFilter_JCalls_cloned(&o_conv);
21923         }
21924         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21925         *ret_copy = COption_FilterZ_some(o_conv);
21926         uint64_t ret_ref = tag_ptr(ret_copy, true);
21927         return ret_ref;
21928 }
21929
21930 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
21931         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21932         *ret_copy = COption_FilterZ_none();
21933         uint64_t ret_ref = tag_ptr(ret_copy, true);
21934         return ret_ref;
21935 }
21936
21937 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
21938         if (!ptr_is_owned(_res)) return;
21939         void* _res_ptr = untag_ptr(_res);
21940         CHECK_ACCESS(_res_ptr);
21941         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
21942         FREE(untag_ptr(_res));
21943         COption_FilterZ_free(_res_conv);
21944 }
21945
21946 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
21947         LDKLockedChannelMonitor o_conv;
21948         o_conv.inner = untag_ptr(o);
21949         o_conv.is_owned = ptr_is_owned(o);
21950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21951         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
21952         
21953         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21954         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
21955         return tag_ptr(ret_conv, true);
21956 }
21957
21958 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
21959         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21960         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
21961         return tag_ptr(ret_conv, true);
21962 }
21963
21964 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
21965         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
21966         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
21967         return ret_conv;
21968 }
21969
21970 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
21971         if (!ptr_is_owned(_res)) return;
21972         void* _res_ptr = untag_ptr(_res);
21973         CHECK_ACCESS(_res_ptr);
21974         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
21975         FREE(untag_ptr(_res));
21976         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
21977 }
21978
21979 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
21980         LDKCVec_OutPointZ _res_constr;
21981         _res_constr.datalen = _res->arr_len;
21982         if (_res_constr.datalen > 0)
21983                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
21984         else
21985                 _res_constr.data = NULL;
21986         uint64_t* _res_vals = _res->elems;
21987         for (size_t k = 0; k < _res_constr.datalen; k++) {
21988                 uint64_t _res_conv_10 = _res_vals[k];
21989                 LDKOutPoint _res_conv_10_conv;
21990                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21991                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21992                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21993                 _res_constr.data[k] = _res_conv_10_conv;
21994         }
21995         FREE(_res);
21996         CVec_OutPointZ_free(_res_constr);
21997 }
21998
21999 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
22000         LDKCVec_MonitorUpdateIdZ _res_constr;
22001         _res_constr.datalen = _res->arr_len;
22002         if (_res_constr.datalen > 0)
22003                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
22004         else
22005                 _res_constr.data = NULL;
22006         uint64_t* _res_vals = _res->elems;
22007         for (size_t r = 0; r < _res_constr.datalen; r++) {
22008                 uint64_t _res_conv_17 = _res_vals[r];
22009                 LDKMonitorUpdateId _res_conv_17_conv;
22010                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
22011                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
22012                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
22013                 _res_constr.data[r] = _res_conv_17_conv;
22014         }
22015         FREE(_res);
22016         CVec_MonitorUpdateIdZ_free(_res_constr);
22017 }
22018
22019 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
22020         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22021         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
22022         return tag_ptr(ret_conv, true);
22023 }
22024 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
22025         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
22026         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
22027         return ret_conv;
22028 }
22029
22030 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
22031         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
22032         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22033         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
22034         return tag_ptr(ret_conv, true);
22035 }
22036
22037 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
22038         LDKOutPoint a_conv;
22039         a_conv.inner = untag_ptr(a);
22040         a_conv.is_owned = ptr_is_owned(a);
22041         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22042         a_conv = OutPoint_clone(&a_conv);
22043         LDKCVec_MonitorUpdateIdZ b_constr;
22044         b_constr.datalen = b->arr_len;
22045         if (b_constr.datalen > 0)
22046                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
22047         else
22048                 b_constr.data = NULL;
22049         uint64_t* b_vals = b->elems;
22050         for (size_t r = 0; r < b_constr.datalen; r++) {
22051                 uint64_t b_conv_17 = b_vals[r];
22052                 LDKMonitorUpdateId b_conv_17_conv;
22053                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
22054                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
22055                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
22056                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
22057                 b_constr.data[r] = b_conv_17_conv;
22058         }
22059         FREE(b);
22060         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22061         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
22062         return tag_ptr(ret_conv, true);
22063 }
22064
22065 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
22066         if (!ptr_is_owned(_res)) return;
22067         void* _res_ptr = untag_ptr(_res);
22068         CHECK_ACCESS(_res_ptr);
22069         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
22070         FREE(untag_ptr(_res));
22071         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
22072 }
22073
22074 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
22075         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
22076         _res_constr.datalen = _res->arr_len;
22077         if (_res_constr.datalen > 0)
22078                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
22079         else
22080                 _res_constr.data = NULL;
22081         uint64_t* _res_vals = _res->elems;
22082         for (size_t p = 0; p < _res_constr.datalen; p++) {
22083                 uint64_t _res_conv_41 = _res_vals[p];
22084                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
22085                 CHECK_ACCESS(_res_conv_41_ptr);
22086                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
22087                 FREE(untag_ptr(_res_conv_41));
22088                 _res_constr.data[p] = _res_conv_41_conv;
22089         }
22090         FREE(_res);
22091         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
22092 }
22093
22094 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
22095         LDKCVec_PhantomRouteHintsZ _res_constr;
22096         _res_constr.datalen = _res->arr_len;
22097         if (_res_constr.datalen > 0)
22098                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
22099         else
22100                 _res_constr.data = NULL;
22101         uint64_t* _res_vals = _res->elems;
22102         for (size_t t = 0; t < _res_constr.datalen; t++) {
22103                 uint64_t _res_conv_19 = _res_vals[t];
22104                 LDKPhantomRouteHints _res_conv_19_conv;
22105                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
22106                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
22107                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22108                 _res_constr.data[t] = _res_conv_19_conv;
22109         }
22110         FREE(_res);
22111         CVec_PhantomRouteHintsZ_free(_res_constr);
22112 }
22113
22114 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
22115         LDKInvoice o_conv;
22116         o_conv.inner = untag_ptr(o);
22117         o_conv.is_owned = ptr_is_owned(o);
22118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22119         o_conv = Invoice_clone(&o_conv);
22120         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22121         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
22122         return tag_ptr(ret_conv, true);
22123 }
22124
22125 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
22126         void* e_ptr = untag_ptr(e);
22127         CHECK_ACCESS(e_ptr);
22128         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
22129         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
22130         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22131         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
22132         return tag_ptr(ret_conv, true);
22133 }
22134
22135 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
22136         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
22137         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
22138         return ret_conv;
22139 }
22140
22141 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
22142         if (!ptr_is_owned(_res)) return;
22143         void* _res_ptr = untag_ptr(_res);
22144         CHECK_ACCESS(_res_ptr);
22145         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
22146         FREE(untag_ptr(_res));
22147         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
22148 }
22149
22150 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
22151         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22152         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
22153         return tag_ptr(ret_conv, true);
22154 }
22155 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
22156         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
22157         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
22158         return ret_conv;
22159 }
22160
22161 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
22162         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
22163         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22164         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
22165         return tag_ptr(ret_conv, true);
22166 }
22167
22168 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
22169         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
22170         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22171         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
22172         return tag_ptr(ret_conv, true);
22173 }
22174
22175 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
22176         void* e_ptr = untag_ptr(e);
22177         CHECK_ACCESS(e_ptr);
22178         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
22179         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
22180         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22181         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
22182         return tag_ptr(ret_conv, true);
22183 }
22184
22185 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
22186         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
22187         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
22188         return ret_conv;
22189 }
22190
22191 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
22192         if (!ptr_is_owned(_res)) return;
22193         void* _res_ptr = untag_ptr(_res);
22194         CHECK_ACCESS(_res_ptr);
22195         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
22196         FREE(untag_ptr(_res));
22197         CResult_SiPrefixParseErrorZ_free(_res_conv);
22198 }
22199
22200 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
22201         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22202         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
22203         return tag_ptr(ret_conv, true);
22204 }
22205 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
22206         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
22207         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
22208         return ret_conv;
22209 }
22210
22211 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
22212         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
22213         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22214         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
22215         return tag_ptr(ret_conv, true);
22216 }
22217
22218 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
22219         LDKInvoice o_conv;
22220         o_conv.inner = untag_ptr(o);
22221         o_conv.is_owned = ptr_is_owned(o);
22222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22223         o_conv = Invoice_clone(&o_conv);
22224         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22225         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
22226         return tag_ptr(ret_conv, true);
22227 }
22228
22229 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
22230         void* e_ptr = untag_ptr(e);
22231         CHECK_ACCESS(e_ptr);
22232         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
22233         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
22234         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22235         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
22236         return tag_ptr(ret_conv, true);
22237 }
22238
22239 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
22240         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
22241         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
22242         return ret_conv;
22243 }
22244
22245 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
22246         if (!ptr_is_owned(_res)) return;
22247         void* _res_ptr = untag_ptr(_res);
22248         CHECK_ACCESS(_res_ptr);
22249         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
22250         FREE(untag_ptr(_res));
22251         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
22252 }
22253
22254 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
22255         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22256         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
22257         return tag_ptr(ret_conv, true);
22258 }
22259 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
22260         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
22261         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
22262         return ret_conv;
22263 }
22264
22265 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
22266         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
22267         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22268         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
22269         return tag_ptr(ret_conv, true);
22270 }
22271
22272 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
22273         LDKSignedRawInvoice o_conv;
22274         o_conv.inner = untag_ptr(o);
22275         o_conv.is_owned = ptr_is_owned(o);
22276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22277         o_conv = SignedRawInvoice_clone(&o_conv);
22278         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22279         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
22280         return tag_ptr(ret_conv, true);
22281 }
22282
22283 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
22284         void* e_ptr = untag_ptr(e);
22285         CHECK_ACCESS(e_ptr);
22286         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
22287         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
22288         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22289         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
22290         return tag_ptr(ret_conv, true);
22291 }
22292
22293 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
22294         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
22295         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
22296         return ret_conv;
22297 }
22298
22299 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
22300         if (!ptr_is_owned(_res)) return;
22301         void* _res_ptr = untag_ptr(_res);
22302         CHECK_ACCESS(_res_ptr);
22303         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
22304         FREE(untag_ptr(_res));
22305         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
22306 }
22307
22308 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
22309         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22310         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
22311         return tag_ptr(ret_conv, true);
22312 }
22313 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
22314         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
22315         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
22316         return ret_conv;
22317 }
22318
22319 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
22320         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
22321         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22322         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
22323         return tag_ptr(ret_conv, true);
22324 }
22325
22326 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
22327         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22328         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
22329         return tag_ptr(ret_conv, true);
22330 }
22331 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
22332         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
22333         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
22334         return ret_conv;
22335 }
22336
22337 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
22338         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
22339         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22340         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
22341         return tag_ptr(ret_conv, true);
22342 }
22343
22344 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
22345         LDKRawInvoice a_conv;
22346         a_conv.inner = untag_ptr(a);
22347         a_conv.is_owned = ptr_is_owned(a);
22348         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22349         a_conv = RawInvoice_clone(&a_conv);
22350         LDKThirtyTwoBytes b_ref;
22351         CHECK(b->arr_len == 32);
22352         memcpy(b_ref.data, b->elems, 32); FREE(b);
22353         LDKInvoiceSignature c_conv;
22354         c_conv.inner = untag_ptr(c);
22355         c_conv.is_owned = ptr_is_owned(c);
22356         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22357         c_conv = InvoiceSignature_clone(&c_conv);
22358         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22359         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
22360         return tag_ptr(ret_conv, true);
22361 }
22362
22363 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
22364         if (!ptr_is_owned(_res)) return;
22365         void* _res_ptr = untag_ptr(_res);
22366         CHECK_ACCESS(_res_ptr);
22367         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
22368         FREE(untag_ptr(_res));
22369         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
22370 }
22371
22372 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
22373         LDKPayeePubKey o_conv;
22374         o_conv.inner = untag_ptr(o);
22375         o_conv.is_owned = ptr_is_owned(o);
22376         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22377         o_conv = PayeePubKey_clone(&o_conv);
22378         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22379         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
22380         return tag_ptr(ret_conv, true);
22381 }
22382
22383 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
22384         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
22385         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22386         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
22387         return tag_ptr(ret_conv, true);
22388 }
22389
22390 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
22391         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
22392         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
22393         return ret_conv;
22394 }
22395
22396 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
22397         if (!ptr_is_owned(_res)) return;
22398         void* _res_ptr = untag_ptr(_res);
22399         CHECK_ACCESS(_res_ptr);
22400         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
22401         FREE(untag_ptr(_res));
22402         CResult_PayeePubKeyErrorZ_free(_res_conv);
22403 }
22404
22405 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
22406         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22407         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
22408         return tag_ptr(ret_conv, true);
22409 }
22410 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
22411         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
22412         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
22413         return ret_conv;
22414 }
22415
22416 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
22417         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
22418         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22419         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
22420         return tag_ptr(ret_conv, true);
22421 }
22422
22423 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
22424         LDKCVec_PrivateRouteZ _res_constr;
22425         _res_constr.datalen = _res->arr_len;
22426         if (_res_constr.datalen > 0)
22427                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
22428         else
22429                 _res_constr.data = NULL;
22430         uint64_t* _res_vals = _res->elems;
22431         for (size_t o = 0; o < _res_constr.datalen; o++) {
22432                 uint64_t _res_conv_14 = _res_vals[o];
22433                 LDKPrivateRoute _res_conv_14_conv;
22434                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
22435                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
22436                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
22437                 _res_constr.data[o] = _res_conv_14_conv;
22438         }
22439         FREE(_res);
22440         CVec_PrivateRouteZ_free(_res_constr);
22441 }
22442
22443 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
22444         LDKPositiveTimestamp o_conv;
22445         o_conv.inner = untag_ptr(o);
22446         o_conv.is_owned = ptr_is_owned(o);
22447         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22448         o_conv = PositiveTimestamp_clone(&o_conv);
22449         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22450         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
22451         return tag_ptr(ret_conv, true);
22452 }
22453
22454 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
22455         LDKCreationError e_conv = LDKCreationError_from_js(e);
22456         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22457         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
22458         return tag_ptr(ret_conv, true);
22459 }
22460
22461 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
22462         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
22463         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
22464         return ret_conv;
22465 }
22466
22467 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
22468         if (!ptr_is_owned(_res)) return;
22469         void* _res_ptr = untag_ptr(_res);
22470         CHECK_ACCESS(_res_ptr);
22471         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
22472         FREE(untag_ptr(_res));
22473         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
22474 }
22475
22476 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
22477         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22478         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
22479         return tag_ptr(ret_conv, true);
22480 }
22481 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
22482         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
22483         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
22484         return ret_conv;
22485 }
22486
22487 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
22488         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
22489         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22490         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
22491         return tag_ptr(ret_conv, true);
22492 }
22493
22494 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
22495         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22496         *ret_conv = CResult_NoneSemanticErrorZ_ok();
22497         return tag_ptr(ret_conv, true);
22498 }
22499
22500 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
22501         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
22502         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22503         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
22504         return tag_ptr(ret_conv, true);
22505 }
22506
22507 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
22508         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
22509         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
22510         return ret_conv;
22511 }
22512
22513 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
22514         if (!ptr_is_owned(_res)) return;
22515         void* _res_ptr = untag_ptr(_res);
22516         CHECK_ACCESS(_res_ptr);
22517         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
22518         FREE(untag_ptr(_res));
22519         CResult_NoneSemanticErrorZ_free(_res_conv);
22520 }
22521
22522 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
22523         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22524         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
22525         return tag_ptr(ret_conv, true);
22526 }
22527 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
22528         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
22529         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
22530         return ret_conv;
22531 }
22532
22533 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
22534         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
22535         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22536         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
22537         return tag_ptr(ret_conv, true);
22538 }
22539
22540 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
22541         LDKInvoice o_conv;
22542         o_conv.inner = untag_ptr(o);
22543         o_conv.is_owned = ptr_is_owned(o);
22544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22545         o_conv = Invoice_clone(&o_conv);
22546         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22547         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
22548         return tag_ptr(ret_conv, true);
22549 }
22550
22551 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
22552         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
22553         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22554         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
22555         return tag_ptr(ret_conv, true);
22556 }
22557
22558 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
22559         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
22560         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
22561         return ret_conv;
22562 }
22563
22564 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
22565         if (!ptr_is_owned(_res)) return;
22566         void* _res_ptr = untag_ptr(_res);
22567         CHECK_ACCESS(_res_ptr);
22568         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
22569         FREE(untag_ptr(_res));
22570         CResult_InvoiceSemanticErrorZ_free(_res_conv);
22571 }
22572
22573 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
22574         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22575         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
22576         return tag_ptr(ret_conv, true);
22577 }
22578 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
22579         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
22580         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
22581         return ret_conv;
22582 }
22583
22584 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
22585         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
22586         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22587         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
22588         return tag_ptr(ret_conv, true);
22589 }
22590
22591 void  __attribute__((export_name("TS_CVec_AddressZ_free"))) TS_CVec_AddressZ_free(ptrArray _res) {
22592         LDKCVec_AddressZ _res_constr;
22593         _res_constr.datalen = _res->arr_len;
22594         if (_res_constr.datalen > 0)
22595                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_AddressZ Elements");
22596         else
22597                 _res_constr.data = NULL;
22598         jstring* _res_vals = (void*) _res->elems;
22599         for (size_t i = 0; i < _res_constr.datalen; i++) {
22600                 jstring _res_conv_8 = _res_vals[i];
22601                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
22602                 _res_constr.data[i] = dummy;
22603         }
22604         FREE(_res);
22605         CVec_AddressZ_free(_res_constr);
22606 }
22607
22608 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
22609         LDKDescription o_conv;
22610         o_conv.inner = untag_ptr(o);
22611         o_conv.is_owned = ptr_is_owned(o);
22612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22613         o_conv = Description_clone(&o_conv);
22614         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22615         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
22616         return tag_ptr(ret_conv, true);
22617 }
22618
22619 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
22620         LDKCreationError e_conv = LDKCreationError_from_js(e);
22621         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22622         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
22623         return tag_ptr(ret_conv, true);
22624 }
22625
22626 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
22627         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
22628         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
22629         return ret_conv;
22630 }
22631
22632 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
22633         if (!ptr_is_owned(_res)) return;
22634         void* _res_ptr = untag_ptr(_res);
22635         CHECK_ACCESS(_res_ptr);
22636         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
22637         FREE(untag_ptr(_res));
22638         CResult_DescriptionCreationErrorZ_free(_res_conv);
22639 }
22640
22641 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
22642         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22643         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
22644         return tag_ptr(ret_conv, true);
22645 }
22646 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
22647         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
22648         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
22649         return ret_conv;
22650 }
22651
22652 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
22653         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
22654         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22655         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
22656         return tag_ptr(ret_conv, true);
22657 }
22658
22659 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
22660         LDKPrivateRoute o_conv;
22661         o_conv.inner = untag_ptr(o);
22662         o_conv.is_owned = ptr_is_owned(o);
22663         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22664         o_conv = PrivateRoute_clone(&o_conv);
22665         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22666         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
22667         return tag_ptr(ret_conv, true);
22668 }
22669
22670 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
22671         LDKCreationError e_conv = LDKCreationError_from_js(e);
22672         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22673         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
22674         return tag_ptr(ret_conv, true);
22675 }
22676
22677 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
22678         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
22679         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
22680         return ret_conv;
22681 }
22682
22683 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
22684         if (!ptr_is_owned(_res)) return;
22685         void* _res_ptr = untag_ptr(_res);
22686         CHECK_ACCESS(_res_ptr);
22687         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
22688         FREE(untag_ptr(_res));
22689         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
22690 }
22691
22692 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
22693         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22694         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
22695         return tag_ptr(ret_conv, true);
22696 }
22697 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
22698         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
22699         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
22700         return ret_conv;
22701 }
22702
22703 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
22704         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
22705         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22706         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
22707         return tag_ptr(ret_conv, true);
22708 }
22709
22710 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
22711         if (!ptr_is_owned(this_ptr)) return;
22712         void* this_ptr_ptr = untag_ptr(this_ptr);
22713         CHECK_ACCESS(this_ptr_ptr);
22714         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
22715         FREE(untag_ptr(this_ptr));
22716         APIError_free(this_ptr_conv);
22717 }
22718
22719 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
22720         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22721         *ret_copy = APIError_clone(arg);
22722         uint64_t ret_ref = tag_ptr(ret_copy, true);
22723         return ret_ref;
22724 }
22725 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
22726         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
22727         int64_t ret_conv = APIError_clone_ptr(arg_conv);
22728         return ret_conv;
22729 }
22730
22731 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
22732         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
22733         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22734         *ret_copy = APIError_clone(orig_conv);
22735         uint64_t ret_ref = tag_ptr(ret_copy, true);
22736         return ret_ref;
22737 }
22738
22739 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
22740         LDKStr err_conv = str_ref_to_owned_c(err);
22741         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22742         *ret_copy = APIError_apimisuse_error(err_conv);
22743         uint64_t ret_ref = tag_ptr(ret_copy, true);
22744         return ret_ref;
22745 }
22746
22747 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
22748         LDKStr err_conv = str_ref_to_owned_c(err);
22749         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22750         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
22751         uint64_t ret_ref = tag_ptr(ret_copy, true);
22752         return ret_ref;
22753 }
22754
22755 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
22756         LDKStr err_conv = str_ref_to_owned_c(err);
22757         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22758         *ret_copy = APIError_invalid_route(err_conv);
22759         uint64_t ret_ref = tag_ptr(ret_copy, true);
22760         return ret_ref;
22761 }
22762
22763 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
22764         LDKStr err_conv = str_ref_to_owned_c(err);
22765         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22766         *ret_copy = APIError_channel_unavailable(err_conv);
22767         uint64_t ret_ref = tag_ptr(ret_copy, true);
22768         return ret_ref;
22769 }
22770
22771 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
22772         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22773         *ret_copy = APIError_monitor_update_in_progress();
22774         uint64_t ret_ref = tag_ptr(ret_copy, true);
22775         return ret_ref;
22776 }
22777
22778 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
22779         LDKShutdownScript script_conv;
22780         script_conv.inner = untag_ptr(script);
22781         script_conv.is_owned = ptr_is_owned(script);
22782         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
22783         script_conv = ShutdownScript_clone(&script_conv);
22784         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22785         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
22786         uint64_t ret_ref = tag_ptr(ret_copy, true);
22787         return ret_ref;
22788 }
22789
22790 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
22791         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
22792         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
22793         jboolean ret_conv = APIError_eq(a_conv, b_conv);
22794         return ret_conv;
22795 }
22796
22797 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
22798         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
22799         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
22800         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22801         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22802         CVec_u8Z_free(ret_var);
22803         return ret_arr;
22804 }
22805
22806 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
22807         LDKu8slice ser_ref;
22808         ser_ref.datalen = ser->arr_len;
22809         ser_ref.data = ser->elems;
22810         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
22811         *ret_conv = APIError_read(ser_ref);
22812         FREE(ser);
22813         return tag_ptr(ret_conv, true);
22814 }
22815
22816 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
22817         LDKBigSize this_obj_conv;
22818         this_obj_conv.inner = untag_ptr(this_obj);
22819         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22821         BigSize_free(this_obj_conv);
22822 }
22823
22824 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
22825         LDKBigSize this_ptr_conv;
22826         this_ptr_conv.inner = untag_ptr(this_ptr);
22827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22829         this_ptr_conv.is_owned = false;
22830         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
22831         return ret_conv;
22832 }
22833
22834 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
22835         LDKBigSize this_ptr_conv;
22836         this_ptr_conv.inner = untag_ptr(this_ptr);
22837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22839         this_ptr_conv.is_owned = false;
22840         BigSize_set_a(&this_ptr_conv, val);
22841 }
22842
22843 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
22844         LDKBigSize ret_var = BigSize_new(a_arg);
22845         uint64_t ret_ref = 0;
22846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22848         return ret_ref;
22849 }
22850
22851 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
22852         LDKHostname this_obj_conv;
22853         this_obj_conv.inner = untag_ptr(this_obj);
22854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22856         Hostname_free(this_obj_conv);
22857 }
22858
22859 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
22860         LDKHostname ret_var = Hostname_clone(arg);
22861         uint64_t ret_ref = 0;
22862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22864         return ret_ref;
22865 }
22866 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
22867         LDKHostname arg_conv;
22868         arg_conv.inner = untag_ptr(arg);
22869         arg_conv.is_owned = ptr_is_owned(arg);
22870         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22871         arg_conv.is_owned = false;
22872         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
22873         return ret_conv;
22874 }
22875
22876 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
22877         LDKHostname orig_conv;
22878         orig_conv.inner = untag_ptr(orig);
22879         orig_conv.is_owned = ptr_is_owned(orig);
22880         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22881         orig_conv.is_owned = false;
22882         LDKHostname ret_var = Hostname_clone(&orig_conv);
22883         uint64_t ret_ref = 0;
22884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22886         return ret_ref;
22887 }
22888
22889 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
22890         LDKHostname a_conv;
22891         a_conv.inner = untag_ptr(a);
22892         a_conv.is_owned = ptr_is_owned(a);
22893         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22894         a_conv.is_owned = false;
22895         LDKHostname b_conv;
22896         b_conv.inner = untag_ptr(b);
22897         b_conv.is_owned = ptr_is_owned(b);
22898         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22899         b_conv.is_owned = false;
22900         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
22901         return ret_conv;
22902 }
22903
22904 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
22905         LDKHostname this_arg_conv;
22906         this_arg_conv.inner = untag_ptr(this_arg);
22907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22909         this_arg_conv.is_owned = false;
22910         int8_t ret_conv = Hostname_len(&this_arg_conv);
22911         return ret_conv;
22912 }
22913
22914 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
22915         LDKu8slice msg_ref;
22916         msg_ref.datalen = msg->arr_len;
22917         msg_ref.data = msg->elems;
22918         uint8_t sk_arr[32];
22919         CHECK(sk->arr_len == 32);
22920         memcpy(sk_arr, sk->elems, 32); FREE(sk);
22921         uint8_t (*sk_ref)[32] = &sk_arr;
22922         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22923         *ret_conv = sign(msg_ref, sk_ref);
22924         FREE(msg);
22925         return tag_ptr(ret_conv, true);
22926 }
22927
22928 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
22929         LDKu8slice msg_ref;
22930         msg_ref.datalen = msg->arr_len;
22931         msg_ref.data = msg->elems;
22932         LDKStr sig_conv = str_ref_to_owned_c(sig);
22933         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22934         *ret_conv = recover_pk(msg_ref, sig_conv);
22935         FREE(msg);
22936         return tag_ptr(ret_conv, true);
22937 }
22938
22939 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
22940         LDKu8slice msg_ref;
22941         msg_ref.datalen = msg->arr_len;
22942         msg_ref.data = msg->elems;
22943         LDKStr sig_conv = str_ref_to_owned_c(sig);
22944         LDKPublicKey pk_ref;
22945         CHECK(pk->arr_len == 33);
22946         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
22947         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
22948         FREE(msg);
22949         return ret_conv;
22950 }
22951
22952 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
22953         LDKu8slice hrp_bytes_ref;
22954         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
22955         hrp_bytes_ref.data = hrp_bytes->elems;
22956         LDKCVec_U5Z data_without_signature_constr;
22957         data_without_signature_constr.datalen = data_without_signature->arr_len;
22958         if (data_without_signature_constr.datalen > 0)
22959                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
22960         else
22961                 data_without_signature_constr.data = NULL;
22962         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
22963         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
22964                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
22965                 
22966                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
22967         }
22968         FREE(data_without_signature);
22969         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
22970         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22971         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22972         CVec_u8Z_free(ret_var);
22973         FREE(hrp_bytes);
22974         return ret_arr;
22975 }
22976
22977 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
22978         if (!ptr_is_owned(this_ptr)) return;
22979         void* this_ptr_ptr = untag_ptr(this_ptr);
22980         CHECK_ACCESS(this_ptr_ptr);
22981         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
22982         FREE(untag_ptr(this_ptr));
22983         Persister_free(this_ptr_conv);
22984 }
22985
22986 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
22987         LDKUntrustedString this_obj_conv;
22988         this_obj_conv.inner = untag_ptr(this_obj);
22989         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22991         UntrustedString_free(this_obj_conv);
22992 }
22993
22994 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
22995         LDKUntrustedString this_ptr_conv;
22996         this_ptr_conv.inner = untag_ptr(this_ptr);
22997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22999         this_ptr_conv.is_owned = false;
23000         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
23001         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23002         Str_free(ret_str);
23003         return ret_conv;
23004 }
23005
23006 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
23007         LDKUntrustedString this_ptr_conv;
23008         this_ptr_conv.inner = untag_ptr(this_ptr);
23009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23011         this_ptr_conv.is_owned = false;
23012         LDKStr val_conv = str_ref_to_owned_c(val);
23013         UntrustedString_set_a(&this_ptr_conv, val_conv);
23014 }
23015
23016 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
23017         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
23018         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
23019         uint64_t ret_ref = 0;
23020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23022         return ret_ref;
23023 }
23024
23025 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
23026         LDKUntrustedString ret_var = UntrustedString_clone(arg);
23027         uint64_t ret_ref = 0;
23028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23030         return ret_ref;
23031 }
23032 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
23033         LDKUntrustedString arg_conv;
23034         arg_conv.inner = untag_ptr(arg);
23035         arg_conv.is_owned = ptr_is_owned(arg);
23036         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23037         arg_conv.is_owned = false;
23038         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
23039         return ret_conv;
23040 }
23041
23042 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
23043         LDKUntrustedString orig_conv;
23044         orig_conv.inner = untag_ptr(orig);
23045         orig_conv.is_owned = ptr_is_owned(orig);
23046         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23047         orig_conv.is_owned = false;
23048         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
23049         uint64_t ret_ref = 0;
23050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23052         return ret_ref;
23053 }
23054
23055 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
23056         LDKUntrustedString a_conv;
23057         a_conv.inner = untag_ptr(a);
23058         a_conv.is_owned = ptr_is_owned(a);
23059         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23060         a_conv.is_owned = false;
23061         LDKUntrustedString b_conv;
23062         b_conv.inner = untag_ptr(b);
23063         b_conv.is_owned = ptr_is_owned(b);
23064         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23065         b_conv.is_owned = false;
23066         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
23067         return ret_conv;
23068 }
23069
23070 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
23071         LDKUntrustedString obj_conv;
23072         obj_conv.inner = untag_ptr(obj);
23073         obj_conv.is_owned = ptr_is_owned(obj);
23074         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23075         obj_conv.is_owned = false;
23076         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
23077         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23078         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23079         CVec_u8Z_free(ret_var);
23080         return ret_arr;
23081 }
23082
23083 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
23084         LDKu8slice ser_ref;
23085         ser_ref.datalen = ser->arr_len;
23086         ser_ref.data = ser->elems;
23087         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
23088         *ret_conv = UntrustedString_read(ser_ref);
23089         FREE(ser);
23090         return tag_ptr(ret_conv, true);
23091 }
23092
23093 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
23094         LDKPrintableString this_obj_conv;
23095         this_obj_conv.inner = untag_ptr(this_obj);
23096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23098         PrintableString_free(this_obj_conv);
23099 }
23100
23101 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
23102         LDKPrintableString this_ptr_conv;
23103         this_ptr_conv.inner = untag_ptr(this_ptr);
23104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23106         this_ptr_conv.is_owned = false;
23107         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
23108         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23109         Str_free(ret_str);
23110         return ret_conv;
23111 }
23112
23113 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
23114         LDKPrintableString this_ptr_conv;
23115         this_ptr_conv.inner = untag_ptr(this_ptr);
23116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23118         this_ptr_conv.is_owned = false;
23119         LDKStr val_conv = str_ref_to_owned_c(val);
23120         PrintableString_set_a(&this_ptr_conv, val_conv);
23121 }
23122
23123 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
23124         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
23125         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
23126         uint64_t ret_ref = 0;
23127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23129         return ret_ref;
23130 }
23131
23132 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
23133         if (!ptr_is_owned(this_ptr)) return;
23134         void* this_ptr_ptr = untag_ptr(this_ptr);
23135         CHECK_ACCESS(this_ptr_ptr);
23136         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
23137         FREE(untag_ptr(this_ptr));
23138         FutureCallback_free(this_ptr_conv);
23139 }
23140
23141 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
23142         LDKFuture this_obj_conv;
23143         this_obj_conv.inner = untag_ptr(this_obj);
23144         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23146         Future_free(this_obj_conv);
23147 }
23148
23149 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
23150         LDKFuture ret_var = Future_clone(arg);
23151         uint64_t ret_ref = 0;
23152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23154         return ret_ref;
23155 }
23156 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
23157         LDKFuture arg_conv;
23158         arg_conv.inner = untag_ptr(arg);
23159         arg_conv.is_owned = ptr_is_owned(arg);
23160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23161         arg_conv.is_owned = false;
23162         int64_t ret_conv = Future_clone_ptr(&arg_conv);
23163         return ret_conv;
23164 }
23165
23166 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
23167         LDKFuture orig_conv;
23168         orig_conv.inner = untag_ptr(orig);
23169         orig_conv.is_owned = ptr_is_owned(orig);
23170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23171         orig_conv.is_owned = false;
23172         LDKFuture ret_var = Future_clone(&orig_conv);
23173         uint64_t ret_ref = 0;
23174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23176         return ret_ref;
23177 }
23178
23179 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
23180         LDKFuture this_arg_conv;
23181         this_arg_conv.inner = untag_ptr(this_arg);
23182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23184         this_arg_conv.is_owned = false;
23185         void* callback_ptr = untag_ptr(callback);
23186         CHECK_ACCESS(callback_ptr);
23187         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
23188         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
23189                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23190                 LDKFutureCallback_JCalls_cloned(&callback_conv);
23191         }
23192         Future_register_callback_fn(&this_arg_conv, callback_conv);
23193 }
23194
23195 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
23196         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
23197         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
23198         return ret_conv;
23199 }
23200
23201 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
23202         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
23203         return ret_conv;
23204 }
23205
23206 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
23207         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
23208         return ret_conv;
23209 }
23210
23211 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
23212         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
23213         return ret_conv;
23214 }
23215
23216 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
23217         uint32_t ret_conv = LDKLevel_to_js(Level_info());
23218         return ret_conv;
23219 }
23220
23221 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
23222         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
23223         return ret_conv;
23224 }
23225
23226 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
23227         uint32_t ret_conv = LDKLevel_to_js(Level_error());
23228         return ret_conv;
23229 }
23230
23231 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
23232         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
23233         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
23234         jboolean ret_conv = Level_eq(a_conv, b_conv);
23235         return ret_conv;
23236 }
23237
23238 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
23239         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
23240         int64_t ret_conv = Level_hash(o_conv);
23241         return ret_conv;
23242 }
23243
23244 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
23245         uint32_t ret_conv = LDKLevel_to_js(Level_max());
23246         return ret_conv;
23247 }
23248
23249 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
23250         LDKRecord this_obj_conv;
23251         this_obj_conv.inner = untag_ptr(this_obj);
23252         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23254         Record_free(this_obj_conv);
23255 }
23256
23257 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(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         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
23264         return ret_conv;
23265 }
23266
23267 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
23268         LDKRecord this_ptr_conv;
23269         this_ptr_conv.inner = untag_ptr(this_ptr);
23270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23272         this_ptr_conv.is_owned = false;
23273         LDKLevel val_conv = LDKLevel_from_js(val);
23274         Record_set_level(&this_ptr_conv, val_conv);
23275 }
23276
23277 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
23278         LDKRecord this_ptr_conv;
23279         this_ptr_conv.inner = untag_ptr(this_ptr);
23280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23282         this_ptr_conv.is_owned = false;
23283         LDKStr ret_str = Record_get_args(&this_ptr_conv);
23284         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23285         Str_free(ret_str);
23286         return ret_conv;
23287 }
23288
23289 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
23290         LDKRecord this_ptr_conv;
23291         this_ptr_conv.inner = untag_ptr(this_ptr);
23292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23294         this_ptr_conv.is_owned = false;
23295         LDKStr val_conv = str_ref_to_owned_c(val);
23296         Record_set_args(&this_ptr_conv, val_conv);
23297 }
23298
23299 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
23300         LDKRecord this_ptr_conv;
23301         this_ptr_conv.inner = untag_ptr(this_ptr);
23302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23304         this_ptr_conv.is_owned = false;
23305         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23306         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23307         Str_free(ret_str);
23308         return ret_conv;
23309 }
23310
23311 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
23312         LDKRecord this_ptr_conv;
23313         this_ptr_conv.inner = untag_ptr(this_ptr);
23314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23316         this_ptr_conv.is_owned = false;
23317         LDKStr val_conv = str_ref_to_owned_c(val);
23318         Record_set_module_path(&this_ptr_conv, val_conv);
23319 }
23320
23321 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
23322         LDKRecord this_ptr_conv;
23323         this_ptr_conv.inner = untag_ptr(this_ptr);
23324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23326         this_ptr_conv.is_owned = false;
23327         LDKStr ret_str = Record_get_file(&this_ptr_conv);
23328         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23329         Str_free(ret_str);
23330         return ret_conv;
23331 }
23332
23333 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring 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         LDKStr val_conv = str_ref_to_owned_c(val);
23340         Record_set_file(&this_ptr_conv, val_conv);
23341 }
23342
23343 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
23344         LDKRecord this_ptr_conv;
23345         this_ptr_conv.inner = untag_ptr(this_ptr);
23346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23348         this_ptr_conv.is_owned = false;
23349         int32_t ret_conv = Record_get_line(&this_ptr_conv);
23350         return ret_conv;
23351 }
23352
23353 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
23354         LDKRecord this_ptr_conv;
23355         this_ptr_conv.inner = untag_ptr(this_ptr);
23356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23358         this_ptr_conv.is_owned = false;
23359         Record_set_line(&this_ptr_conv, val);
23360 }
23361
23362 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23363         LDKRecord ret_var = Record_clone(arg);
23364         uint64_t ret_ref = 0;
23365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23367         return ret_ref;
23368 }
23369 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
23370         LDKRecord arg_conv;
23371         arg_conv.inner = untag_ptr(arg);
23372         arg_conv.is_owned = ptr_is_owned(arg);
23373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23374         arg_conv.is_owned = false;
23375         int64_t ret_conv = Record_clone_ptr(&arg_conv);
23376         return ret_conv;
23377 }
23378
23379 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
23380         LDKRecord orig_conv;
23381         orig_conv.inner = untag_ptr(orig);
23382         orig_conv.is_owned = ptr_is_owned(orig);
23383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23384         orig_conv.is_owned = false;
23385         LDKRecord ret_var = Record_clone(&orig_conv);
23386         uint64_t ret_ref = 0;
23387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23389         return ret_ref;
23390 }
23391
23392 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
23393         if (!ptr_is_owned(this_ptr)) return;
23394         void* this_ptr_ptr = untag_ptr(this_ptr);
23395         CHECK_ACCESS(this_ptr_ptr);
23396         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23397         FREE(untag_ptr(this_ptr));
23398         Logger_free(this_ptr_conv);
23399 }
23400
23401 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
23402         LDKChannelHandshakeConfig this_obj_conv;
23403         this_obj_conv.inner = untag_ptr(this_obj);
23404         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23406         ChannelHandshakeConfig_free(this_obj_conv);
23407 }
23408
23409 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
23410         LDKChannelHandshakeConfig this_ptr_conv;
23411         this_ptr_conv.inner = untag_ptr(this_ptr);
23412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23414         this_ptr_conv.is_owned = false;
23415         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23416         return ret_conv;
23417 }
23418
23419 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
23420         LDKChannelHandshakeConfig this_ptr_conv;
23421         this_ptr_conv.inner = untag_ptr(this_ptr);
23422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23424         this_ptr_conv.is_owned = false;
23425         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23426 }
23427
23428 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
23429         LDKChannelHandshakeConfig this_ptr_conv;
23430         this_ptr_conv.inner = untag_ptr(this_ptr);
23431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23433         this_ptr_conv.is_owned = false;
23434         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23435         return ret_conv;
23436 }
23437
23438 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) {
23439         LDKChannelHandshakeConfig this_ptr_conv;
23440         this_ptr_conv.inner = untag_ptr(this_ptr);
23441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23443         this_ptr_conv.is_owned = false;
23444         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23445 }
23446
23447 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
23448         LDKChannelHandshakeConfig this_ptr_conv;
23449         this_ptr_conv.inner = untag_ptr(this_ptr);
23450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23452         this_ptr_conv.is_owned = false;
23453         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23454         return ret_conv;
23455 }
23456
23457 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) {
23458         LDKChannelHandshakeConfig this_ptr_conv;
23459         this_ptr_conv.inner = untag_ptr(this_ptr);
23460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23462         this_ptr_conv.is_owned = false;
23463         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23464 }
23465
23466 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) {
23467         LDKChannelHandshakeConfig this_ptr_conv;
23468         this_ptr_conv.inner = untag_ptr(this_ptr);
23469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23471         this_ptr_conv.is_owned = false;
23472         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
23473         return ret_conv;
23474 }
23475
23476 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) {
23477         LDKChannelHandshakeConfig this_ptr_conv;
23478         this_ptr_conv.inner = untag_ptr(this_ptr);
23479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23481         this_ptr_conv.is_owned = false;
23482         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
23483 }
23484
23485 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
23486         LDKChannelHandshakeConfig this_ptr_conv;
23487         this_ptr_conv.inner = untag_ptr(this_ptr);
23488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23490         this_ptr_conv.is_owned = false;
23491         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
23492         return ret_conv;
23493 }
23494
23495 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
23496         LDKChannelHandshakeConfig this_ptr_conv;
23497         this_ptr_conv.inner = untag_ptr(this_ptr);
23498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23500         this_ptr_conv.is_owned = false;
23501         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
23502 }
23503
23504 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
23505         LDKChannelHandshakeConfig this_ptr_conv;
23506         this_ptr_conv.inner = untag_ptr(this_ptr);
23507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23509         this_ptr_conv.is_owned = false;
23510         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
23511         return ret_conv;
23512 }
23513
23514 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
23515         LDKChannelHandshakeConfig this_ptr_conv;
23516         this_ptr_conv.inner = untag_ptr(this_ptr);
23517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23519         this_ptr_conv.is_owned = false;
23520         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
23521 }
23522
23523 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
23524         LDKChannelHandshakeConfig this_ptr_conv;
23525         this_ptr_conv.inner = untag_ptr(this_ptr);
23526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23528         this_ptr_conv.is_owned = false;
23529         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
23530         return ret_conv;
23531 }
23532
23533 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
23534         LDKChannelHandshakeConfig this_ptr_conv;
23535         this_ptr_conv.inner = untag_ptr(this_ptr);
23536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23538         this_ptr_conv.is_owned = false;
23539         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
23540 }
23541
23542 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) {
23543         LDKChannelHandshakeConfig this_ptr_conv;
23544         this_ptr_conv.inner = untag_ptr(this_ptr);
23545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23547         this_ptr_conv.is_owned = false;
23548         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
23549         return ret_conv;
23550 }
23551
23552 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) {
23553         LDKChannelHandshakeConfig this_ptr_conv;
23554         this_ptr_conv.inner = untag_ptr(this_ptr);
23555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23557         this_ptr_conv.is_owned = false;
23558         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
23559 }
23560
23561 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
23562         LDKChannelHandshakeConfig this_ptr_conv;
23563         this_ptr_conv.inner = untag_ptr(this_ptr);
23564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23566         this_ptr_conv.is_owned = false;
23567         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
23568         return ret_conv;
23569 }
23570
23571 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) {
23572         LDKChannelHandshakeConfig this_ptr_conv;
23573         this_ptr_conv.inner = untag_ptr(this_ptr);
23574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23576         this_ptr_conv.is_owned = false;
23577         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
23578 }
23579
23580 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) {
23581         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);
23582         uint64_t ret_ref = 0;
23583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23585         return ret_ref;
23586 }
23587
23588 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23589         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23590         uint64_t ret_ref = 0;
23591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23593         return ret_ref;
23594 }
23595 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
23596         LDKChannelHandshakeConfig arg_conv;
23597         arg_conv.inner = untag_ptr(arg);
23598         arg_conv.is_owned = ptr_is_owned(arg);
23599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23600         arg_conv.is_owned = false;
23601         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23602         return ret_conv;
23603 }
23604
23605 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
23606         LDKChannelHandshakeConfig orig_conv;
23607         orig_conv.inner = untag_ptr(orig);
23608         orig_conv.is_owned = ptr_is_owned(orig);
23609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23610         orig_conv.is_owned = false;
23611         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23612         uint64_t ret_ref = 0;
23613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23615         return ret_ref;
23616 }
23617
23618 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
23619         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23620         uint64_t ret_ref = 0;
23621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23623         return ret_ref;
23624 }
23625
23626 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
23627         LDKChannelHandshakeLimits this_obj_conv;
23628         this_obj_conv.inner = untag_ptr(this_obj);
23629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23631         ChannelHandshakeLimits_free(this_obj_conv);
23632 }
23633
23634 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
23635         LDKChannelHandshakeLimits this_ptr_conv;
23636         this_ptr_conv.inner = untag_ptr(this_ptr);
23637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23639         this_ptr_conv.is_owned = false;
23640         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23641         return ret_conv;
23642 }
23643
23644 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
23645         LDKChannelHandshakeLimits this_ptr_conv;
23646         this_ptr_conv.inner = untag_ptr(this_ptr);
23647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23649         this_ptr_conv.is_owned = false;
23650         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23651 }
23652
23653 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
23654         LDKChannelHandshakeLimits this_ptr_conv;
23655         this_ptr_conv.inner = untag_ptr(this_ptr);
23656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23658         this_ptr_conv.is_owned = false;
23659         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
23660         return ret_conv;
23661 }
23662
23663 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
23664         LDKChannelHandshakeLimits this_ptr_conv;
23665         this_ptr_conv.inner = untag_ptr(this_ptr);
23666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23668         this_ptr_conv.is_owned = false;
23669         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
23670 }
23671
23672 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
23673         LDKChannelHandshakeLimits this_ptr_conv;
23674         this_ptr_conv.inner = untag_ptr(this_ptr);
23675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23677         this_ptr_conv.is_owned = false;
23678         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23679         return ret_conv;
23680 }
23681
23682 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) {
23683         LDKChannelHandshakeLimits this_ptr_conv;
23684         this_ptr_conv.inner = untag_ptr(this_ptr);
23685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23687         this_ptr_conv.is_owned = false;
23688         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23689 }
23690
23691 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) {
23692         LDKChannelHandshakeLimits this_ptr_conv;
23693         this_ptr_conv.inner = untag_ptr(this_ptr);
23694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23696         this_ptr_conv.is_owned = false;
23697         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23698         return ret_conv;
23699 }
23700
23701 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) {
23702         LDKChannelHandshakeLimits this_ptr_conv;
23703         this_ptr_conv.inner = untag_ptr(this_ptr);
23704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23706         this_ptr_conv.is_owned = false;
23707         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23708 }
23709
23710 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
23711         LDKChannelHandshakeLimits this_ptr_conv;
23712         this_ptr_conv.inner = untag_ptr(this_ptr);
23713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23715         this_ptr_conv.is_owned = false;
23716         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
23717         return ret_conv;
23718 }
23719
23720 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) {
23721         LDKChannelHandshakeLimits this_ptr_conv;
23722         this_ptr_conv.inner = untag_ptr(this_ptr);
23723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23725         this_ptr_conv.is_owned = false;
23726         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
23727 }
23728
23729 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
23730         LDKChannelHandshakeLimits this_ptr_conv;
23731         this_ptr_conv.inner = untag_ptr(this_ptr);
23732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23734         this_ptr_conv.is_owned = false;
23735         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
23736         return ret_conv;
23737 }
23738
23739 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) {
23740         LDKChannelHandshakeLimits this_ptr_conv;
23741         this_ptr_conv.inner = untag_ptr(this_ptr);
23742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23744         this_ptr_conv.is_owned = false;
23745         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
23746 }
23747
23748 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
23749         LDKChannelHandshakeLimits this_ptr_conv;
23750         this_ptr_conv.inner = untag_ptr(this_ptr);
23751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23753         this_ptr_conv.is_owned = false;
23754         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
23755         return ret_conv;
23756 }
23757
23758 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
23759         LDKChannelHandshakeLimits this_ptr_conv;
23760         this_ptr_conv.inner = untag_ptr(this_ptr);
23761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23763         this_ptr_conv.is_owned = false;
23764         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
23765 }
23766
23767 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
23768         LDKChannelHandshakeLimits this_ptr_conv;
23769         this_ptr_conv.inner = untag_ptr(this_ptr);
23770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23772         this_ptr_conv.is_owned = false;
23773         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
23774         return ret_conv;
23775 }
23776
23777 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
23778         LDKChannelHandshakeLimits this_ptr_conv;
23779         this_ptr_conv.inner = untag_ptr(this_ptr);
23780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23782         this_ptr_conv.is_owned = false;
23783         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
23784 }
23785
23786 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
23787         LDKChannelHandshakeLimits this_ptr_conv;
23788         this_ptr_conv.inner = untag_ptr(this_ptr);
23789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23791         this_ptr_conv.is_owned = false;
23792         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
23793         return ret_conv;
23794 }
23795
23796 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
23797         LDKChannelHandshakeLimits this_ptr_conv;
23798         this_ptr_conv.inner = untag_ptr(this_ptr);
23799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23801         this_ptr_conv.is_owned = false;
23802         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
23803 }
23804
23805 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
23806         LDKChannelHandshakeLimits this_ptr_conv;
23807         this_ptr_conv.inner = untag_ptr(this_ptr);
23808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23810         this_ptr_conv.is_owned = false;
23811         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
23812         return ret_conv;
23813 }
23814
23815 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) {
23816         LDKChannelHandshakeLimits this_ptr_conv;
23817         this_ptr_conv.inner = untag_ptr(this_ptr);
23818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23820         this_ptr_conv.is_owned = false;
23821         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
23822 }
23823
23824 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) {
23825         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);
23826         uint64_t ret_ref = 0;
23827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23829         return ret_ref;
23830 }
23831
23832 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
23833         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
23834         uint64_t ret_ref = 0;
23835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23837         return ret_ref;
23838 }
23839 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
23840         LDKChannelHandshakeLimits arg_conv;
23841         arg_conv.inner = untag_ptr(arg);
23842         arg_conv.is_owned = ptr_is_owned(arg);
23843         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23844         arg_conv.is_owned = false;
23845         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
23846         return ret_conv;
23847 }
23848
23849 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
23850         LDKChannelHandshakeLimits orig_conv;
23851         orig_conv.inner = untag_ptr(orig);
23852         orig_conv.is_owned = ptr_is_owned(orig);
23853         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23854         orig_conv.is_owned = false;
23855         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
23856         uint64_t ret_ref = 0;
23857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23859         return ret_ref;
23860 }
23861
23862 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
23863         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
23864         uint64_t ret_ref = 0;
23865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23867         return ret_ref;
23868 }
23869
23870 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
23871         LDKChannelConfig this_obj_conv;
23872         this_obj_conv.inner = untag_ptr(this_obj);
23873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23875         ChannelConfig_free(this_obj_conv);
23876 }
23877
23878 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
23879         LDKChannelConfig this_ptr_conv;
23880         this_ptr_conv.inner = untag_ptr(this_ptr);
23881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23883         this_ptr_conv.is_owned = false;
23884         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
23885         return ret_conv;
23886 }
23887
23888 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) {
23889         LDKChannelConfig this_ptr_conv;
23890         this_ptr_conv.inner = untag_ptr(this_ptr);
23891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23893         this_ptr_conv.is_owned = false;
23894         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
23895 }
23896
23897 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
23898         LDKChannelConfig this_ptr_conv;
23899         this_ptr_conv.inner = untag_ptr(this_ptr);
23900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23902         this_ptr_conv.is_owned = false;
23903         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
23904         return ret_conv;
23905 }
23906
23907 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) {
23908         LDKChannelConfig this_ptr_conv;
23909         this_ptr_conv.inner = untag_ptr(this_ptr);
23910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23912         this_ptr_conv.is_owned = false;
23913         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
23914 }
23915
23916 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
23917         LDKChannelConfig this_ptr_conv;
23918         this_ptr_conv.inner = untag_ptr(this_ptr);
23919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23921         this_ptr_conv.is_owned = false;
23922         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
23923         return ret_conv;
23924 }
23925
23926 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
23927         LDKChannelConfig this_ptr_conv;
23928         this_ptr_conv.inner = untag_ptr(this_ptr);
23929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23931         this_ptr_conv.is_owned = false;
23932         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
23933 }
23934
23935 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) {
23936         LDKChannelConfig this_ptr_conv;
23937         this_ptr_conv.inner = untag_ptr(this_ptr);
23938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23940         this_ptr_conv.is_owned = false;
23941         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
23942         return ret_conv;
23943 }
23944
23945 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) {
23946         LDKChannelConfig this_ptr_conv;
23947         this_ptr_conv.inner = untag_ptr(this_ptr);
23948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23950         this_ptr_conv.is_owned = false;
23951         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
23952 }
23953
23954 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) {
23955         LDKChannelConfig this_ptr_conv;
23956         this_ptr_conv.inner = untag_ptr(this_ptr);
23957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23959         this_ptr_conv.is_owned = false;
23960         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
23961         return ret_conv;
23962 }
23963
23964 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) {
23965         LDKChannelConfig this_ptr_conv;
23966         this_ptr_conv.inner = untag_ptr(this_ptr);
23967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23969         this_ptr_conv.is_owned = false;
23970         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
23971 }
23972
23973 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) {
23974         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);
23975         uint64_t ret_ref = 0;
23976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23978         return ret_ref;
23979 }
23980
23981 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
23982         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
23983         uint64_t ret_ref = 0;
23984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23986         return ret_ref;
23987 }
23988 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
23989         LDKChannelConfig arg_conv;
23990         arg_conv.inner = untag_ptr(arg);
23991         arg_conv.is_owned = ptr_is_owned(arg);
23992         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23993         arg_conv.is_owned = false;
23994         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
23995         return ret_conv;
23996 }
23997
23998 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
23999         LDKChannelConfig orig_conv;
24000         orig_conv.inner = untag_ptr(orig);
24001         orig_conv.is_owned = ptr_is_owned(orig);
24002         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24003         orig_conv.is_owned = false;
24004         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
24005         uint64_t ret_ref = 0;
24006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24008         return ret_ref;
24009 }
24010
24011 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
24012         LDKChannelConfig a_conv;
24013         a_conv.inner = untag_ptr(a);
24014         a_conv.is_owned = ptr_is_owned(a);
24015         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24016         a_conv.is_owned = false;
24017         LDKChannelConfig b_conv;
24018         b_conv.inner = untag_ptr(b);
24019         b_conv.is_owned = ptr_is_owned(b);
24020         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24021         b_conv.is_owned = false;
24022         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
24023         return ret_conv;
24024 }
24025
24026 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
24027         LDKChannelConfig ret_var = ChannelConfig_default();
24028         uint64_t ret_ref = 0;
24029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24031         return ret_ref;
24032 }
24033
24034 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
24035         LDKChannelConfig obj_conv;
24036         obj_conv.inner = untag_ptr(obj);
24037         obj_conv.is_owned = ptr_is_owned(obj);
24038         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24039         obj_conv.is_owned = false;
24040         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24041         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24042         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24043         CVec_u8Z_free(ret_var);
24044         return ret_arr;
24045 }
24046
24047 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
24048         LDKu8slice ser_ref;
24049         ser_ref.datalen = ser->arr_len;
24050         ser_ref.data = ser->elems;
24051         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24052         *ret_conv = ChannelConfig_read(ser_ref);
24053         FREE(ser);
24054         return tag_ptr(ret_conv, true);
24055 }
24056
24057 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
24058         LDKUserConfig this_obj_conv;
24059         this_obj_conv.inner = untag_ptr(this_obj);
24060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24062         UserConfig_free(this_obj_conv);
24063 }
24064
24065 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
24066         LDKUserConfig this_ptr_conv;
24067         this_ptr_conv.inner = untag_ptr(this_ptr);
24068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24070         this_ptr_conv.is_owned = false;
24071         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
24072         uint64_t ret_ref = 0;
24073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24075         return ret_ref;
24076 }
24077
24078 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
24079         LDKUserConfig this_ptr_conv;
24080         this_ptr_conv.inner = untag_ptr(this_ptr);
24081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24083         this_ptr_conv.is_owned = false;
24084         LDKChannelHandshakeConfig val_conv;
24085         val_conv.inner = untag_ptr(val);
24086         val_conv.is_owned = ptr_is_owned(val);
24087         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24088         val_conv = ChannelHandshakeConfig_clone(&val_conv);
24089         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
24090 }
24091
24092 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
24093         LDKUserConfig this_ptr_conv;
24094         this_ptr_conv.inner = untag_ptr(this_ptr);
24095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24097         this_ptr_conv.is_owned = false;
24098         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
24099         uint64_t ret_ref = 0;
24100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24102         return ret_ref;
24103 }
24104
24105 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
24106         LDKUserConfig this_ptr_conv;
24107         this_ptr_conv.inner = untag_ptr(this_ptr);
24108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24110         this_ptr_conv.is_owned = false;
24111         LDKChannelHandshakeLimits val_conv;
24112         val_conv.inner = untag_ptr(val);
24113         val_conv.is_owned = ptr_is_owned(val);
24114         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24115         val_conv = ChannelHandshakeLimits_clone(&val_conv);
24116         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
24117 }
24118
24119 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
24120         LDKUserConfig this_ptr_conv;
24121         this_ptr_conv.inner = untag_ptr(this_ptr);
24122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24124         this_ptr_conv.is_owned = false;
24125         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
24126         uint64_t ret_ref = 0;
24127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24129         return ret_ref;
24130 }
24131
24132 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
24133         LDKUserConfig this_ptr_conv;
24134         this_ptr_conv.inner = untag_ptr(this_ptr);
24135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24137         this_ptr_conv.is_owned = false;
24138         LDKChannelConfig val_conv;
24139         val_conv.inner = untag_ptr(val);
24140         val_conv.is_owned = ptr_is_owned(val);
24141         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24142         val_conv = ChannelConfig_clone(&val_conv);
24143         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
24144 }
24145
24146 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
24147         LDKUserConfig this_ptr_conv;
24148         this_ptr_conv.inner = untag_ptr(this_ptr);
24149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24151         this_ptr_conv.is_owned = false;
24152         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24153         return ret_conv;
24154 }
24155
24156 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) {
24157         LDKUserConfig this_ptr_conv;
24158         this_ptr_conv.inner = untag_ptr(this_ptr);
24159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24161         this_ptr_conv.is_owned = false;
24162         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24163 }
24164
24165 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
24166         LDKUserConfig this_ptr_conv;
24167         this_ptr_conv.inner = untag_ptr(this_ptr);
24168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24170         this_ptr_conv.is_owned = false;
24171         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24172         return ret_conv;
24173 }
24174
24175 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24176         LDKUserConfig this_ptr_conv;
24177         this_ptr_conv.inner = untag_ptr(this_ptr);
24178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24180         this_ptr_conv.is_owned = false;
24181         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24182 }
24183
24184 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
24185         LDKUserConfig this_ptr_conv;
24186         this_ptr_conv.inner = untag_ptr(this_ptr);
24187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24189         this_ptr_conv.is_owned = false;
24190         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24191         return ret_conv;
24192 }
24193
24194 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24195         LDKUserConfig this_ptr_conv;
24196         this_ptr_conv.inner = untag_ptr(this_ptr);
24197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24199         this_ptr_conv.is_owned = false;
24200         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24201 }
24202
24203 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
24204         LDKUserConfig this_ptr_conv;
24205         this_ptr_conv.inner = untag_ptr(this_ptr);
24206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24208         this_ptr_conv.is_owned = false;
24209         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
24210         return ret_conv;
24211 }
24212
24213 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
24214         LDKUserConfig this_ptr_conv;
24215         this_ptr_conv.inner = untag_ptr(this_ptr);
24216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24218         this_ptr_conv.is_owned = false;
24219         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
24220 }
24221
24222 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) {
24223         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
24224         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
24225         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
24226         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
24227         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
24228         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
24229         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
24230         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
24231         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
24232         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
24233         LDKChannelConfig channel_config_arg_conv;
24234         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
24235         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
24236         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
24237         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
24238         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);
24239         uint64_t ret_ref = 0;
24240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24242         return ret_ref;
24243 }
24244
24245 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24246         LDKUserConfig ret_var = UserConfig_clone(arg);
24247         uint64_t ret_ref = 0;
24248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24250         return ret_ref;
24251 }
24252 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
24253         LDKUserConfig arg_conv;
24254         arg_conv.inner = untag_ptr(arg);
24255         arg_conv.is_owned = ptr_is_owned(arg);
24256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24257         arg_conv.is_owned = false;
24258         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
24259         return ret_conv;
24260 }
24261
24262 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
24263         LDKUserConfig orig_conv;
24264         orig_conv.inner = untag_ptr(orig);
24265         orig_conv.is_owned = ptr_is_owned(orig);
24266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24267         orig_conv.is_owned = false;
24268         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24269         uint64_t ret_ref = 0;
24270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24272         return ret_ref;
24273 }
24274
24275 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
24276         LDKUserConfig ret_var = UserConfig_default();
24277         uint64_t ret_ref = 0;
24278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24280         return ret_ref;
24281 }
24282
24283 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
24284         LDKBestBlock this_obj_conv;
24285         this_obj_conv.inner = untag_ptr(this_obj);
24286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24288         BestBlock_free(this_obj_conv);
24289 }
24290
24291 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24292         LDKBestBlock ret_var = BestBlock_clone(arg);
24293         uint64_t ret_ref = 0;
24294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24296         return ret_ref;
24297 }
24298 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
24299         LDKBestBlock arg_conv;
24300         arg_conv.inner = untag_ptr(arg);
24301         arg_conv.is_owned = ptr_is_owned(arg);
24302         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24303         arg_conv.is_owned = false;
24304         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
24305         return ret_conv;
24306 }
24307
24308 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
24309         LDKBestBlock orig_conv;
24310         orig_conv.inner = untag_ptr(orig);
24311         orig_conv.is_owned = ptr_is_owned(orig);
24312         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24313         orig_conv.is_owned = false;
24314         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24315         uint64_t ret_ref = 0;
24316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24318         return ret_ref;
24319 }
24320
24321 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
24322         LDKBestBlock a_conv;
24323         a_conv.inner = untag_ptr(a);
24324         a_conv.is_owned = ptr_is_owned(a);
24325         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24326         a_conv.is_owned = false;
24327         LDKBestBlock b_conv;
24328         b_conv.inner = untag_ptr(b);
24329         b_conv.is_owned = ptr_is_owned(b);
24330         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24331         b_conv.is_owned = false;
24332         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
24333         return ret_conv;
24334 }
24335
24336 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
24337         LDKNetwork network_conv = LDKNetwork_from_js(network);
24338         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
24339         uint64_t ret_ref = 0;
24340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24342         return ret_ref;
24343 }
24344
24345 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
24346         LDKThirtyTwoBytes block_hash_ref;
24347         CHECK(block_hash->arr_len == 32);
24348         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
24349         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24350         uint64_t ret_ref = 0;
24351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24353         return ret_ref;
24354 }
24355
24356 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
24357         LDKBestBlock this_arg_conv;
24358         this_arg_conv.inner = untag_ptr(this_arg);
24359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24361         this_arg_conv.is_owned = false;
24362         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24363         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
24364         return ret_arr;
24365 }
24366
24367 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
24368         LDKBestBlock this_arg_conv;
24369         this_arg_conv.inner = untag_ptr(this_arg);
24370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24372         this_arg_conv.is_owned = false;
24373         int32_t ret_conv = BestBlock_height(&this_arg_conv);
24374         return ret_conv;
24375 }
24376
24377 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
24378         if (!ptr_is_owned(this_ptr)) return;
24379         void* this_ptr_ptr = untag_ptr(this_ptr);
24380         CHECK_ACCESS(this_ptr_ptr);
24381         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24382         FREE(untag_ptr(this_ptr));
24383         Listen_free(this_ptr_conv);
24384 }
24385
24386 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
24387         if (!ptr_is_owned(this_ptr)) return;
24388         void* this_ptr_ptr = untag_ptr(this_ptr);
24389         CHECK_ACCESS(this_ptr_ptr);
24390         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24391         FREE(untag_ptr(this_ptr));
24392         Confirm_free(this_ptr_conv);
24393 }
24394
24395 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
24396         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
24397         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
24398         return ret_conv;
24399 }
24400
24401 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
24402         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
24403         return ret_conv;
24404 }
24405
24406 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
24407         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
24408         return ret_conv;
24409 }
24410
24411 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
24412         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
24413         return ret_conv;
24414 }
24415
24416 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
24417         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
24418         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
24419         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
24420         return ret_conv;
24421 }
24422
24423 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
24424         if (!ptr_is_owned(this_ptr)) return;
24425         void* this_ptr_ptr = untag_ptr(this_ptr);
24426         CHECK_ACCESS(this_ptr_ptr);
24427         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24428         FREE(untag_ptr(this_ptr));
24429         Watch_free(this_ptr_conv);
24430 }
24431
24432 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
24433         if (!ptr_is_owned(this_ptr)) return;
24434         void* this_ptr_ptr = untag_ptr(this_ptr);
24435         CHECK_ACCESS(this_ptr_ptr);
24436         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24437         FREE(untag_ptr(this_ptr));
24438         Filter_free(this_ptr_conv);
24439 }
24440
24441 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
24442         LDKWatchedOutput this_obj_conv;
24443         this_obj_conv.inner = untag_ptr(this_obj);
24444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24446         WatchedOutput_free(this_obj_conv);
24447 }
24448
24449 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
24450         LDKWatchedOutput this_ptr_conv;
24451         this_ptr_conv.inner = untag_ptr(this_ptr);
24452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24454         this_ptr_conv.is_owned = false;
24455         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24456         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
24457         return ret_arr;
24458 }
24459
24460 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
24461         LDKWatchedOutput this_ptr_conv;
24462         this_ptr_conv.inner = untag_ptr(this_ptr);
24463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24465         this_ptr_conv.is_owned = false;
24466         LDKThirtyTwoBytes val_ref;
24467         CHECK(val->arr_len == 32);
24468         memcpy(val_ref.data, val->elems, 32); FREE(val);
24469         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24470 }
24471
24472 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
24473         LDKWatchedOutput this_ptr_conv;
24474         this_ptr_conv.inner = untag_ptr(this_ptr);
24475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24477         this_ptr_conv.is_owned = false;
24478         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24479         uint64_t ret_ref = 0;
24480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24482         return ret_ref;
24483 }
24484
24485 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
24486         LDKWatchedOutput this_ptr_conv;
24487         this_ptr_conv.inner = untag_ptr(this_ptr);
24488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24490         this_ptr_conv.is_owned = false;
24491         LDKOutPoint val_conv;
24492         val_conv.inner = untag_ptr(val);
24493         val_conv.is_owned = ptr_is_owned(val);
24494         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24495         val_conv = OutPoint_clone(&val_conv);
24496         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24497 }
24498
24499 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
24500         LDKWatchedOutput this_ptr_conv;
24501         this_ptr_conv.inner = untag_ptr(this_ptr);
24502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24504         this_ptr_conv.is_owned = false;
24505         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24506         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24507         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24508         return ret_arr;
24509 }
24510
24511 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
24512         LDKWatchedOutput this_ptr_conv;
24513         this_ptr_conv.inner = untag_ptr(this_ptr);
24514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24516         this_ptr_conv.is_owned = false;
24517         LDKCVec_u8Z val_ref;
24518         val_ref.datalen = val->arr_len;
24519         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24520         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
24521         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24522 }
24523
24524 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) {
24525         LDKThirtyTwoBytes block_hash_arg_ref;
24526         CHECK(block_hash_arg->arr_len == 32);
24527         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
24528         LDKOutPoint outpoint_arg_conv;
24529         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24530         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24531         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24532         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24533         LDKCVec_u8Z script_pubkey_arg_ref;
24534         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
24535         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24536         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
24537         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24538         uint64_t ret_ref = 0;
24539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24541         return ret_ref;
24542 }
24543
24544 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24545         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
24546         uint64_t ret_ref = 0;
24547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24549         return ret_ref;
24550 }
24551 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
24552         LDKWatchedOutput arg_conv;
24553         arg_conv.inner = untag_ptr(arg);
24554         arg_conv.is_owned = ptr_is_owned(arg);
24555         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24556         arg_conv.is_owned = false;
24557         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
24558         return ret_conv;
24559 }
24560
24561 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
24562         LDKWatchedOutput orig_conv;
24563         orig_conv.inner = untag_ptr(orig);
24564         orig_conv.is_owned = ptr_is_owned(orig);
24565         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24566         orig_conv.is_owned = false;
24567         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24568         uint64_t ret_ref = 0;
24569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24571         return ret_ref;
24572 }
24573
24574 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
24575         LDKWatchedOutput a_conv;
24576         a_conv.inner = untag_ptr(a);
24577         a_conv.is_owned = ptr_is_owned(a);
24578         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24579         a_conv.is_owned = false;
24580         LDKWatchedOutput b_conv;
24581         b_conv.inner = untag_ptr(b);
24582         b_conv.is_owned = ptr_is_owned(b);
24583         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24584         b_conv.is_owned = false;
24585         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
24586         return ret_conv;
24587 }
24588
24589 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
24590         LDKWatchedOutput o_conv;
24591         o_conv.inner = untag_ptr(o);
24592         o_conv.is_owned = ptr_is_owned(o);
24593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24594         o_conv.is_owned = false;
24595         int64_t ret_conv = WatchedOutput_hash(&o_conv);
24596         return ret_conv;
24597 }
24598
24599 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
24600         if (!ptr_is_owned(this_ptr)) return;
24601         void* this_ptr_ptr = untag_ptr(this_ptr);
24602         CHECK_ACCESS(this_ptr_ptr);
24603         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24604         FREE(untag_ptr(this_ptr));
24605         BroadcasterInterface_free(this_ptr_conv);
24606 }
24607
24608 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
24609         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
24610         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
24611         return ret_conv;
24612 }
24613
24614 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
24615         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
24616         return ret_conv;
24617 }
24618
24619 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
24620         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
24621         return ret_conv;
24622 }
24623
24624 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
24625         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
24626         return ret_conv;
24627 }
24628
24629 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
24630         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
24631         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
24632         return ret_conv;
24633 }
24634
24635 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
24636         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
24637         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
24638         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
24639         return ret_conv;
24640 }
24641
24642 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
24643         if (!ptr_is_owned(this_ptr)) return;
24644         void* this_ptr_ptr = untag_ptr(this_ptr);
24645         CHECK_ACCESS(this_ptr_ptr);
24646         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24647         FREE(untag_ptr(this_ptr));
24648         FeeEstimator_free(this_ptr_conv);
24649 }
24650
24651 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
24652         LDKMonitorUpdateId this_obj_conv;
24653         this_obj_conv.inner = untag_ptr(this_obj);
24654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24656         MonitorUpdateId_free(this_obj_conv);
24657 }
24658
24659 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24660         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24661         uint64_t ret_ref = 0;
24662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24664         return ret_ref;
24665 }
24666 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
24667         LDKMonitorUpdateId arg_conv;
24668         arg_conv.inner = untag_ptr(arg);
24669         arg_conv.is_owned = ptr_is_owned(arg);
24670         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24671         arg_conv.is_owned = false;
24672         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
24673         return ret_conv;
24674 }
24675
24676 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
24677         LDKMonitorUpdateId orig_conv;
24678         orig_conv.inner = untag_ptr(orig);
24679         orig_conv.is_owned = ptr_is_owned(orig);
24680         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24681         orig_conv.is_owned = false;
24682         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24683         uint64_t ret_ref = 0;
24684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24686         return ret_ref;
24687 }
24688
24689 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
24690         LDKMonitorUpdateId o_conv;
24691         o_conv.inner = untag_ptr(o);
24692         o_conv.is_owned = ptr_is_owned(o);
24693         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24694         o_conv.is_owned = false;
24695         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
24696         return ret_conv;
24697 }
24698
24699 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
24700         LDKMonitorUpdateId a_conv;
24701         a_conv.inner = untag_ptr(a);
24702         a_conv.is_owned = ptr_is_owned(a);
24703         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24704         a_conv.is_owned = false;
24705         LDKMonitorUpdateId b_conv;
24706         b_conv.inner = untag_ptr(b);
24707         b_conv.is_owned = ptr_is_owned(b);
24708         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24709         b_conv.is_owned = false;
24710         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
24711         return ret_conv;
24712 }
24713
24714 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
24715         if (!ptr_is_owned(this_ptr)) return;
24716         void* this_ptr_ptr = untag_ptr(this_ptr);
24717         CHECK_ACCESS(this_ptr_ptr);
24718         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
24719         FREE(untag_ptr(this_ptr));
24720         Persist_free(this_ptr_conv);
24721 }
24722
24723 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
24724         LDKLockedChannelMonitor this_obj_conv;
24725         this_obj_conv.inner = untag_ptr(this_obj);
24726         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24728         LockedChannelMonitor_free(this_obj_conv);
24729 }
24730
24731 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
24732         LDKChainMonitor this_obj_conv;
24733         this_obj_conv.inner = untag_ptr(this_obj);
24734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24736         ChainMonitor_free(this_obj_conv);
24737 }
24738
24739 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) {
24740         void* chain_source_ptr = untag_ptr(chain_source);
24741         CHECK_ACCESS(chain_source_ptr);
24742         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
24743         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
24744         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
24745                 // Manually implement clone for Java trait instances
24746                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
24747                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24748                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
24749                 }
24750         }
24751         void* broadcaster_ptr = untag_ptr(broadcaster);
24752         CHECK_ACCESS(broadcaster_ptr);
24753         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24754         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24755                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24756                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24757         }
24758         void* logger_ptr = untag_ptr(logger);
24759         CHECK_ACCESS(logger_ptr);
24760         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24761         if (logger_conv.free == LDKLogger_JCalls_free) {
24762                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24763                 LDKLogger_JCalls_cloned(&logger_conv);
24764         }
24765         void* feeest_ptr = untag_ptr(feeest);
24766         CHECK_ACCESS(feeest_ptr);
24767         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
24768         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
24769                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24770                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
24771         }
24772         void* persister_ptr = untag_ptr(persister);
24773         CHECK_ACCESS(persister_ptr);
24774         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
24775         if (persister_conv.free == LDKPersist_JCalls_free) {
24776                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24777                 LDKPersist_JCalls_cloned(&persister_conv);
24778         }
24779         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
24780         uint64_t ret_ref = 0;
24781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24783         return ret_ref;
24784 }
24785
24786 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
24787         LDKChainMonitor this_arg_conv;
24788         this_arg_conv.inner = untag_ptr(this_arg);
24789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24791         this_arg_conv.is_owned = false;
24792         LDKCVec_ChannelDetailsZ ignored_channels_constr;
24793         ignored_channels_constr.datalen = ignored_channels->arr_len;
24794         if (ignored_channels_constr.datalen > 0)
24795                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24796         else
24797                 ignored_channels_constr.data = NULL;
24798         uint64_t* ignored_channels_vals = ignored_channels->elems;
24799         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
24800                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
24801                 LDKChannelDetails ignored_channels_conv_16_conv;
24802                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
24803                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
24804                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
24805                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
24806                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
24807         }
24808         FREE(ignored_channels);
24809         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
24810         uint64_tArray ret_arr = NULL;
24811         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24812         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24813         for (size_t j = 0; j < ret_var.datalen; j++) {
24814                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24815                 *ret_conv_9_copy = ret_var.data[j];
24816                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24817                 ret_arr_ptr[j] = ret_conv_9_ref;
24818         }
24819         
24820         FREE(ret_var.data);
24821         return ret_arr;
24822 }
24823
24824 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
24825         LDKChainMonitor this_arg_conv;
24826         this_arg_conv.inner = untag_ptr(this_arg);
24827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24829         this_arg_conv.is_owned = false;
24830         LDKOutPoint funding_txo_conv;
24831         funding_txo_conv.inner = untag_ptr(funding_txo);
24832         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24833         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24834         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24835         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24836         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
24837         return tag_ptr(ret_conv, true);
24838 }
24839
24840 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
24841         LDKChainMonitor this_arg_conv;
24842         this_arg_conv.inner = untag_ptr(this_arg);
24843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24845         this_arg_conv.is_owned = false;
24846         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
24847         uint64_tArray ret_arr = NULL;
24848         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24849         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24850         for (size_t k = 0; k < ret_var.datalen; k++) {
24851                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
24852                 uint64_t ret_conv_10_ref = 0;
24853                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
24854                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
24855                 ret_arr_ptr[k] = ret_conv_10_ref;
24856         }
24857         
24858         FREE(ret_var.data);
24859         return ret_arr;
24860 }
24861
24862 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
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         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
24869         uint64_tArray ret_arr = NULL;
24870         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24871         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24872         for (size_t p = 0; p < ret_var.datalen; p++) {
24873                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
24874                 *ret_conv_41_conv = ret_var.data[p];
24875                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
24876         }
24877         
24878         FREE(ret_var.data);
24879         return ret_arr;
24880 }
24881
24882 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) {
24883         LDKChainMonitor this_arg_conv;
24884         this_arg_conv.inner = untag_ptr(this_arg);
24885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24887         this_arg_conv.is_owned = false;
24888         LDKOutPoint funding_txo_conv;
24889         funding_txo_conv.inner = untag_ptr(funding_txo);
24890         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24891         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24892         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24893         LDKMonitorUpdateId completed_update_id_conv;
24894         completed_update_id_conv.inner = untag_ptr(completed_update_id);
24895         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
24896         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
24897         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
24898         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24899         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
24900         return tag_ptr(ret_conv, true);
24901 }
24902
24903 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
24904         LDKChainMonitor this_arg_conv;
24905         this_arg_conv.inner = untag_ptr(this_arg);
24906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24908         this_arg_conv.is_owned = false;
24909         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
24910         uint64_t ret_ref = 0;
24911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24913         return ret_ref;
24914 }
24915
24916 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(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         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
24923 }
24924
24925 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
24926         LDKChainMonitor this_arg_conv;
24927         this_arg_conv.inner = untag_ptr(this_arg);
24928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24930         this_arg_conv.is_owned = false;
24931         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
24932         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
24933         return tag_ptr(ret_ret, true);
24934 }
24935
24936 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
24937         LDKChainMonitor this_arg_conv;
24938         this_arg_conv.inner = untag_ptr(this_arg);
24939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24941         this_arg_conv.is_owned = false;
24942         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
24943         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
24944         return tag_ptr(ret_ret, true);
24945 }
24946
24947 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
24948         LDKChainMonitor this_arg_conv;
24949         this_arg_conv.inner = untag_ptr(this_arg);
24950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24952         this_arg_conv.is_owned = false;
24953         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
24954         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
24955         return tag_ptr(ret_ret, true);
24956 }
24957
24958 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
24959         LDKChainMonitor this_arg_conv;
24960         this_arg_conv.inner = untag_ptr(this_arg);
24961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24963         this_arg_conv.is_owned = false;
24964         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
24965         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
24966         return tag_ptr(ret_ret, true);
24967 }
24968
24969 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
24970         LDKChannelMonitorUpdate this_obj_conv;
24971         this_obj_conv.inner = untag_ptr(this_obj);
24972         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24974         ChannelMonitorUpdate_free(this_obj_conv);
24975 }
24976
24977 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
24978         LDKChannelMonitorUpdate this_ptr_conv;
24979         this_ptr_conv.inner = untag_ptr(this_ptr);
24980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24982         this_ptr_conv.is_owned = false;
24983         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
24984         return ret_conv;
24985 }
24986
24987 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
24988         LDKChannelMonitorUpdate this_ptr_conv;
24989         this_ptr_conv.inner = untag_ptr(this_ptr);
24990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24992         this_ptr_conv.is_owned = false;
24993         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
24994 }
24995
24996 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
24997         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
24998         uint64_t ret_ref = 0;
24999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25001         return ret_ref;
25002 }
25003 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
25004         LDKChannelMonitorUpdate arg_conv;
25005         arg_conv.inner = untag_ptr(arg);
25006         arg_conv.is_owned = ptr_is_owned(arg);
25007         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25008         arg_conv.is_owned = false;
25009         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
25010         return ret_conv;
25011 }
25012
25013 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
25014         LDKChannelMonitorUpdate orig_conv;
25015         orig_conv.inner = untag_ptr(orig);
25016         orig_conv.is_owned = ptr_is_owned(orig);
25017         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25018         orig_conv.is_owned = false;
25019         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25020         uint64_t ret_ref = 0;
25021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25023         return ret_ref;
25024 }
25025
25026 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
25027         LDKChannelMonitorUpdate a_conv;
25028         a_conv.inner = untag_ptr(a);
25029         a_conv.is_owned = ptr_is_owned(a);
25030         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25031         a_conv.is_owned = false;
25032         LDKChannelMonitorUpdate b_conv;
25033         b_conv.inner = untag_ptr(b);
25034         b_conv.is_owned = ptr_is_owned(b);
25035         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25036         b_conv.is_owned = false;
25037         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
25038         return ret_conv;
25039 }
25040
25041 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
25042         LDKChannelMonitorUpdate obj_conv;
25043         obj_conv.inner = untag_ptr(obj);
25044         obj_conv.is_owned = ptr_is_owned(obj);
25045         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25046         obj_conv.is_owned = false;
25047         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25048         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25049         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25050         CVec_u8Z_free(ret_var);
25051         return ret_arr;
25052 }
25053
25054 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
25055         LDKu8slice ser_ref;
25056         ser_ref.datalen = ser->arr_len;
25057         ser_ref.data = ser->elems;
25058         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25059         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25060         FREE(ser);
25061         return tag_ptr(ret_conv, true);
25062 }
25063
25064 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
25065         if (!ptr_is_owned(this_ptr)) return;
25066         void* this_ptr_ptr = untag_ptr(this_ptr);
25067         CHECK_ACCESS(this_ptr_ptr);
25068         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25069         FREE(untag_ptr(this_ptr));
25070         MonitorEvent_free(this_ptr_conv);
25071 }
25072
25073 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25074         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25075         *ret_copy = MonitorEvent_clone(arg);
25076         uint64_t ret_ref = tag_ptr(ret_copy, true);
25077         return ret_ref;
25078 }
25079 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
25080         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
25081         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
25082         return ret_conv;
25083 }
25084
25085 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
25086         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
25087         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25088         *ret_copy = MonitorEvent_clone(orig_conv);
25089         uint64_t ret_ref = tag_ptr(ret_copy, true);
25090         return ret_ref;
25091 }
25092
25093 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
25094         LDKHTLCUpdate a_conv;
25095         a_conv.inner = untag_ptr(a);
25096         a_conv.is_owned = ptr_is_owned(a);
25097         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25098         a_conv = HTLCUpdate_clone(&a_conv);
25099         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25100         *ret_copy = MonitorEvent_htlcevent(a_conv);
25101         uint64_t ret_ref = tag_ptr(ret_copy, true);
25102         return ret_ref;
25103 }
25104
25105 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
25106         LDKOutPoint a_conv;
25107         a_conv.inner = untag_ptr(a);
25108         a_conv.is_owned = ptr_is_owned(a);
25109         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25110         a_conv = OutPoint_clone(&a_conv);
25111         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25112         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25113         uint64_t ret_ref = tag_ptr(ret_copy, true);
25114         return ret_ref;
25115 }
25116
25117 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
25118         LDKOutPoint funding_txo_conv;
25119         funding_txo_conv.inner = untag_ptr(funding_txo);
25120         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25121         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25122         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25123         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25124         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
25125         uint64_t ret_ref = tag_ptr(ret_copy, true);
25126         return ret_ref;
25127 }
25128
25129 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
25130         LDKOutPoint a_conv;
25131         a_conv.inner = untag_ptr(a);
25132         a_conv.is_owned = ptr_is_owned(a);
25133         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25134         a_conv = OutPoint_clone(&a_conv);
25135         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25136         *ret_copy = MonitorEvent_update_failed(a_conv);
25137         uint64_t ret_ref = tag_ptr(ret_copy, true);
25138         return ret_ref;
25139 }
25140
25141 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
25142         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
25143         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
25144         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
25145         return ret_conv;
25146 }
25147
25148 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
25149         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
25150         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25151         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25152         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25153         CVec_u8Z_free(ret_var);
25154         return ret_arr;
25155 }
25156
25157 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
25158         LDKu8slice ser_ref;
25159         ser_ref.datalen = ser->arr_len;
25160         ser_ref.data = ser->elems;
25161         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25162         *ret_conv = MonitorEvent_read(ser_ref);
25163         FREE(ser);
25164         return tag_ptr(ret_conv, true);
25165 }
25166
25167 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
25168         LDKHTLCUpdate this_obj_conv;
25169         this_obj_conv.inner = untag_ptr(this_obj);
25170         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25172         HTLCUpdate_free(this_obj_conv);
25173 }
25174
25175 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25176         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25177         uint64_t ret_ref = 0;
25178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25180         return ret_ref;
25181 }
25182 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
25183         LDKHTLCUpdate arg_conv;
25184         arg_conv.inner = untag_ptr(arg);
25185         arg_conv.is_owned = ptr_is_owned(arg);
25186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25187         arg_conv.is_owned = false;
25188         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
25189         return ret_conv;
25190 }
25191
25192 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
25193         LDKHTLCUpdate orig_conv;
25194         orig_conv.inner = untag_ptr(orig);
25195         orig_conv.is_owned = ptr_is_owned(orig);
25196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25197         orig_conv.is_owned = false;
25198         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25199         uint64_t ret_ref = 0;
25200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25202         return ret_ref;
25203 }
25204
25205 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
25206         LDKHTLCUpdate a_conv;
25207         a_conv.inner = untag_ptr(a);
25208         a_conv.is_owned = ptr_is_owned(a);
25209         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25210         a_conv.is_owned = false;
25211         LDKHTLCUpdate b_conv;
25212         b_conv.inner = untag_ptr(b);
25213         b_conv.is_owned = ptr_is_owned(b);
25214         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25215         b_conv.is_owned = false;
25216         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
25217         return ret_conv;
25218 }
25219
25220 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
25221         LDKHTLCUpdate obj_conv;
25222         obj_conv.inner = untag_ptr(obj);
25223         obj_conv.is_owned = ptr_is_owned(obj);
25224         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25225         obj_conv.is_owned = false;
25226         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25227         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25228         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25229         CVec_u8Z_free(ret_var);
25230         return ret_arr;
25231 }
25232
25233 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
25234         LDKu8slice ser_ref;
25235         ser_ref.datalen = ser->arr_len;
25236         ser_ref.data = ser->elems;
25237         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25238         *ret_conv = HTLCUpdate_read(ser_ref);
25239         FREE(ser);
25240         return tag_ptr(ret_conv, true);
25241 }
25242
25243 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
25244         if (!ptr_is_owned(this_ptr)) return;
25245         void* this_ptr_ptr = untag_ptr(this_ptr);
25246         CHECK_ACCESS(this_ptr_ptr);
25247         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25248         FREE(untag_ptr(this_ptr));
25249         Balance_free(this_ptr_conv);
25250 }
25251
25252 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25253         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25254         *ret_copy = Balance_clone(arg);
25255         uint64_t ret_ref = tag_ptr(ret_copy, true);
25256         return ret_ref;
25257 }
25258 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
25259         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
25260         int64_t ret_conv = Balance_clone_ptr(arg_conv);
25261         return ret_conv;
25262 }
25263
25264 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
25265         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
25266         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25267         *ret_copy = Balance_clone(orig_conv);
25268         uint64_t ret_ref = tag_ptr(ret_copy, true);
25269         return ret_ref;
25270 }
25271
25272 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
25273         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25274         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25275         uint64_t ret_ref = tag_ptr(ret_copy, true);
25276         return ret_ref;
25277 }
25278
25279 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
25280         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25281         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25282         uint64_t ret_ref = tag_ptr(ret_copy, true);
25283         return ret_ref;
25284 }
25285
25286 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
25287         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25288         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25289         uint64_t ret_ref = tag_ptr(ret_copy, true);
25290         return ret_ref;
25291 }
25292
25293 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) {
25294         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25295         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
25296         uint64_t ret_ref = tag_ptr(ret_copy, true);
25297         return ret_ref;
25298 }
25299
25300 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) {
25301         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25302         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
25303         uint64_t ret_ref = tag_ptr(ret_copy, true);
25304         return ret_ref;
25305 }
25306
25307 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
25308         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25309         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
25310         uint64_t ret_ref = tag_ptr(ret_copy, true);
25311         return ret_ref;
25312 }
25313
25314 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
25315         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
25316         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
25317         jboolean ret_conv = Balance_eq(a_conv, b_conv);
25318         return ret_conv;
25319 }
25320
25321 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
25322         LDKChannelMonitor this_obj_conv;
25323         this_obj_conv.inner = untag_ptr(this_obj);
25324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25326         ChannelMonitor_free(this_obj_conv);
25327 }
25328
25329 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25330         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25331         uint64_t ret_ref = 0;
25332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25334         return ret_ref;
25335 }
25336 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
25337         LDKChannelMonitor arg_conv;
25338         arg_conv.inner = untag_ptr(arg);
25339         arg_conv.is_owned = ptr_is_owned(arg);
25340         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25341         arg_conv.is_owned = false;
25342         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
25343         return ret_conv;
25344 }
25345
25346 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
25347         LDKChannelMonitor orig_conv;
25348         orig_conv.inner = untag_ptr(orig);
25349         orig_conv.is_owned = ptr_is_owned(orig);
25350         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25351         orig_conv.is_owned = false;
25352         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25353         uint64_t ret_ref = 0;
25354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25356         return ret_ref;
25357 }
25358
25359 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
25360         LDKChannelMonitor obj_conv;
25361         obj_conv.inner = untag_ptr(obj);
25362         obj_conv.is_owned = ptr_is_owned(obj);
25363         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25364         obj_conv.is_owned = false;
25365         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25366         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25367         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25368         CVec_u8Z_free(ret_var);
25369         return ret_arr;
25370 }
25371
25372 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) {
25373         LDKChannelMonitor this_arg_conv;
25374         this_arg_conv.inner = untag_ptr(this_arg);
25375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25377         this_arg_conv.is_owned = false;
25378         LDKChannelMonitorUpdate updates_conv;
25379         updates_conv.inner = untag_ptr(updates);
25380         updates_conv.is_owned = ptr_is_owned(updates);
25381         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25382         updates_conv.is_owned = false;
25383         void* broadcaster_ptr = untag_ptr(broadcaster);
25384         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
25385         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25386         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25387         CHECK_ACCESS(fee_estimator_ptr);
25388         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25389         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25390                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25391                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25392         }
25393         void* logger_ptr = untag_ptr(logger);
25394         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25395         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25396         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25397         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25398         return tag_ptr(ret_conv, true);
25399 }
25400
25401 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
25402         LDKChannelMonitor this_arg_conv;
25403         this_arg_conv.inner = untag_ptr(this_arg);
25404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25406         this_arg_conv.is_owned = false;
25407         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25408         return ret_conv;
25409 }
25410
25411 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
25412         LDKChannelMonitor this_arg_conv;
25413         this_arg_conv.inner = untag_ptr(this_arg);
25414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25416         this_arg_conv.is_owned = false;
25417         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25418         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25419         return tag_ptr(ret_conv, true);
25420 }
25421
25422 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
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         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25429         uint64_tArray ret_arr = NULL;
25430         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25431         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25432         for (size_t o = 0; o < ret_var.datalen; o++) {
25433                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25434                 *ret_conv_40_conv = ret_var.data[o];
25435                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
25436         }
25437         
25438         FREE(ret_var.data);
25439         return ret_arr;
25440 }
25441
25442 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
25443         LDKChannelMonitor this_arg_conv;
25444         this_arg_conv.inner = untag_ptr(this_arg);
25445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25447         this_arg_conv.is_owned = false;
25448         void* filter_ptr = untag_ptr(filter);
25449         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
25450         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25451         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25452 }
25453
25454 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) {
25455         LDKChannelMonitor this_arg_conv;
25456         this_arg_conv.inner = untag_ptr(this_arg);
25457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25459         this_arg_conv.is_owned = false;
25460         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25461         uint64_tArray ret_arr = NULL;
25462         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25463         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25464         for (size_t o = 0; o < ret_var.datalen; o++) {
25465                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25466                 *ret_conv_14_copy = ret_var.data[o];
25467                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
25468                 ret_arr_ptr[o] = ret_conv_14_ref;
25469         }
25470         
25471         FREE(ret_var.data);
25472         return ret_arr;
25473 }
25474
25475 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
25476         LDKChannelMonitor this_arg_conv;
25477         this_arg_conv.inner = untag_ptr(this_arg);
25478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25480         this_arg_conv.is_owned = false;
25481         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25482         uint64_tArray ret_arr = NULL;
25483         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25484         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25485         for (size_t h = 0; h < ret_var.datalen; h++) {
25486                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25487                 *ret_conv_7_copy = ret_var.data[h];
25488                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
25489                 ret_arr_ptr[h] = ret_conv_7_ref;
25490         }
25491         
25492         FREE(ret_var.data);
25493         return ret_arr;
25494 }
25495
25496 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
25497         LDKChannelMonitor this_arg_conv;
25498         this_arg_conv.inner = untag_ptr(this_arg);
25499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25501         this_arg_conv.is_owned = false;
25502         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25503         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
25504         return ret_arr;
25505 }
25506
25507 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) {
25508         LDKChannelMonitor this_arg_conv;
25509         this_arg_conv.inner = untag_ptr(this_arg);
25510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25512         this_arg_conv.is_owned = false;
25513         void* logger_ptr = untag_ptr(logger);
25514         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25515         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25516         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25517         ptrArray ret_arr = NULL;
25518         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
25519         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
25520         for (size_t m = 0; m < ret_var.datalen; m++) {
25521                 LDKTransaction ret_conv_12_var = ret_var.data[m];
25522                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
25523                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
25524                 Transaction_free(ret_conv_12_var);
25525                 ret_arr_ptr[m] = ret_conv_12_arr;
25526         }
25527         
25528         FREE(ret_var.data);
25529         return ret_arr;
25530 }
25531
25532 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) {
25533         LDKChannelMonitor this_arg_conv;
25534         this_arg_conv.inner = untag_ptr(this_arg);
25535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25537         this_arg_conv.is_owned = false;
25538         uint8_t header_arr[80];
25539         CHECK(header->arr_len == 80);
25540         memcpy(header_arr, header->elems, 80); FREE(header);
25541         uint8_t (*header_ref)[80] = &header_arr;
25542         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25543         txdata_constr.datalen = txdata->arr_len;
25544         if (txdata_constr.datalen > 0)
25545                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25546         else
25547                 txdata_constr.data = NULL;
25548         uint64_t* txdata_vals = txdata->elems;
25549         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25550                 uint64_t txdata_conv_28 = txdata_vals[c];
25551                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25552                 CHECK_ACCESS(txdata_conv_28_ptr);
25553                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25554                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25555                 txdata_constr.data[c] = txdata_conv_28_conv;
25556         }
25557         FREE(txdata);
25558         void* broadcaster_ptr = untag_ptr(broadcaster);
25559         CHECK_ACCESS(broadcaster_ptr);
25560         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25561         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25562                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25563                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25564         }
25565         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25566         CHECK_ACCESS(fee_estimator_ptr);
25567         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25568         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25569                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25570                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25571         }
25572         void* logger_ptr = untag_ptr(logger);
25573         CHECK_ACCESS(logger_ptr);
25574         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25575         if (logger_conv.free == LDKLogger_JCalls_free) {
25576                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25577                 LDKLogger_JCalls_cloned(&logger_conv);
25578         }
25579         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);
25580         uint64_tArray ret_arr = NULL;
25581         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25582         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25583         for (size_t n = 0; n < ret_var.datalen; n++) {
25584                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25585                 *ret_conv_39_conv = ret_var.data[n];
25586                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25587         }
25588         
25589         FREE(ret_var.data);
25590         return ret_arr;
25591 }
25592
25593 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) {
25594         LDKChannelMonitor this_arg_conv;
25595         this_arg_conv.inner = untag_ptr(this_arg);
25596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25598         this_arg_conv.is_owned = false;
25599         uint8_t header_arr[80];
25600         CHECK(header->arr_len == 80);
25601         memcpy(header_arr, header->elems, 80); FREE(header);
25602         uint8_t (*header_ref)[80] = &header_arr;
25603         void* broadcaster_ptr = untag_ptr(broadcaster);
25604         CHECK_ACCESS(broadcaster_ptr);
25605         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25606         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25607                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25608                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25609         }
25610         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25611         CHECK_ACCESS(fee_estimator_ptr);
25612         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25613         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25614                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25615                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25616         }
25617         void* logger_ptr = untag_ptr(logger);
25618         CHECK_ACCESS(logger_ptr);
25619         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25620         if (logger_conv.free == LDKLogger_JCalls_free) {
25621                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25622                 LDKLogger_JCalls_cloned(&logger_conv);
25623         }
25624         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25625 }
25626
25627 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) {
25628         LDKChannelMonitor this_arg_conv;
25629         this_arg_conv.inner = untag_ptr(this_arg);
25630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25632         this_arg_conv.is_owned = false;
25633         uint8_t header_arr[80];
25634         CHECK(header->arr_len == 80);
25635         memcpy(header_arr, header->elems, 80); FREE(header);
25636         uint8_t (*header_ref)[80] = &header_arr;
25637         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25638         txdata_constr.datalen = txdata->arr_len;
25639         if (txdata_constr.datalen > 0)
25640                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25641         else
25642                 txdata_constr.data = NULL;
25643         uint64_t* txdata_vals = txdata->elems;
25644         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25645                 uint64_t txdata_conv_28 = txdata_vals[c];
25646                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25647                 CHECK_ACCESS(txdata_conv_28_ptr);
25648                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25649                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25650                 txdata_constr.data[c] = txdata_conv_28_conv;
25651         }
25652         FREE(txdata);
25653         void* broadcaster_ptr = untag_ptr(broadcaster);
25654         CHECK_ACCESS(broadcaster_ptr);
25655         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25656         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25657                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25658                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25659         }
25660         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25661         CHECK_ACCESS(fee_estimator_ptr);
25662         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25663         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25664                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25665                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25666         }
25667         void* logger_ptr = untag_ptr(logger);
25668         CHECK_ACCESS(logger_ptr);
25669         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25670         if (logger_conv.free == LDKLogger_JCalls_free) {
25671                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25672                 LDKLogger_JCalls_cloned(&logger_conv);
25673         }
25674         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);
25675         uint64_tArray ret_arr = NULL;
25676         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25677         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25678         for (size_t n = 0; n < ret_var.datalen; n++) {
25679                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25680                 *ret_conv_39_conv = ret_var.data[n];
25681                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25682         }
25683         
25684         FREE(ret_var.data);
25685         return ret_arr;
25686 }
25687
25688 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) {
25689         LDKChannelMonitor this_arg_conv;
25690         this_arg_conv.inner = untag_ptr(this_arg);
25691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25693         this_arg_conv.is_owned = false;
25694         uint8_t txid_arr[32];
25695         CHECK(txid->arr_len == 32);
25696         memcpy(txid_arr, txid->elems, 32); FREE(txid);
25697         uint8_t (*txid_ref)[32] = &txid_arr;
25698         void* broadcaster_ptr = untag_ptr(broadcaster);
25699         CHECK_ACCESS(broadcaster_ptr);
25700         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25701         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25702                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25703                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25704         }
25705         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25706         CHECK_ACCESS(fee_estimator_ptr);
25707         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25708         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25709                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25710                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25711         }
25712         void* logger_ptr = untag_ptr(logger);
25713         CHECK_ACCESS(logger_ptr);
25714         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25715         if (logger_conv.free == LDKLogger_JCalls_free) {
25716                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25717                 LDKLogger_JCalls_cloned(&logger_conv);
25718         }
25719         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25720 }
25721
25722 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) {
25723         LDKChannelMonitor this_arg_conv;
25724         this_arg_conv.inner = untag_ptr(this_arg);
25725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25727         this_arg_conv.is_owned = false;
25728         uint8_t header_arr[80];
25729         CHECK(header->arr_len == 80);
25730         memcpy(header_arr, header->elems, 80); FREE(header);
25731         uint8_t (*header_ref)[80] = &header_arr;
25732         void* broadcaster_ptr = untag_ptr(broadcaster);
25733         CHECK_ACCESS(broadcaster_ptr);
25734         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25735         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25736                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25737                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25738         }
25739         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25740         CHECK_ACCESS(fee_estimator_ptr);
25741         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25742         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25743                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25744                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25745         }
25746         void* logger_ptr = untag_ptr(logger);
25747         CHECK_ACCESS(logger_ptr);
25748         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25749         if (logger_conv.free == LDKLogger_JCalls_free) {
25750                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25751                 LDKLogger_JCalls_cloned(&logger_conv);
25752         }
25753         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_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 n = 0; n < ret_var.datalen; n++) {
25758                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25759                 *ret_conv_39_conv = ret_var.data[n];
25760                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25761         }
25762         
25763         FREE(ret_var.data);
25764         return ret_arr;
25765 }
25766
25767 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(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         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
25774         uint64_tArray ret_arr = NULL;
25775         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25776         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25777         for (size_t z = 0; z < ret_var.datalen; z++) {
25778                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
25779                 *ret_conv_25_conv = ret_var.data[z];
25780                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
25781         }
25782         
25783         FREE(ret_var.data);
25784         return ret_arr;
25785 }
25786
25787 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
25788         LDKChannelMonitor this_arg_conv;
25789         this_arg_conv.inner = untag_ptr(this_arg);
25790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25792         this_arg_conv.is_owned = false;
25793         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
25794         uint64_t ret_ref = 0;
25795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25797         return ret_ref;
25798 }
25799
25800 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) {
25801         LDKChannelMonitor this_arg_conv;
25802         this_arg_conv.inner = untag_ptr(this_arg);
25803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25805         this_arg_conv.is_owned = false;
25806         void* broadcaster_ptr = untag_ptr(broadcaster);
25807         CHECK_ACCESS(broadcaster_ptr);
25808         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25809         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25810                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25811                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25812         }
25813         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25814         CHECK_ACCESS(fee_estimator_ptr);
25815         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25816         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25817                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25818                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25819         }
25820         void* logger_ptr = untag_ptr(logger);
25821         CHECK_ACCESS(logger_ptr);
25822         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25823         if (logger_conv.free == LDKLogger_JCalls_free) {
25824                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25825                 LDKLogger_JCalls_cloned(&logger_conv);
25826         }
25827         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25828 }
25829
25830 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
25831         LDKChannelMonitor this_arg_conv;
25832         this_arg_conv.inner = untag_ptr(this_arg);
25833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25835         this_arg_conv.is_owned = false;
25836         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
25837         uint64_tArray ret_arr = NULL;
25838         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25839         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25840         for (size_t j = 0; j < ret_var.datalen; j++) {
25841                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25842                 *ret_conv_9_copy = ret_var.data[j];
25843                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25844                 ret_arr_ptr[j] = ret_conv_9_ref;
25845         }
25846         
25847         FREE(ret_var.data);
25848         return ret_arr;
25849 }
25850
25851 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
25852         LDKu8slice ser_ref;
25853         ser_ref.datalen = ser->arr_len;
25854         ser_ref.data = ser->elems;
25855         void* arg_a_ptr = untag_ptr(arg_a);
25856         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
25857         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
25858         void* arg_b_ptr = untag_ptr(arg_b);
25859         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
25860         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
25861         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25862         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
25863         FREE(ser);
25864         return tag_ptr(ret_conv, true);
25865 }
25866
25867 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
25868         LDKOutPoint this_obj_conv;
25869         this_obj_conv.inner = untag_ptr(this_obj);
25870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25872         OutPoint_free(this_obj_conv);
25873 }
25874
25875 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
25876         LDKOutPoint this_ptr_conv;
25877         this_ptr_conv.inner = untag_ptr(this_ptr);
25878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25880         this_ptr_conv.is_owned = false;
25881         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25882         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
25883         return ret_arr;
25884 }
25885
25886 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
25887         LDKOutPoint this_ptr_conv;
25888         this_ptr_conv.inner = untag_ptr(this_ptr);
25889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25891         this_ptr_conv.is_owned = false;
25892         LDKThirtyTwoBytes val_ref;
25893         CHECK(val->arr_len == 32);
25894         memcpy(val_ref.data, val->elems, 32); FREE(val);
25895         OutPoint_set_txid(&this_ptr_conv, val_ref);
25896 }
25897
25898 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
25899         LDKOutPoint this_ptr_conv;
25900         this_ptr_conv.inner = untag_ptr(this_ptr);
25901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25903         this_ptr_conv.is_owned = false;
25904         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
25905         return ret_conv;
25906 }
25907
25908 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
25909         LDKOutPoint this_ptr_conv;
25910         this_ptr_conv.inner = untag_ptr(this_ptr);
25911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25913         this_ptr_conv.is_owned = false;
25914         OutPoint_set_index(&this_ptr_conv, val);
25915 }
25916
25917 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
25918         LDKThirtyTwoBytes txid_arg_ref;
25919         CHECK(txid_arg->arr_len == 32);
25920         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
25921         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
25922         uint64_t ret_ref = 0;
25923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25925         return ret_ref;
25926 }
25927
25928 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
25929         LDKOutPoint ret_var = OutPoint_clone(arg);
25930         uint64_t ret_ref = 0;
25931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25933         return ret_ref;
25934 }
25935 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
25936         LDKOutPoint arg_conv;
25937         arg_conv.inner = untag_ptr(arg);
25938         arg_conv.is_owned = ptr_is_owned(arg);
25939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25940         arg_conv.is_owned = false;
25941         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
25942         return ret_conv;
25943 }
25944
25945 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
25946         LDKOutPoint orig_conv;
25947         orig_conv.inner = untag_ptr(orig);
25948         orig_conv.is_owned = ptr_is_owned(orig);
25949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25950         orig_conv.is_owned = false;
25951         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
25952         uint64_t ret_ref = 0;
25953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25955         return ret_ref;
25956 }
25957
25958 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
25959         LDKOutPoint a_conv;
25960         a_conv.inner = untag_ptr(a);
25961         a_conv.is_owned = ptr_is_owned(a);
25962         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25963         a_conv.is_owned = false;
25964         LDKOutPoint b_conv;
25965         b_conv.inner = untag_ptr(b);
25966         b_conv.is_owned = ptr_is_owned(b);
25967         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25968         b_conv.is_owned = false;
25969         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
25970         return ret_conv;
25971 }
25972
25973 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
25974         LDKOutPoint o_conv;
25975         o_conv.inner = untag_ptr(o);
25976         o_conv.is_owned = ptr_is_owned(o);
25977         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25978         o_conv.is_owned = false;
25979         int64_t ret_conv = OutPoint_hash(&o_conv);
25980         return ret_conv;
25981 }
25982
25983 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
25984         LDKOutPoint this_arg_conv;
25985         this_arg_conv.inner = untag_ptr(this_arg);
25986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25988         this_arg_conv.is_owned = false;
25989         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25990         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
25991         return ret_arr;
25992 }
25993
25994 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
25995         LDKOutPoint obj_conv;
25996         obj_conv.inner = untag_ptr(obj);
25997         obj_conv.is_owned = ptr_is_owned(obj);
25998         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25999         obj_conv.is_owned = false;
26000         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26001         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26002         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26003         CVec_u8Z_free(ret_var);
26004         return ret_arr;
26005 }
26006
26007 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
26008         LDKu8slice ser_ref;
26009         ser_ref.datalen = ser->arr_len;
26010         ser_ref.data = ser->elems;
26011         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
26012         *ret_conv = OutPoint_read(ser_ref);
26013         FREE(ser);
26014         return tag_ptr(ret_conv, true);
26015 }
26016
26017 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
26018         LDKDelayedPaymentOutputDescriptor this_obj_conv;
26019         this_obj_conv.inner = untag_ptr(this_obj);
26020         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26022         DelayedPaymentOutputDescriptor_free(this_obj_conv);
26023 }
26024
26025 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26026         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26027         this_ptr_conv.inner = untag_ptr(this_ptr);
26028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26030         this_ptr_conv.is_owned = false;
26031         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26032         uint64_t ret_ref = 0;
26033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26035         return ret_ref;
26036 }
26037
26038 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26039         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26040         this_ptr_conv.inner = untag_ptr(this_ptr);
26041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26043         this_ptr_conv.is_owned = false;
26044         LDKOutPoint val_conv;
26045         val_conv.inner = untag_ptr(val);
26046         val_conv.is_owned = ptr_is_owned(val);
26047         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26048         val_conv = OutPoint_clone(&val_conv);
26049         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26050 }
26051
26052 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
26053         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26054         this_ptr_conv.inner = untag_ptr(this_ptr);
26055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26057         this_ptr_conv.is_owned = false;
26058         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26059         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26060         return ret_arr;
26061 }
26062
26063 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
26064         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26065         this_ptr_conv.inner = untag_ptr(this_ptr);
26066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26068         this_ptr_conv.is_owned = false;
26069         LDKPublicKey val_ref;
26070         CHECK(val->arr_len == 33);
26071         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26072         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26073 }
26074
26075 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
26076         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26077         this_ptr_conv.inner = untag_ptr(this_ptr);
26078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26080         this_ptr_conv.is_owned = false;
26081         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26082         return ret_conv;
26083 }
26084
26085 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_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         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26092 }
26093
26094 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26095         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26096         this_ptr_conv.inner = untag_ptr(this_ptr);
26097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26099         this_ptr_conv.is_owned = false;
26100         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26101         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
26102         return tag_ptr(ret_ref, true);
26103 }
26104
26105 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26106         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26107         this_ptr_conv.inner = untag_ptr(this_ptr);
26108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26110         this_ptr_conv.is_owned = false;
26111         void* val_ptr = untag_ptr(val);
26112         CHECK_ACCESS(val_ptr);
26113         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26114         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26115         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26116 }
26117
26118 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
26119         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26120         this_ptr_conv.inner = untag_ptr(this_ptr);
26121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26123         this_ptr_conv.is_owned = false;
26124         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26125         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
26126         return ret_arr;
26127 }
26128
26129 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
26130         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26131         this_ptr_conv.inner = untag_ptr(this_ptr);
26132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26134         this_ptr_conv.is_owned = false;
26135         LDKPublicKey val_ref;
26136         CHECK(val->arr_len == 33);
26137         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26138         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26139 }
26140
26141 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26142         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26143         this_ptr_conv.inner = untag_ptr(this_ptr);
26144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26146         this_ptr_conv.is_owned = false;
26147         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26148         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26149         return ret_arr;
26150 }
26151
26152 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26153         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26154         this_ptr_conv.inner = untag_ptr(this_ptr);
26155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26157         this_ptr_conv.is_owned = false;
26158         LDKThirtyTwoBytes val_ref;
26159         CHECK(val->arr_len == 32);
26160         memcpy(val_ref.data, val->elems, 32); FREE(val);
26161         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26162 }
26163
26164 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26165         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26166         this_ptr_conv.inner = untag_ptr(this_ptr);
26167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26169         this_ptr_conv.is_owned = false;
26170         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26171         return ret_conv;
26172 }
26173
26174 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26175         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26176         this_ptr_conv.inner = untag_ptr(this_ptr);
26177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26179         this_ptr_conv.is_owned = false;
26180         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26181 }
26182
26183 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) {
26184         LDKOutPoint outpoint_arg_conv;
26185         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26186         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26187         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26188         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26189         LDKPublicKey per_commitment_point_arg_ref;
26190         CHECK(per_commitment_point_arg->arr_len == 33);
26191         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
26192         void* output_arg_ptr = untag_ptr(output_arg);
26193         CHECK_ACCESS(output_arg_ptr);
26194         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26195         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26196         LDKPublicKey revocation_pubkey_arg_ref;
26197         CHECK(revocation_pubkey_arg->arr_len == 33);
26198         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
26199         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26200         CHECK(channel_keys_id_arg->arr_len == 32);
26201         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26202         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);
26203         uint64_t ret_ref = 0;
26204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26206         return ret_ref;
26207 }
26208
26209 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26210         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26211         uint64_t ret_ref = 0;
26212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26214         return ret_ref;
26215 }
26216 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26217         LDKDelayedPaymentOutputDescriptor arg_conv;
26218         arg_conv.inner = untag_ptr(arg);
26219         arg_conv.is_owned = ptr_is_owned(arg);
26220         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26221         arg_conv.is_owned = false;
26222         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26223         return ret_conv;
26224 }
26225
26226 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
26227         LDKDelayedPaymentOutputDescriptor orig_conv;
26228         orig_conv.inner = untag_ptr(orig);
26229         orig_conv.is_owned = ptr_is_owned(orig);
26230         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26231         orig_conv.is_owned = false;
26232         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26233         uint64_t ret_ref = 0;
26234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26236         return ret_ref;
26237 }
26238
26239 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26240         LDKDelayedPaymentOutputDescriptor a_conv;
26241         a_conv.inner = untag_ptr(a);
26242         a_conv.is_owned = ptr_is_owned(a);
26243         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26244         a_conv.is_owned = false;
26245         LDKDelayedPaymentOutputDescriptor b_conv;
26246         b_conv.inner = untag_ptr(b);
26247         b_conv.is_owned = ptr_is_owned(b);
26248         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26249         b_conv.is_owned = false;
26250         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26251         return ret_conv;
26252 }
26253
26254 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
26255         LDKDelayedPaymentOutputDescriptor obj_conv;
26256         obj_conv.inner = untag_ptr(obj);
26257         obj_conv.is_owned = ptr_is_owned(obj);
26258         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26259         obj_conv.is_owned = false;
26260         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26261         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26262         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26263         CVec_u8Z_free(ret_var);
26264         return ret_arr;
26265 }
26266
26267 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
26268         LDKu8slice ser_ref;
26269         ser_ref.datalen = ser->arr_len;
26270         ser_ref.data = ser->elems;
26271         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26272         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26273         FREE(ser);
26274         return tag_ptr(ret_conv, true);
26275 }
26276
26277 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
26278         LDKStaticPaymentOutputDescriptor this_obj_conv;
26279         this_obj_conv.inner = untag_ptr(this_obj);
26280         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26282         StaticPaymentOutputDescriptor_free(this_obj_conv);
26283 }
26284
26285 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26286         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26287         this_ptr_conv.inner = untag_ptr(this_ptr);
26288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26290         this_ptr_conv.is_owned = false;
26291         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26292         uint64_t ret_ref = 0;
26293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26295         return ret_ref;
26296 }
26297
26298 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26299         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26300         this_ptr_conv.inner = untag_ptr(this_ptr);
26301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26303         this_ptr_conv.is_owned = false;
26304         LDKOutPoint val_conv;
26305         val_conv.inner = untag_ptr(val);
26306         val_conv.is_owned = ptr_is_owned(val);
26307         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26308         val_conv = OutPoint_clone(&val_conv);
26309         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26310 }
26311
26312 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26313         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26314         this_ptr_conv.inner = untag_ptr(this_ptr);
26315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26317         this_ptr_conv.is_owned = false;
26318         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26319         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
26320         return tag_ptr(ret_ref, true);
26321 }
26322
26323 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26324         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26325         this_ptr_conv.inner = untag_ptr(this_ptr);
26326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26328         this_ptr_conv.is_owned = false;
26329         void* val_ptr = untag_ptr(val);
26330         CHECK_ACCESS(val_ptr);
26331         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26332         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26333         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26334 }
26335
26336 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26337         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26338         this_ptr_conv.inner = untag_ptr(this_ptr);
26339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26341         this_ptr_conv.is_owned = false;
26342         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26343         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26344         return ret_arr;
26345 }
26346
26347 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26348         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26349         this_ptr_conv.inner = untag_ptr(this_ptr);
26350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26352         this_ptr_conv.is_owned = false;
26353         LDKThirtyTwoBytes val_ref;
26354         CHECK(val->arr_len == 32);
26355         memcpy(val_ref.data, val->elems, 32); FREE(val);
26356         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26357 }
26358
26359 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26360         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26361         this_ptr_conv.inner = untag_ptr(this_ptr);
26362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26364         this_ptr_conv.is_owned = false;
26365         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26366         return ret_conv;
26367 }
26368
26369 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26370         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26371         this_ptr_conv.inner = untag_ptr(this_ptr);
26372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26374         this_ptr_conv.is_owned = false;
26375         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26376 }
26377
26378 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) {
26379         LDKOutPoint outpoint_arg_conv;
26380         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26381         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26382         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26383         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26384         void* output_arg_ptr = untag_ptr(output_arg);
26385         CHECK_ACCESS(output_arg_ptr);
26386         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26387         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26388         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26389         CHECK(channel_keys_id_arg->arr_len == 32);
26390         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26391         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26392         uint64_t ret_ref = 0;
26393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26395         return ret_ref;
26396 }
26397
26398 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26399         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26400         uint64_t ret_ref = 0;
26401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26403         return ret_ref;
26404 }
26405 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26406         LDKStaticPaymentOutputDescriptor arg_conv;
26407         arg_conv.inner = untag_ptr(arg);
26408         arg_conv.is_owned = ptr_is_owned(arg);
26409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26410         arg_conv.is_owned = false;
26411         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26412         return ret_conv;
26413 }
26414
26415 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
26416         LDKStaticPaymentOutputDescriptor orig_conv;
26417         orig_conv.inner = untag_ptr(orig);
26418         orig_conv.is_owned = ptr_is_owned(orig);
26419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26420         orig_conv.is_owned = false;
26421         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26422         uint64_t ret_ref = 0;
26423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26425         return ret_ref;
26426 }
26427
26428 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26429         LDKStaticPaymentOutputDescriptor a_conv;
26430         a_conv.inner = untag_ptr(a);
26431         a_conv.is_owned = ptr_is_owned(a);
26432         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26433         a_conv.is_owned = false;
26434         LDKStaticPaymentOutputDescriptor b_conv;
26435         b_conv.inner = untag_ptr(b);
26436         b_conv.is_owned = ptr_is_owned(b);
26437         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26438         b_conv.is_owned = false;
26439         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26440         return ret_conv;
26441 }
26442
26443 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
26444         LDKStaticPaymentOutputDescriptor obj_conv;
26445         obj_conv.inner = untag_ptr(obj);
26446         obj_conv.is_owned = ptr_is_owned(obj);
26447         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26448         obj_conv.is_owned = false;
26449         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26450         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26451         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26452         CVec_u8Z_free(ret_var);
26453         return ret_arr;
26454 }
26455
26456 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
26457         LDKu8slice ser_ref;
26458         ser_ref.datalen = ser->arr_len;
26459         ser_ref.data = ser->elems;
26460         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26461         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26462         FREE(ser);
26463         return tag_ptr(ret_conv, true);
26464 }
26465
26466 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
26467         if (!ptr_is_owned(this_ptr)) return;
26468         void* this_ptr_ptr = untag_ptr(this_ptr);
26469         CHECK_ACCESS(this_ptr_ptr);
26470         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26471         FREE(untag_ptr(this_ptr));
26472         SpendableOutputDescriptor_free(this_ptr_conv);
26473 }
26474
26475 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26476         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26477         *ret_copy = SpendableOutputDescriptor_clone(arg);
26478         uint64_t ret_ref = tag_ptr(ret_copy, true);
26479         return ret_ref;
26480 }
26481 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
26482         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
26483         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
26484         return ret_conv;
26485 }
26486
26487 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
26488         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
26489         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26490         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26491         uint64_t ret_ref = tag_ptr(ret_copy, true);
26492         return ret_ref;
26493 }
26494
26495 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
26496         LDKOutPoint outpoint_conv;
26497         outpoint_conv.inner = untag_ptr(outpoint);
26498         outpoint_conv.is_owned = ptr_is_owned(outpoint);
26499         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26500         outpoint_conv = OutPoint_clone(&outpoint_conv);
26501         void* output_ptr = untag_ptr(output);
26502         CHECK_ACCESS(output_ptr);
26503         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26504         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
26505         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26506         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26507         uint64_t ret_ref = tag_ptr(ret_copy, true);
26508         return ret_ref;
26509 }
26510
26511 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
26512         LDKDelayedPaymentOutputDescriptor a_conv;
26513         a_conv.inner = untag_ptr(a);
26514         a_conv.is_owned = ptr_is_owned(a);
26515         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26516         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26517         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26518         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26519         uint64_t ret_ref = tag_ptr(ret_copy, true);
26520         return ret_ref;
26521 }
26522
26523 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
26524         LDKStaticPaymentOutputDescriptor a_conv;
26525         a_conv.inner = untag_ptr(a);
26526         a_conv.is_owned = ptr_is_owned(a);
26527         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26528         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26529         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26530         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26531         uint64_t ret_ref = tag_ptr(ret_copy, true);
26532         return ret_ref;
26533 }
26534
26535 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
26536         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
26537         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
26538         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
26539         return ret_conv;
26540 }
26541
26542 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
26543         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
26544         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26547         CVec_u8Z_free(ret_var);
26548         return ret_arr;
26549 }
26550
26551 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
26552         LDKu8slice ser_ref;
26553         ser_ref.datalen = ser->arr_len;
26554         ser_ref.data = ser->elems;
26555         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26556         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26557         FREE(ser);
26558         return tag_ptr(ret_conv, true);
26559 }
26560
26561 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
26562         if (!ptr_is_owned(this_ptr)) return;
26563         void* this_ptr_ptr = untag_ptr(this_ptr);
26564         CHECK_ACCESS(this_ptr_ptr);
26565         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
26566         FREE(untag_ptr(this_ptr));
26567         ChannelSigner_free(this_ptr_conv);
26568 }
26569
26570 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
26571         if (!ptr_is_owned(this_ptr)) return;
26572         void* this_ptr_ptr = untag_ptr(this_ptr);
26573         CHECK_ACCESS(this_ptr_ptr);
26574         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
26575         FREE(untag_ptr(this_ptr));
26576         EcdsaChannelSigner_free(this_ptr_conv);
26577 }
26578
26579 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
26580         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26581         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
26582         return tag_ptr(ret_ret, true);
26583 }
26584 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
26585         void* arg_ptr = untag_ptr(arg);
26586         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26587         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
26588         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
26589         return ret_conv;
26590 }
26591
26592 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
26593         void* orig_ptr = untag_ptr(orig);
26594         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
26595         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
26596         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26597         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
26598         return tag_ptr(ret_ret, true);
26599 }
26600
26601 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
26602         if (!ptr_is_owned(this_ptr)) return;
26603         void* this_ptr_ptr = untag_ptr(this_ptr);
26604         CHECK_ACCESS(this_ptr_ptr);
26605         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
26606         FREE(untag_ptr(this_ptr));
26607         WriteableEcdsaChannelSigner_free(this_ptr_conv);
26608 }
26609
26610 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
26611         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
26612         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
26613         return ret_conv;
26614 }
26615
26616 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
26617         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
26618         return ret_conv;
26619 }
26620
26621 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
26622         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
26623         return ret_conv;
26624 }
26625
26626 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
26627         if (!ptr_is_owned(this_ptr)) return;
26628         void* this_ptr_ptr = untag_ptr(this_ptr);
26629         CHECK_ACCESS(this_ptr_ptr);
26630         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
26631         FREE(untag_ptr(this_ptr));
26632         EntropySource_free(this_ptr_conv);
26633 }
26634
26635 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
26636         if (!ptr_is_owned(this_ptr)) return;
26637         void* this_ptr_ptr = untag_ptr(this_ptr);
26638         CHECK_ACCESS(this_ptr_ptr);
26639         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
26640         FREE(untag_ptr(this_ptr));
26641         NodeSigner_free(this_ptr_conv);
26642 }
26643
26644 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
26645         if (!ptr_is_owned(this_ptr)) return;
26646         void* this_ptr_ptr = untag_ptr(this_ptr);
26647         CHECK_ACCESS(this_ptr_ptr);
26648         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
26649         FREE(untag_ptr(this_ptr));
26650         SignerProvider_free(this_ptr_conv);
26651 }
26652
26653 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
26654         LDKInMemorySigner this_obj_conv;
26655         this_obj_conv.inner = untag_ptr(this_obj);
26656         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26658         InMemorySigner_free(this_obj_conv);
26659 }
26660
26661 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
26662         LDKInMemorySigner this_ptr_conv;
26663         this_ptr_conv.inner = untag_ptr(this_ptr);
26664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26666         this_ptr_conv.is_owned = false;
26667         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26668         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
26669         return ret_arr;
26670 }
26671
26672 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
26673         LDKInMemorySigner this_ptr_conv;
26674         this_ptr_conv.inner = untag_ptr(this_ptr);
26675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26677         this_ptr_conv.is_owned = false;
26678         LDKSecretKey val_ref;
26679         CHECK(val->arr_len == 32);
26680         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26681         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26682 }
26683
26684 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
26685         LDKInMemorySigner this_ptr_conv;
26686         this_ptr_conv.inner = untag_ptr(this_ptr);
26687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26689         this_ptr_conv.is_owned = false;
26690         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26691         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
26692         return ret_arr;
26693 }
26694
26695 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
26696         LDKInMemorySigner this_ptr_conv;
26697         this_ptr_conv.inner = untag_ptr(this_ptr);
26698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26700         this_ptr_conv.is_owned = false;
26701         LDKSecretKey val_ref;
26702         CHECK(val->arr_len == 32);
26703         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26704         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26705 }
26706
26707 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
26708         LDKInMemorySigner this_ptr_conv;
26709         this_ptr_conv.inner = untag_ptr(this_ptr);
26710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26712         this_ptr_conv.is_owned = false;
26713         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26714         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
26715         return ret_arr;
26716 }
26717
26718 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
26719         LDKInMemorySigner this_ptr_conv;
26720         this_ptr_conv.inner = untag_ptr(this_ptr);
26721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26723         this_ptr_conv.is_owned = false;
26724         LDKSecretKey val_ref;
26725         CHECK(val->arr_len == 32);
26726         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26727         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26728 }
26729
26730 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
26731         LDKInMemorySigner this_ptr_conv;
26732         this_ptr_conv.inner = untag_ptr(this_ptr);
26733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26735         this_ptr_conv.is_owned = false;
26736         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26737         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
26738         return ret_arr;
26739 }
26740
26741 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) {
26742         LDKInMemorySigner this_ptr_conv;
26743         this_ptr_conv.inner = untag_ptr(this_ptr);
26744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26746         this_ptr_conv.is_owned = false;
26747         LDKSecretKey val_ref;
26748         CHECK(val->arr_len == 32);
26749         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26750         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26751 }
26752
26753 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
26754         LDKInMemorySigner this_ptr_conv;
26755         this_ptr_conv.inner = untag_ptr(this_ptr);
26756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26758         this_ptr_conv.is_owned = false;
26759         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26760         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
26761         return ret_arr;
26762 }
26763
26764 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
26765         LDKInMemorySigner this_ptr_conv;
26766         this_ptr_conv.inner = untag_ptr(this_ptr);
26767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26769         this_ptr_conv.is_owned = false;
26770         LDKSecretKey val_ref;
26771         CHECK(val->arr_len == 32);
26772         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26773         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26774 }
26775
26776 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
26777         LDKInMemorySigner this_ptr_conv;
26778         this_ptr_conv.inner = untag_ptr(this_ptr);
26779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26781         this_ptr_conv.is_owned = false;
26782         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26783         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
26784         return ret_arr;
26785 }
26786
26787 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
26788         LDKInMemorySigner this_ptr_conv;
26789         this_ptr_conv.inner = untag_ptr(this_ptr);
26790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26792         this_ptr_conv.is_owned = false;
26793         LDKThirtyTwoBytes val_ref;
26794         CHECK(val->arr_len == 32);
26795         memcpy(val_ref.data, val->elems, 32); FREE(val);
26796         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26797 }
26798
26799 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26800         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26801         uint64_t ret_ref = 0;
26802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26804         return ret_ref;
26805 }
26806 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
26807         LDKInMemorySigner arg_conv;
26808         arg_conv.inner = untag_ptr(arg);
26809         arg_conv.is_owned = ptr_is_owned(arg);
26810         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26811         arg_conv.is_owned = false;
26812         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
26813         return ret_conv;
26814 }
26815
26816 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
26817         LDKInMemorySigner orig_conv;
26818         orig_conv.inner = untag_ptr(orig);
26819         orig_conv.is_owned = ptr_is_owned(orig);
26820         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26821         orig_conv.is_owned = false;
26822         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26823         uint64_t ret_ref = 0;
26824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26826         return ret_ref;
26827 }
26828
26829 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) {
26830         LDKSecretKey funding_key_ref;
26831         CHECK(funding_key->arr_len == 32);
26832         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
26833         LDKSecretKey revocation_base_key_ref;
26834         CHECK(revocation_base_key->arr_len == 32);
26835         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
26836         LDKSecretKey payment_key_ref;
26837         CHECK(payment_key->arr_len == 32);
26838         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
26839         LDKSecretKey delayed_payment_base_key_ref;
26840         CHECK(delayed_payment_base_key->arr_len == 32);
26841         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
26842         LDKSecretKey htlc_base_key_ref;
26843         CHECK(htlc_base_key->arr_len == 32);
26844         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
26845         LDKThirtyTwoBytes commitment_seed_ref;
26846         CHECK(commitment_seed->arr_len == 32);
26847         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
26848         LDKThirtyTwoBytes channel_keys_id_ref;
26849         CHECK(channel_keys_id->arr_len == 32);
26850         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
26851         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
26852         CHECK(rand_bytes_unique_start->arr_len == 32);
26853         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
26854         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);
26855         uint64_t ret_ref = 0;
26856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26858         return ret_ref;
26859 }
26860
26861 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
26862         LDKInMemorySigner this_arg_conv;
26863         this_arg_conv.inner = untag_ptr(this_arg);
26864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26866         this_arg_conv.is_owned = false;
26867         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
26868         uint64_t ret_ref = 0;
26869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26871         return ret_ref;
26872 }
26873
26874 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(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         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
26881         return ret_conv;
26882 }
26883
26884 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(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         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
26891         return ret_conv;
26892 }
26893
26894 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
26895         LDKInMemorySigner this_arg_conv;
26896         this_arg_conv.inner = untag_ptr(this_arg);
26897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26899         this_arg_conv.is_owned = false;
26900         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
26901         return ret_conv;
26902 }
26903
26904 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
26905         LDKInMemorySigner this_arg_conv;
26906         this_arg_conv.inner = untag_ptr(this_arg);
26907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26909         this_arg_conv.is_owned = false;
26910         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
26911         uint64_t ret_ref = 0;
26912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26914         return ret_ref;
26915 }
26916
26917 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
26918         LDKInMemorySigner this_arg_conv;
26919         this_arg_conv.inner = untag_ptr(this_arg);
26920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26922         this_arg_conv.is_owned = false;
26923         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
26924         uint64_t ret_ref = 0;
26925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26927         return ret_ref;
26928 }
26929
26930 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
26931         LDKInMemorySigner this_arg_conv;
26932         this_arg_conv.inner = untag_ptr(this_arg);
26933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26935         this_arg_conv.is_owned = false;
26936         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
26937         return ret_conv;
26938 }
26939
26940 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) {
26941         LDKInMemorySigner this_arg_conv;
26942         this_arg_conv.inner = untag_ptr(this_arg);
26943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26945         this_arg_conv.is_owned = false;
26946         LDKTransaction spend_tx_ref;
26947         spend_tx_ref.datalen = spend_tx->arr_len;
26948         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26949         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26950         spend_tx_ref.data_is_owned = true;
26951         LDKStaticPaymentOutputDescriptor descriptor_conv;
26952         descriptor_conv.inner = untag_ptr(descriptor);
26953         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26954         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26955         descriptor_conv.is_owned = false;
26956         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26957         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26958         return tag_ptr(ret_conv, true);
26959 }
26960
26961 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) {
26962         LDKInMemorySigner this_arg_conv;
26963         this_arg_conv.inner = untag_ptr(this_arg);
26964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26966         this_arg_conv.is_owned = false;
26967         LDKTransaction spend_tx_ref;
26968         spend_tx_ref.datalen = spend_tx->arr_len;
26969         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26970         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26971         spend_tx_ref.data_is_owned = true;
26972         LDKDelayedPaymentOutputDescriptor descriptor_conv;
26973         descriptor_conv.inner = untag_ptr(descriptor);
26974         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26975         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26976         descriptor_conv.is_owned = false;
26977         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26978         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26979         return tag_ptr(ret_conv, true);
26980 }
26981
26982 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
26983         LDKInMemorySigner this_arg_conv;
26984         this_arg_conv.inner = untag_ptr(this_arg);
26985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26987         this_arg_conv.is_owned = false;
26988         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
26989         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
26990         return tag_ptr(ret_ret, true);
26991 }
26992
26993 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
26994         LDKInMemorySigner this_arg_conv;
26995         this_arg_conv.inner = untag_ptr(this_arg);
26996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26998         this_arg_conv.is_owned = false;
26999         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
27000         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
27001         return tag_ptr(ret_ret, true);
27002 }
27003
27004 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
27005         LDKInMemorySigner this_arg_conv;
27006         this_arg_conv.inner = untag_ptr(this_arg);
27007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27009         this_arg_conv.is_owned = false;
27010         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
27011         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
27012         return tag_ptr(ret_ret, true);
27013 }
27014
27015 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
27016         LDKInMemorySigner this_arg_conv;
27017         this_arg_conv.inner = untag_ptr(this_arg);
27018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27020         this_arg_conv.is_owned = false;
27021         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
27022         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
27023         return tag_ptr(ret_ret, true);
27024 }
27025
27026 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
27027         LDKInMemorySigner obj_conv;
27028         obj_conv.inner = untag_ptr(obj);
27029         obj_conv.is_owned = ptr_is_owned(obj);
27030         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27031         obj_conv.is_owned = false;
27032         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27033         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27034         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27035         CVec_u8Z_free(ret_var);
27036         return ret_arr;
27037 }
27038
27039 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
27040         LDKu8slice ser_ref;
27041         ser_ref.datalen = ser->arr_len;
27042         ser_ref.data = ser->elems;
27043         void* arg_ptr = untag_ptr(arg);
27044         CHECK_ACCESS(arg_ptr);
27045         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
27046         if (arg_conv.free == LDKEntropySource_JCalls_free) {
27047                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27048                 LDKEntropySource_JCalls_cloned(&arg_conv);
27049         }
27050         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27051         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
27052         FREE(ser);
27053         return tag_ptr(ret_conv, true);
27054 }
27055
27056 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
27057         LDKKeysManager this_obj_conv;
27058         this_obj_conv.inner = untag_ptr(this_obj);
27059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27061         KeysManager_free(this_obj_conv);
27062 }
27063
27064 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
27065         uint8_t seed_arr[32];
27066         CHECK(seed->arr_len == 32);
27067         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27068         uint8_t (*seed_ref)[32] = &seed_arr;
27069         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27070         uint64_t ret_ref = 0;
27071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27073         return ret_ref;
27074 }
27075
27076 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
27077         LDKKeysManager this_arg_conv;
27078         this_arg_conv.inner = untag_ptr(this_arg);
27079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27081         this_arg_conv.is_owned = false;
27082         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27083         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27084         return ret_arr;
27085 }
27086
27087 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) {
27088         LDKKeysManager this_arg_conv;
27089         this_arg_conv.inner = untag_ptr(this_arg);
27090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27092         this_arg_conv.is_owned = false;
27093         uint8_t params_arr[32];
27094         CHECK(params->arr_len == 32);
27095         memcpy(params_arr, params->elems, 32); FREE(params);
27096         uint8_t (*params_ref)[32] = &params_arr;
27097         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27098         uint64_t ret_ref = 0;
27099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27101         return ret_ref;
27102 }
27103
27104 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) {
27105         LDKKeysManager this_arg_conv;
27106         this_arg_conv.inner = untag_ptr(this_arg);
27107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27109         this_arg_conv.is_owned = false;
27110         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27111         descriptors_constr.datalen = descriptors->arr_len;
27112         if (descriptors_constr.datalen > 0)
27113                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27114         else
27115                 descriptors_constr.data = NULL;
27116         uint64_t* descriptors_vals = descriptors->elems;
27117         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27118                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27119                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27120                 CHECK_ACCESS(descriptors_conv_27_ptr);
27121                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27122                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27123                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27124         }
27125         FREE(descriptors);
27126         LDKCVec_TxOutZ outputs_constr;
27127         outputs_constr.datalen = outputs->arr_len;
27128         if (outputs_constr.datalen > 0)
27129                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27130         else
27131                 outputs_constr.data = NULL;
27132         uint64_t* outputs_vals = outputs->elems;
27133         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27134                 uint64_t outputs_conv_7 = outputs_vals[h];
27135                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27136                 CHECK_ACCESS(outputs_conv_7_ptr);
27137                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27138                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27139                 outputs_constr.data[h] = outputs_conv_7_conv;
27140         }
27141         FREE(outputs);
27142         LDKCVec_u8Z change_destination_script_ref;
27143         change_destination_script_ref.datalen = change_destination_script->arr_len;
27144         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27145         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27146         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27147         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27148         return tag_ptr(ret_conv, true);
27149 }
27150
27151 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
27152         LDKKeysManager this_arg_conv;
27153         this_arg_conv.inner = untag_ptr(this_arg);
27154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27156         this_arg_conv.is_owned = false;
27157         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27158         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
27159         return tag_ptr(ret_ret, true);
27160 }
27161
27162 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
27163         LDKKeysManager this_arg_conv;
27164         this_arg_conv.inner = untag_ptr(this_arg);
27165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27167         this_arg_conv.is_owned = false;
27168         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27169         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
27170         return tag_ptr(ret_ret, true);
27171 }
27172
27173 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
27174         LDKKeysManager this_arg_conv;
27175         this_arg_conv.inner = untag_ptr(this_arg);
27176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27178         this_arg_conv.is_owned = false;
27179         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27180         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
27181         return tag_ptr(ret_ret, true);
27182 }
27183
27184 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
27185         LDKPhantomKeysManager this_obj_conv;
27186         this_obj_conv.inner = untag_ptr(this_obj);
27187         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27189         PhantomKeysManager_free(this_obj_conv);
27190 }
27191
27192 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
27193         LDKPhantomKeysManager this_arg_conv;
27194         this_arg_conv.inner = untag_ptr(this_arg);
27195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27197         this_arg_conv.is_owned = false;
27198         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27199         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
27200         return tag_ptr(ret_ret, true);
27201 }
27202
27203 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
27204         LDKPhantomKeysManager this_arg_conv;
27205         this_arg_conv.inner = untag_ptr(this_arg);
27206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27208         this_arg_conv.is_owned = false;
27209         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27210         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
27211         return tag_ptr(ret_ret, true);
27212 }
27213
27214 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
27215         LDKPhantomKeysManager this_arg_conv;
27216         this_arg_conv.inner = untag_ptr(this_arg);
27217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27219         this_arg_conv.is_owned = false;
27220         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27221         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
27222         return tag_ptr(ret_ret, true);
27223 }
27224
27225 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) {
27226         uint8_t seed_arr[32];
27227         CHECK(seed->arr_len == 32);
27228         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27229         uint8_t (*seed_ref)[32] = &seed_arr;
27230         uint8_t cross_node_seed_arr[32];
27231         CHECK(cross_node_seed->arr_len == 32);
27232         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
27233         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27234         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27235         uint64_t ret_ref = 0;
27236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27238         return ret_ref;
27239 }
27240
27241 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) {
27242         LDKPhantomKeysManager this_arg_conv;
27243         this_arg_conv.inner = untag_ptr(this_arg);
27244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27246         this_arg_conv.is_owned = false;
27247         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27248         descriptors_constr.datalen = descriptors->arr_len;
27249         if (descriptors_constr.datalen > 0)
27250                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27251         else
27252                 descriptors_constr.data = NULL;
27253         uint64_t* descriptors_vals = descriptors->elems;
27254         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27255                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27256                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27257                 CHECK_ACCESS(descriptors_conv_27_ptr);
27258                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27259                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27260                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27261         }
27262         FREE(descriptors);
27263         LDKCVec_TxOutZ outputs_constr;
27264         outputs_constr.datalen = outputs->arr_len;
27265         if (outputs_constr.datalen > 0)
27266                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27267         else
27268                 outputs_constr.data = NULL;
27269         uint64_t* outputs_vals = outputs->elems;
27270         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27271                 uint64_t outputs_conv_7 = outputs_vals[h];
27272                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27273                 CHECK_ACCESS(outputs_conv_7_ptr);
27274                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27275                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27276                 outputs_constr.data[h] = outputs_conv_7_conv;
27277         }
27278         FREE(outputs);
27279         LDKCVec_u8Z change_destination_script_ref;
27280         change_destination_script_ref.datalen = change_destination_script->arr_len;
27281         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27282         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27283         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27284         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27285         return tag_ptr(ret_conv, true);
27286 }
27287
27288 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) {
27289         LDKPhantomKeysManager this_arg_conv;
27290         this_arg_conv.inner = untag_ptr(this_arg);
27291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27293         this_arg_conv.is_owned = false;
27294         uint8_t params_arr[32];
27295         CHECK(params->arr_len == 32);
27296         memcpy(params_arr, params->elems, 32); FREE(params);
27297         uint8_t (*params_ref)[32] = &params_arr;
27298         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27299         uint64_t ret_ref = 0;
27300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27302         return ret_ref;
27303 }
27304
27305 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
27306         LDKPhantomKeysManager this_arg_conv;
27307         this_arg_conv.inner = untag_ptr(this_arg);
27308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27310         this_arg_conv.is_owned = false;
27311         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27312         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27313         return ret_arr;
27314 }
27315
27316 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
27317         LDKPhantomKeysManager this_arg_conv;
27318         this_arg_conv.inner = untag_ptr(this_arg);
27319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27321         this_arg_conv.is_owned = false;
27322         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27323         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
27324         return ret_arr;
27325 }
27326
27327 uint32_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
27328         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
27329         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_clone(orig_conv));
27330         return ret_conv;
27331 }
27332
27333 uint32_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
27334         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_temporary_node_failure());
27335         return ret_conv;
27336 }
27337
27338 uint32_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
27339         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_required_node_feature_missing());
27340         return ret_conv;
27341 }
27342
27343 uint32_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
27344         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_incorrect_or_unknown_payment_details());
27345         return ret_conv;
27346 }
27347
27348 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
27349         LDKChannelManager this_obj_conv;
27350         this_obj_conv.inner = untag_ptr(this_obj);
27351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27353         ChannelManager_free(this_obj_conv);
27354 }
27355
27356 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
27357         LDKChainParameters this_obj_conv;
27358         this_obj_conv.inner = untag_ptr(this_obj);
27359         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27361         ChainParameters_free(this_obj_conv);
27362 }
27363
27364 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(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         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
27371         return ret_conv;
27372 }
27373
27374 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
27375         LDKChainParameters this_ptr_conv;
27376         this_ptr_conv.inner = untag_ptr(this_ptr);
27377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27379         this_ptr_conv.is_owned = false;
27380         LDKNetwork val_conv = LDKNetwork_from_js(val);
27381         ChainParameters_set_network(&this_ptr_conv, val_conv);
27382 }
27383
27384 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
27385         LDKChainParameters this_ptr_conv;
27386         this_ptr_conv.inner = untag_ptr(this_ptr);
27387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27389         this_ptr_conv.is_owned = false;
27390         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27391         uint64_t ret_ref = 0;
27392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27394         return ret_ref;
27395 }
27396
27397 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
27398         LDKChainParameters this_ptr_conv;
27399         this_ptr_conv.inner = untag_ptr(this_ptr);
27400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27402         this_ptr_conv.is_owned = false;
27403         LDKBestBlock val_conv;
27404         val_conv.inner = untag_ptr(val);
27405         val_conv.is_owned = ptr_is_owned(val);
27406         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27407         val_conv = BestBlock_clone(&val_conv);
27408         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27409 }
27410
27411 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
27412         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
27413         LDKBestBlock best_block_arg_conv;
27414         best_block_arg_conv.inner = untag_ptr(best_block_arg);
27415         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
27416         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27417         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27418         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27419         uint64_t ret_ref = 0;
27420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27422         return ret_ref;
27423 }
27424
27425 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27426         LDKChainParameters ret_var = ChainParameters_clone(arg);
27427         uint64_t ret_ref = 0;
27428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27430         return ret_ref;
27431 }
27432 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
27433         LDKChainParameters arg_conv;
27434         arg_conv.inner = untag_ptr(arg);
27435         arg_conv.is_owned = ptr_is_owned(arg);
27436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27437         arg_conv.is_owned = false;
27438         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
27439         return ret_conv;
27440 }
27441
27442 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
27443         LDKChainParameters orig_conv;
27444         orig_conv.inner = untag_ptr(orig);
27445         orig_conv.is_owned = ptr_is_owned(orig);
27446         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27447         orig_conv.is_owned = false;
27448         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27449         uint64_t ret_ref = 0;
27450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27452         return ret_ref;
27453 }
27454
27455 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
27456         LDKCounterpartyForwardingInfo this_obj_conv;
27457         this_obj_conv.inner = untag_ptr(this_obj);
27458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27460         CounterpartyForwardingInfo_free(this_obj_conv);
27461 }
27462
27463 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
27464         LDKCounterpartyForwardingInfo this_ptr_conv;
27465         this_ptr_conv.inner = untag_ptr(this_ptr);
27466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27468         this_ptr_conv.is_owned = false;
27469         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27470         return ret_conv;
27471 }
27472
27473 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
27474         LDKCounterpartyForwardingInfo this_ptr_conv;
27475         this_ptr_conv.inner = untag_ptr(this_ptr);
27476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27478         this_ptr_conv.is_owned = false;
27479         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27480 }
27481
27482 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
27483         LDKCounterpartyForwardingInfo this_ptr_conv;
27484         this_ptr_conv.inner = untag_ptr(this_ptr);
27485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27487         this_ptr_conv.is_owned = false;
27488         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27489         return ret_conv;
27490 }
27491
27492 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
27493         LDKCounterpartyForwardingInfo this_ptr_conv;
27494         this_ptr_conv.inner = untag_ptr(this_ptr);
27495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27497         this_ptr_conv.is_owned = false;
27498         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27499 }
27500
27501 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
27502         LDKCounterpartyForwardingInfo this_ptr_conv;
27503         this_ptr_conv.inner = untag_ptr(this_ptr);
27504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27506         this_ptr_conv.is_owned = false;
27507         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27508         return ret_conv;
27509 }
27510
27511 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
27512         LDKCounterpartyForwardingInfo this_ptr_conv;
27513         this_ptr_conv.inner = untag_ptr(this_ptr);
27514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27516         this_ptr_conv.is_owned = false;
27517         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27518 }
27519
27520 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) {
27521         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27522         uint64_t ret_ref = 0;
27523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27525         return ret_ref;
27526 }
27527
27528 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27529         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27530         uint64_t ret_ref = 0;
27531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27533         return ret_ref;
27534 }
27535 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
27536         LDKCounterpartyForwardingInfo arg_conv;
27537         arg_conv.inner = untag_ptr(arg);
27538         arg_conv.is_owned = ptr_is_owned(arg);
27539         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27540         arg_conv.is_owned = false;
27541         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27542         return ret_conv;
27543 }
27544
27545 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
27546         LDKCounterpartyForwardingInfo orig_conv;
27547         orig_conv.inner = untag_ptr(orig);
27548         orig_conv.is_owned = ptr_is_owned(orig);
27549         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27550         orig_conv.is_owned = false;
27551         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27552         uint64_t ret_ref = 0;
27553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27555         return ret_ref;
27556 }
27557
27558 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
27559         LDKChannelCounterparty this_obj_conv;
27560         this_obj_conv.inner = untag_ptr(this_obj);
27561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27563         ChannelCounterparty_free(this_obj_conv);
27564 }
27565
27566 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
27567         LDKChannelCounterparty this_ptr_conv;
27568         this_ptr_conv.inner = untag_ptr(this_ptr);
27569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27571         this_ptr_conv.is_owned = false;
27572         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27573         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
27574         return ret_arr;
27575 }
27576
27577 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
27578         LDKChannelCounterparty this_ptr_conv;
27579         this_ptr_conv.inner = untag_ptr(this_ptr);
27580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27582         this_ptr_conv.is_owned = false;
27583         LDKPublicKey val_ref;
27584         CHECK(val->arr_len == 33);
27585         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27586         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27587 }
27588
27589 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
27590         LDKChannelCounterparty this_ptr_conv;
27591         this_ptr_conv.inner = untag_ptr(this_ptr);
27592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27594         this_ptr_conv.is_owned = false;
27595         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27596         uint64_t ret_ref = 0;
27597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27599         return ret_ref;
27600 }
27601
27602 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
27603         LDKChannelCounterparty this_ptr_conv;
27604         this_ptr_conv.inner = untag_ptr(this_ptr);
27605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27607         this_ptr_conv.is_owned = false;
27608         LDKInitFeatures val_conv;
27609         val_conv.inner = untag_ptr(val);
27610         val_conv.is_owned = ptr_is_owned(val);
27611         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27612         val_conv = InitFeatures_clone(&val_conv);
27613         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27614 }
27615
27616 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27617         LDKChannelCounterparty this_ptr_conv;
27618         this_ptr_conv.inner = untag_ptr(this_ptr);
27619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27621         this_ptr_conv.is_owned = false;
27622         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27623         return ret_conv;
27624 }
27625
27626 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
27627         LDKChannelCounterparty this_ptr_conv;
27628         this_ptr_conv.inner = untag_ptr(this_ptr);
27629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27631         this_ptr_conv.is_owned = false;
27632         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27633 }
27634
27635 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
27636         LDKChannelCounterparty this_ptr_conv;
27637         this_ptr_conv.inner = untag_ptr(this_ptr);
27638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27640         this_ptr_conv.is_owned = false;
27641         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27642         uint64_t ret_ref = 0;
27643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27645         return ret_ref;
27646 }
27647
27648 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
27649         LDKChannelCounterparty this_ptr_conv;
27650         this_ptr_conv.inner = untag_ptr(this_ptr);
27651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27653         this_ptr_conv.is_owned = false;
27654         LDKCounterpartyForwardingInfo val_conv;
27655         val_conv.inner = untag_ptr(val);
27656         val_conv.is_owned = ptr_is_owned(val);
27657         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27658         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27659         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27660 }
27661
27662 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
27663         LDKChannelCounterparty this_ptr_conv;
27664         this_ptr_conv.inner = untag_ptr(this_ptr);
27665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27667         this_ptr_conv.is_owned = false;
27668         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27669         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
27670         uint64_t ret_ref = tag_ptr(ret_copy, true);
27671         return ret_ref;
27672 }
27673
27674 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) {
27675         LDKChannelCounterparty this_ptr_conv;
27676         this_ptr_conv.inner = untag_ptr(this_ptr);
27677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27679         this_ptr_conv.is_owned = false;
27680         void* val_ptr = untag_ptr(val);
27681         CHECK_ACCESS(val_ptr);
27682         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27683         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27684         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27685 }
27686
27687 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
27688         LDKChannelCounterparty this_ptr_conv;
27689         this_ptr_conv.inner = untag_ptr(this_ptr);
27690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27692         this_ptr_conv.is_owned = false;
27693         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27694         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
27695         uint64_t ret_ref = tag_ptr(ret_copy, true);
27696         return ret_ref;
27697 }
27698
27699 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) {
27700         LDKChannelCounterparty this_ptr_conv;
27701         this_ptr_conv.inner = untag_ptr(this_ptr);
27702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27704         this_ptr_conv.is_owned = false;
27705         void* val_ptr = untag_ptr(val);
27706         CHECK_ACCESS(val_ptr);
27707         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27708         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27709         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27710 }
27711
27712 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) {
27713         LDKPublicKey node_id_arg_ref;
27714         CHECK(node_id_arg->arr_len == 33);
27715         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
27716         LDKInitFeatures features_arg_conv;
27717         features_arg_conv.inner = untag_ptr(features_arg);
27718         features_arg_conv.is_owned = ptr_is_owned(features_arg);
27719         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27720         features_arg_conv = InitFeatures_clone(&features_arg_conv);
27721         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27722         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
27723         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
27724         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27725         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27726         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
27727         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
27728         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
27729         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
27730         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
27731         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
27732         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
27733         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
27734         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);
27735         uint64_t ret_ref = 0;
27736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27738         return ret_ref;
27739 }
27740
27741 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27742         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
27743         uint64_t ret_ref = 0;
27744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27746         return ret_ref;
27747 }
27748 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
27749         LDKChannelCounterparty arg_conv;
27750         arg_conv.inner = untag_ptr(arg);
27751         arg_conv.is_owned = ptr_is_owned(arg);
27752         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27753         arg_conv.is_owned = false;
27754         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
27755         return ret_conv;
27756 }
27757
27758 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
27759         LDKChannelCounterparty orig_conv;
27760         orig_conv.inner = untag_ptr(orig);
27761         orig_conv.is_owned = ptr_is_owned(orig);
27762         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27763         orig_conv.is_owned = false;
27764         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27765         uint64_t ret_ref = 0;
27766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27768         return ret_ref;
27769 }
27770
27771 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
27772         LDKChannelDetails this_obj_conv;
27773         this_obj_conv.inner = untag_ptr(this_obj);
27774         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27776         ChannelDetails_free(this_obj_conv);
27777 }
27778
27779 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
27780         LDKChannelDetails this_ptr_conv;
27781         this_ptr_conv.inner = untag_ptr(this_ptr);
27782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27784         this_ptr_conv.is_owned = false;
27785         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27786         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
27787         return ret_arr;
27788 }
27789
27790 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27791         LDKChannelDetails this_ptr_conv;
27792         this_ptr_conv.inner = untag_ptr(this_ptr);
27793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27795         this_ptr_conv.is_owned = false;
27796         LDKThirtyTwoBytes val_ref;
27797         CHECK(val->arr_len == 32);
27798         memcpy(val_ref.data, val->elems, 32); FREE(val);
27799         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27800 }
27801
27802 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
27803         LDKChannelDetails this_ptr_conv;
27804         this_ptr_conv.inner = untag_ptr(this_ptr);
27805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27807         this_ptr_conv.is_owned = false;
27808         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27809         uint64_t ret_ref = 0;
27810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27812         return ret_ref;
27813 }
27814
27815 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
27816         LDKChannelDetails this_ptr_conv;
27817         this_ptr_conv.inner = untag_ptr(this_ptr);
27818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27820         this_ptr_conv.is_owned = false;
27821         LDKChannelCounterparty val_conv;
27822         val_conv.inner = untag_ptr(val);
27823         val_conv.is_owned = ptr_is_owned(val);
27824         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27825         val_conv = ChannelCounterparty_clone(&val_conv);
27826         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27827 }
27828
27829 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
27830         LDKChannelDetails this_ptr_conv;
27831         this_ptr_conv.inner = untag_ptr(this_ptr);
27832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27834         this_ptr_conv.is_owned = false;
27835         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27836         uint64_t ret_ref = 0;
27837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27839         return ret_ref;
27840 }
27841
27842 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
27843         LDKChannelDetails this_ptr_conv;
27844         this_ptr_conv.inner = untag_ptr(this_ptr);
27845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27847         this_ptr_conv.is_owned = false;
27848         LDKOutPoint val_conv;
27849         val_conv.inner = untag_ptr(val);
27850         val_conv.is_owned = ptr_is_owned(val);
27851         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27852         val_conv = OutPoint_clone(&val_conv);
27853         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27854 }
27855
27856 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
27857         LDKChannelDetails this_ptr_conv;
27858         this_ptr_conv.inner = untag_ptr(this_ptr);
27859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27861         this_ptr_conv.is_owned = false;
27862         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
27863         uint64_t ret_ref = 0;
27864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27866         return ret_ref;
27867 }
27868
27869 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
27870         LDKChannelDetails this_ptr_conv;
27871         this_ptr_conv.inner = untag_ptr(this_ptr);
27872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27874         this_ptr_conv.is_owned = false;
27875         LDKChannelTypeFeatures val_conv;
27876         val_conv.inner = untag_ptr(val);
27877         val_conv.is_owned = ptr_is_owned(val);
27878         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27879         val_conv = ChannelTypeFeatures_clone(&val_conv);
27880         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
27881 }
27882
27883 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
27884         LDKChannelDetails this_ptr_conv;
27885         this_ptr_conv.inner = untag_ptr(this_ptr);
27886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27888         this_ptr_conv.is_owned = false;
27889         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27890         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
27891         uint64_t ret_ref = tag_ptr(ret_copy, true);
27892         return ret_ref;
27893 }
27894
27895 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
27896         LDKChannelDetails this_ptr_conv;
27897         this_ptr_conv.inner = untag_ptr(this_ptr);
27898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27900         this_ptr_conv.is_owned = false;
27901         void* val_ptr = untag_ptr(val);
27902         CHECK_ACCESS(val_ptr);
27903         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27904         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27905         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
27906 }
27907
27908 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
27909         LDKChannelDetails this_ptr_conv;
27910         this_ptr_conv.inner = untag_ptr(this_ptr);
27911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27913         this_ptr_conv.is_owned = false;
27914         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27915         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
27916         uint64_t ret_ref = tag_ptr(ret_copy, true);
27917         return ret_ref;
27918 }
27919
27920 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27921         LDKChannelDetails this_ptr_conv;
27922         this_ptr_conv.inner = untag_ptr(this_ptr);
27923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27925         this_ptr_conv.is_owned = false;
27926         void* val_ptr = untag_ptr(val);
27927         CHECK_ACCESS(val_ptr);
27928         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27929         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27930         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
27931 }
27932
27933 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
27934         LDKChannelDetails this_ptr_conv;
27935         this_ptr_conv.inner = untag_ptr(this_ptr);
27936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27938         this_ptr_conv.is_owned = false;
27939         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27940         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
27941         uint64_t ret_ref = tag_ptr(ret_copy, true);
27942         return ret_ref;
27943 }
27944
27945 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27946         LDKChannelDetails this_ptr_conv;
27947         this_ptr_conv.inner = untag_ptr(this_ptr);
27948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27950         this_ptr_conv.is_owned = false;
27951         void* val_ptr = untag_ptr(val);
27952         CHECK_ACCESS(val_ptr);
27953         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27954         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27955         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
27956 }
27957
27958 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
27959         LDKChannelDetails this_ptr_conv;
27960         this_ptr_conv.inner = untag_ptr(this_ptr);
27961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27963         this_ptr_conv.is_owned = false;
27964         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
27965         return ret_conv;
27966 }
27967
27968 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
27969         LDKChannelDetails this_ptr_conv;
27970         this_ptr_conv.inner = untag_ptr(this_ptr);
27971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27973         this_ptr_conv.is_owned = false;
27974         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
27975 }
27976
27977 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27978         LDKChannelDetails this_ptr_conv;
27979         this_ptr_conv.inner = untag_ptr(this_ptr);
27980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27982         this_ptr_conv.is_owned = false;
27983         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27984         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
27985         uint64_t ret_ref = tag_ptr(ret_copy, true);
27986         return ret_ref;
27987 }
27988
27989 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
27990         LDKChannelDetails this_ptr_conv;
27991         this_ptr_conv.inner = untag_ptr(this_ptr);
27992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27994         this_ptr_conv.is_owned = false;
27995         void* val_ptr = untag_ptr(val);
27996         CHECK_ACCESS(val_ptr);
27997         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27998         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27999         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
28000 }
28001
28002 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
28003         LDKChannelDetails this_ptr_conv;
28004         this_ptr_conv.inner = untag_ptr(this_ptr);
28005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28007         this_ptr_conv.is_owned = false;
28008         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
28009         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
28010         return ret_arr;
28011 }
28012
28013 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
28014         LDKChannelDetails this_ptr_conv;
28015         this_ptr_conv.inner = untag_ptr(this_ptr);
28016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28018         this_ptr_conv.is_owned = false;
28019         LDKU128 val_ref;
28020         CHECK(val->arr_len == 16);
28021         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
28022         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
28023 }
28024
28025 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) {
28026         LDKChannelDetails this_ptr_conv;
28027         this_ptr_conv.inner = untag_ptr(this_ptr);
28028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28030         this_ptr_conv.is_owned = false;
28031         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28032         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
28033         uint64_t ret_ref = tag_ptr(ret_copy, true);
28034         return ret_ref;
28035 }
28036
28037 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) {
28038         LDKChannelDetails this_ptr_conv;
28039         this_ptr_conv.inner = untag_ptr(this_ptr);
28040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28042         this_ptr_conv.is_owned = false;
28043         void* val_ptr = untag_ptr(val);
28044         CHECK_ACCESS(val_ptr);
28045         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28046         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28047         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
28048 }
28049
28050 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
28051         LDKChannelDetails this_ptr_conv;
28052         this_ptr_conv.inner = untag_ptr(this_ptr);
28053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28055         this_ptr_conv.is_owned = false;
28056         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28057         return ret_conv;
28058 }
28059
28060 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
28061         LDKChannelDetails this_ptr_conv;
28062         this_ptr_conv.inner = untag_ptr(this_ptr);
28063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28065         this_ptr_conv.is_owned = false;
28066         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28067 }
28068
28069 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
28070         LDKChannelDetails this_ptr_conv;
28071         this_ptr_conv.inner = untag_ptr(this_ptr);
28072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28074         this_ptr_conv.is_owned = false;
28075         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28076         return ret_conv;
28077 }
28078
28079 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28080         LDKChannelDetails this_ptr_conv;
28081         this_ptr_conv.inner = untag_ptr(this_ptr);
28082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28084         this_ptr_conv.is_owned = false;
28085         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28086 }
28087
28088 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) {
28089         LDKChannelDetails this_ptr_conv;
28090         this_ptr_conv.inner = untag_ptr(this_ptr);
28091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28093         this_ptr_conv.is_owned = false;
28094         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
28095         return ret_conv;
28096 }
28097
28098 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) {
28099         LDKChannelDetails this_ptr_conv;
28100         this_ptr_conv.inner = untag_ptr(this_ptr);
28101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28103         this_ptr_conv.is_owned = false;
28104         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
28105 }
28106
28107 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
28108         LDKChannelDetails this_ptr_conv;
28109         this_ptr_conv.inner = untag_ptr(this_ptr);
28110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28112         this_ptr_conv.is_owned = false;
28113         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28114         return ret_conv;
28115 }
28116
28117 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28118         LDKChannelDetails this_ptr_conv;
28119         this_ptr_conv.inner = untag_ptr(this_ptr);
28120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28122         this_ptr_conv.is_owned = false;
28123         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28124 }
28125
28126 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
28127         LDKChannelDetails this_ptr_conv;
28128         this_ptr_conv.inner = untag_ptr(this_ptr);
28129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28131         this_ptr_conv.is_owned = false;
28132         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28133         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28134         uint64_t ret_ref = tag_ptr(ret_copy, true);
28135         return ret_ref;
28136 }
28137
28138 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
28139         LDKChannelDetails this_ptr_conv;
28140         this_ptr_conv.inner = untag_ptr(this_ptr);
28141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28143         this_ptr_conv.is_owned = false;
28144         void* val_ptr = untag_ptr(val);
28145         CHECK_ACCESS(val_ptr);
28146         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28147         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28148         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28149 }
28150
28151 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
28152         LDKChannelDetails this_ptr_conv;
28153         this_ptr_conv.inner = untag_ptr(this_ptr);
28154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28156         this_ptr_conv.is_owned = false;
28157         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28158         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
28159         uint64_t ret_ref = tag_ptr(ret_copy, true);
28160         return ret_ref;
28161 }
28162
28163 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
28164         LDKChannelDetails this_ptr_conv;
28165         this_ptr_conv.inner = untag_ptr(this_ptr);
28166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28168         this_ptr_conv.is_owned = false;
28169         void* val_ptr = untag_ptr(val);
28170         CHECK_ACCESS(val_ptr);
28171         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28172         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28173         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
28174 }
28175
28176 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
28177         LDKChannelDetails this_ptr_conv;
28178         this_ptr_conv.inner = untag_ptr(this_ptr);
28179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28181         this_ptr_conv.is_owned = false;
28182         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28183         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28184         uint64_t ret_ref = tag_ptr(ret_copy, true);
28185         return ret_ref;
28186 }
28187
28188 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) {
28189         LDKChannelDetails this_ptr_conv;
28190         this_ptr_conv.inner = untag_ptr(this_ptr);
28191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28193         this_ptr_conv.is_owned = false;
28194         void* val_ptr = untag_ptr(val);
28195         CHECK_ACCESS(val_ptr);
28196         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28197         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
28198         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28199 }
28200
28201 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
28202         LDKChannelDetails this_ptr_conv;
28203         this_ptr_conv.inner = untag_ptr(this_ptr);
28204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28206         this_ptr_conv.is_owned = false;
28207         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28208         return ret_conv;
28209 }
28210
28211 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
28212         LDKChannelDetails this_ptr_conv;
28213         this_ptr_conv.inner = untag_ptr(this_ptr);
28214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28216         this_ptr_conv.is_owned = false;
28217         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28218 }
28219
28220 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
28221         LDKChannelDetails this_ptr_conv;
28222         this_ptr_conv.inner = untag_ptr(this_ptr);
28223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28225         this_ptr_conv.is_owned = false;
28226         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
28227         return ret_conv;
28228 }
28229
28230 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
28231         LDKChannelDetails this_ptr_conv;
28232         this_ptr_conv.inner = untag_ptr(this_ptr);
28233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28235         this_ptr_conv.is_owned = false;
28236         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
28237 }
28238
28239 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
28240         LDKChannelDetails this_ptr_conv;
28241         this_ptr_conv.inner = untag_ptr(this_ptr);
28242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28244         this_ptr_conv.is_owned = false;
28245         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28246         return ret_conv;
28247 }
28248
28249 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
28250         LDKChannelDetails this_ptr_conv;
28251         this_ptr_conv.inner = untag_ptr(this_ptr);
28252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28254         this_ptr_conv.is_owned = false;
28255         ChannelDetails_set_is_usable(&this_ptr_conv, val);
28256 }
28257
28258 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
28259         LDKChannelDetails this_ptr_conv;
28260         this_ptr_conv.inner = untag_ptr(this_ptr);
28261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28263         this_ptr_conv.is_owned = false;
28264         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
28265         return ret_conv;
28266 }
28267
28268 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
28269         LDKChannelDetails this_ptr_conv;
28270         this_ptr_conv.inner = untag_ptr(this_ptr);
28271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28273         this_ptr_conv.is_owned = false;
28274         ChannelDetails_set_is_public(&this_ptr_conv, val);
28275 }
28276
28277 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
28278         LDKChannelDetails this_ptr_conv;
28279         this_ptr_conv.inner = untag_ptr(this_ptr);
28280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28282         this_ptr_conv.is_owned = false;
28283         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28284         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
28285         uint64_t ret_ref = tag_ptr(ret_copy, true);
28286         return ret_ref;
28287 }
28288
28289 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) {
28290         LDKChannelDetails this_ptr_conv;
28291         this_ptr_conv.inner = untag_ptr(this_ptr);
28292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28294         this_ptr_conv.is_owned = false;
28295         void* val_ptr = untag_ptr(val);
28296         CHECK_ACCESS(val_ptr);
28297         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28298         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28299         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28300 }
28301
28302 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
28303         LDKChannelDetails this_ptr_conv;
28304         this_ptr_conv.inner = untag_ptr(this_ptr);
28305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28307         this_ptr_conv.is_owned = false;
28308         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28309         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
28310         uint64_t ret_ref = tag_ptr(ret_copy, true);
28311         return ret_ref;
28312 }
28313
28314 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) {
28315         LDKChannelDetails this_ptr_conv;
28316         this_ptr_conv.inner = untag_ptr(this_ptr);
28317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28319         this_ptr_conv.is_owned = false;
28320         void* val_ptr = untag_ptr(val);
28321         CHECK_ACCESS(val_ptr);
28322         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28323         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28324         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28325 }
28326
28327 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
28328         LDKChannelDetails this_ptr_conv;
28329         this_ptr_conv.inner = untag_ptr(this_ptr);
28330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28332         this_ptr_conv.is_owned = false;
28333         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
28334         uint64_t ret_ref = 0;
28335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28337         return ret_ref;
28338 }
28339
28340 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
28341         LDKChannelDetails this_ptr_conv;
28342         this_ptr_conv.inner = untag_ptr(this_ptr);
28343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28345         this_ptr_conv.is_owned = false;
28346         LDKChannelConfig val_conv;
28347         val_conv.inner = untag_ptr(val);
28348         val_conv.is_owned = ptr_is_owned(val);
28349         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28350         val_conv = ChannelConfig_clone(&val_conv);
28351         ChannelDetails_set_config(&this_ptr_conv, val_conv);
28352 }
28353
28354 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) {
28355         LDKThirtyTwoBytes channel_id_arg_ref;
28356         CHECK(channel_id_arg->arr_len == 32);
28357         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28358         LDKChannelCounterparty counterparty_arg_conv;
28359         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
28360         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
28361         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28362         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28363         LDKOutPoint funding_txo_arg_conv;
28364         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
28365         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
28366         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28367         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28368         LDKChannelTypeFeatures channel_type_arg_conv;
28369         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
28370         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
28371         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
28372         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
28373         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
28374         CHECK_ACCESS(short_channel_id_arg_ptr);
28375         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28376         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
28377         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
28378         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
28379         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
28380         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
28381         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
28382         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
28383         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
28384         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
28385         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
28386         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28387         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28388         LDKU128 user_channel_id_arg_ref;
28389         CHECK(user_channel_id_arg->arr_len == 16);
28390         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
28391         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
28392         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
28393         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
28394         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
28395         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
28396         CHECK_ACCESS(confirmations_required_arg_ptr);
28397         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28398         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
28399         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
28400         CHECK_ACCESS(confirmations_arg_ptr);
28401         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
28402         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
28403         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
28404         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28405         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28406         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
28407         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
28408         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
28409         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
28410         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
28411         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
28412         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
28413         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
28414         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
28415         LDKChannelConfig config_arg_conv;
28416         config_arg_conv.inner = untag_ptr(config_arg);
28417         config_arg_conv.is_owned = ptr_is_owned(config_arg);
28418         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
28419         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
28420         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);
28421         uint64_t ret_ref = 0;
28422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28424         return ret_ref;
28425 }
28426
28427 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28428         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28429         uint64_t ret_ref = 0;
28430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28432         return ret_ref;
28433 }
28434 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
28435         LDKChannelDetails arg_conv;
28436         arg_conv.inner = untag_ptr(arg);
28437         arg_conv.is_owned = ptr_is_owned(arg);
28438         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28439         arg_conv.is_owned = false;
28440         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28441         return ret_conv;
28442 }
28443
28444 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
28445         LDKChannelDetails orig_conv;
28446         orig_conv.inner = untag_ptr(orig);
28447         orig_conv.is_owned = ptr_is_owned(orig);
28448         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28449         orig_conv.is_owned = false;
28450         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28451         uint64_t ret_ref = 0;
28452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28454         return ret_ref;
28455 }
28456
28457 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
28458         LDKChannelDetails this_arg_conv;
28459         this_arg_conv.inner = untag_ptr(this_arg);
28460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28462         this_arg_conv.is_owned = false;
28463         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28464         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28465         uint64_t ret_ref = tag_ptr(ret_copy, true);
28466         return ret_ref;
28467 }
28468
28469 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
28470         LDKChannelDetails this_arg_conv;
28471         this_arg_conv.inner = untag_ptr(this_arg);
28472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28474         this_arg_conv.is_owned = false;
28475         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28476         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
28477         uint64_t ret_ref = tag_ptr(ret_copy, true);
28478         return ret_ref;
28479 }
28480
28481 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
28482         if (!ptr_is_owned(this_ptr)) return;
28483         void* this_ptr_ptr = untag_ptr(this_ptr);
28484         CHECK_ACCESS(this_ptr_ptr);
28485         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
28486         FREE(untag_ptr(this_ptr));
28487         RecentPaymentDetails_free(this_ptr_conv);
28488 }
28489
28490 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
28491         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28492         *ret_copy = RecentPaymentDetails_clone(arg);
28493         uint64_t ret_ref = tag_ptr(ret_copy, true);
28494         return ret_ref;
28495 }
28496 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
28497         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
28498         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
28499         return ret_conv;
28500 }
28501
28502 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
28503         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
28504         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28505         *ret_copy = RecentPaymentDetails_clone(orig_conv);
28506         uint64_t ret_ref = tag_ptr(ret_copy, true);
28507         return ret_ref;
28508 }
28509
28510 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_hash, int64_t total_msat) {
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_pending(payment_hash_ref, total_msat);
28516         uint64_t ret_ref = tag_ptr(ret_copy, true);
28517         return ret_ref;
28518 }
28519
28520 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_hash) {
28521         LDKThirtyTwoBytes payment_hash_ref;
28522         CHECK(payment_hash->arr_len == 32);
28523         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28524         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28525         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref);
28526         uint64_t ret_ref = tag_ptr(ret_copy, true);
28527         return ret_ref;
28528 }
28529
28530 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_hash) {
28531         LDKThirtyTwoBytes payment_hash_ref;
28532         CHECK(payment_hash->arr_len == 32);
28533         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28534         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28535         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
28536         uint64_t ret_ref = tag_ptr(ret_copy, true);
28537         return ret_ref;
28538 }
28539
28540 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
28541         LDKPhantomRouteHints this_obj_conv;
28542         this_obj_conv.inner = untag_ptr(this_obj);
28543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28545         PhantomRouteHints_free(this_obj_conv);
28546 }
28547
28548 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
28549         LDKPhantomRouteHints this_ptr_conv;
28550         this_ptr_conv.inner = untag_ptr(this_ptr);
28551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28553         this_ptr_conv.is_owned = false;
28554         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28555         uint64_tArray ret_arr = NULL;
28556         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28557         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28558         for (size_t q = 0; q < ret_var.datalen; q++) {
28559                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28560                 uint64_t ret_conv_16_ref = 0;
28561                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28562                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28563                 ret_arr_ptr[q] = ret_conv_16_ref;
28564         }
28565         
28566         FREE(ret_var.data);
28567         return ret_arr;
28568 }
28569
28570 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
28571         LDKPhantomRouteHints this_ptr_conv;
28572         this_ptr_conv.inner = untag_ptr(this_ptr);
28573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28575         this_ptr_conv.is_owned = false;
28576         LDKCVec_ChannelDetailsZ val_constr;
28577         val_constr.datalen = val->arr_len;
28578         if (val_constr.datalen > 0)
28579                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28580         else
28581                 val_constr.data = NULL;
28582         uint64_t* val_vals = val->elems;
28583         for (size_t q = 0; q < val_constr.datalen; q++) {
28584                 uint64_t val_conv_16 = val_vals[q];
28585                 LDKChannelDetails val_conv_16_conv;
28586                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
28587                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
28588                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28589                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28590                 val_constr.data[q] = val_conv_16_conv;
28591         }
28592         FREE(val);
28593         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28594 }
28595
28596 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
28597         LDKPhantomRouteHints this_ptr_conv;
28598         this_ptr_conv.inner = untag_ptr(this_ptr);
28599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28601         this_ptr_conv.is_owned = false;
28602         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28603         return ret_conv;
28604 }
28605
28606 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t 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         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28613 }
28614
28615 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
28616         LDKPhantomRouteHints this_ptr_conv;
28617         this_ptr_conv.inner = untag_ptr(this_ptr);
28618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28620         this_ptr_conv.is_owned = false;
28621         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28622         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
28623         return ret_arr;
28624 }
28625
28626 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
28627         LDKPhantomRouteHints this_ptr_conv;
28628         this_ptr_conv.inner = untag_ptr(this_ptr);
28629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28631         this_ptr_conv.is_owned = false;
28632         LDKPublicKey val_ref;
28633         CHECK(val->arr_len == 33);
28634         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28635         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28636 }
28637
28638 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) {
28639         LDKCVec_ChannelDetailsZ channels_arg_constr;
28640         channels_arg_constr.datalen = channels_arg->arr_len;
28641         if (channels_arg_constr.datalen > 0)
28642                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28643         else
28644                 channels_arg_constr.data = NULL;
28645         uint64_t* channels_arg_vals = channels_arg->elems;
28646         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28647                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
28648                 LDKChannelDetails channels_arg_conv_16_conv;
28649                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
28650                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
28651                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28652                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28653                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28654         }
28655         FREE(channels_arg);
28656         LDKPublicKey real_node_pubkey_arg_ref;
28657         CHECK(real_node_pubkey_arg->arr_len == 33);
28658         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
28659         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28660         uint64_t ret_ref = 0;
28661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28663         return ret_ref;
28664 }
28665
28666 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28667         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28668         uint64_t ret_ref = 0;
28669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28671         return ret_ref;
28672 }
28673 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
28674         LDKPhantomRouteHints arg_conv;
28675         arg_conv.inner = untag_ptr(arg);
28676         arg_conv.is_owned = ptr_is_owned(arg);
28677         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28678         arg_conv.is_owned = false;
28679         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
28680         return ret_conv;
28681 }
28682
28683 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
28684         LDKPhantomRouteHints orig_conv;
28685         orig_conv.inner = untag_ptr(orig);
28686         orig_conv.is_owned = ptr_is_owned(orig);
28687         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28688         orig_conv.is_owned = false;
28689         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28690         uint64_t ret_ref = 0;
28691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28693         return ret_ref;
28694 }
28695
28696 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) {
28697         void* fee_est_ptr = untag_ptr(fee_est);
28698         CHECK_ACCESS(fee_est_ptr);
28699         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28700         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28701                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28702                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28703         }
28704         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28705         CHECK_ACCESS(chain_monitor_ptr);
28706         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28707         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28708                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28709                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28710         }
28711         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28712         CHECK_ACCESS(tx_broadcaster_ptr);
28713         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28714         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28715                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28716                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28717         }
28718         void* router_ptr = untag_ptr(router);
28719         CHECK_ACCESS(router_ptr);
28720         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
28721         if (router_conv.free == LDKRouter_JCalls_free) {
28722                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28723                 LDKRouter_JCalls_cloned(&router_conv);
28724         }
28725         void* logger_ptr = untag_ptr(logger);
28726         CHECK_ACCESS(logger_ptr);
28727         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28728         if (logger_conv.free == LDKLogger_JCalls_free) {
28729                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28730                 LDKLogger_JCalls_cloned(&logger_conv);
28731         }
28732         void* entropy_source_ptr = untag_ptr(entropy_source);
28733         CHECK_ACCESS(entropy_source_ptr);
28734         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
28735         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
28736                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28737                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
28738         }
28739         void* node_signer_ptr = untag_ptr(node_signer);
28740         CHECK_ACCESS(node_signer_ptr);
28741         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
28742         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
28743                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28744                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
28745         }
28746         void* signer_provider_ptr = untag_ptr(signer_provider);
28747         CHECK_ACCESS(signer_provider_ptr);
28748         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
28749         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
28750                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28751                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
28752         }
28753         LDKUserConfig config_conv;
28754         config_conv.inner = untag_ptr(config);
28755         config_conv.is_owned = ptr_is_owned(config);
28756         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28757         config_conv = UserConfig_clone(&config_conv);
28758         LDKChainParameters params_conv;
28759         params_conv.inner = untag_ptr(params);
28760         params_conv.is_owned = ptr_is_owned(params);
28761         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28762         params_conv = ChainParameters_clone(&params_conv);
28763         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);
28764         uint64_t ret_ref = 0;
28765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28767         return ret_ref;
28768 }
28769
28770 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
28771         LDKChannelManager this_arg_conv;
28772         this_arg_conv.inner = untag_ptr(this_arg);
28773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28775         this_arg_conv.is_owned = false;
28776         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28777         uint64_t ret_ref = 0;
28778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28780         return ret_ref;
28781 }
28782
28783 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) {
28784         LDKChannelManager this_arg_conv;
28785         this_arg_conv.inner = untag_ptr(this_arg);
28786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28788         this_arg_conv.is_owned = false;
28789         LDKPublicKey their_network_key_ref;
28790         CHECK(their_network_key->arr_len == 33);
28791         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
28792         LDKU128 user_channel_id_ref;
28793         CHECK(user_channel_id->arr_len == 16);
28794         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28795         LDKUserConfig override_config_conv;
28796         override_config_conv.inner = untag_ptr(override_config);
28797         override_config_conv.is_owned = ptr_is_owned(override_config);
28798         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28799         override_config_conv = UserConfig_clone(&override_config_conv);
28800         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28801         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
28802         return tag_ptr(ret_conv, true);
28803 }
28804
28805 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
28806         LDKChannelManager this_arg_conv;
28807         this_arg_conv.inner = untag_ptr(this_arg);
28808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28810         this_arg_conv.is_owned = false;
28811         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28812         uint64_tArray ret_arr = NULL;
28813         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28814         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28815         for (size_t q = 0; q < ret_var.datalen; q++) {
28816                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28817                 uint64_t ret_conv_16_ref = 0;
28818                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28819                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28820                 ret_arr_ptr[q] = ret_conv_16_ref;
28821         }
28822         
28823         FREE(ret_var.data);
28824         return ret_arr;
28825 }
28826
28827 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
28828         LDKChannelManager this_arg_conv;
28829         this_arg_conv.inner = untag_ptr(this_arg);
28830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28832         this_arg_conv.is_owned = false;
28833         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28834         uint64_tArray ret_arr = NULL;
28835         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28836         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28837         for (size_t q = 0; q < ret_var.datalen; q++) {
28838                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28839                 uint64_t ret_conv_16_ref = 0;
28840                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28841                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28842                 ret_arr_ptr[q] = ret_conv_16_ref;
28843         }
28844         
28845         FREE(ret_var.data);
28846         return ret_arr;
28847 }
28848
28849 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) {
28850         LDKChannelManager this_arg_conv;
28851         this_arg_conv.inner = untag_ptr(this_arg);
28852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28854         this_arg_conv.is_owned = false;
28855         LDKPublicKey counterparty_node_id_ref;
28856         CHECK(counterparty_node_id->arr_len == 33);
28857         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28858         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
28859         uint64_tArray ret_arr = NULL;
28860         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28861         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28862         for (size_t q = 0; q < ret_var.datalen; q++) {
28863                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28864                 uint64_t ret_conv_16_ref = 0;
28865                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28866                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28867                 ret_arr_ptr[q] = ret_conv_16_ref;
28868         }
28869         
28870         FREE(ret_var.data);
28871         return ret_arr;
28872 }
28873
28874 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
28875         LDKChannelManager this_arg_conv;
28876         this_arg_conv.inner = untag_ptr(this_arg);
28877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28879         this_arg_conv.is_owned = false;
28880         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
28881         uint64_tArray ret_arr = NULL;
28882         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28883         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28884         for (size_t w = 0; w < ret_var.datalen; w++) {
28885                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28886                 *ret_conv_22_copy = ret_var.data[w];
28887                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
28888                 ret_arr_ptr[w] = ret_conv_22_ref;
28889         }
28890         
28891         FREE(ret_var.data);
28892         return ret_arr;
28893 }
28894
28895 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) {
28896         LDKChannelManager this_arg_conv;
28897         this_arg_conv.inner = untag_ptr(this_arg);
28898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28900         this_arg_conv.is_owned = false;
28901         uint8_t channel_id_arr[32];
28902         CHECK(channel_id->arr_len == 32);
28903         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28904         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28905         LDKPublicKey counterparty_node_id_ref;
28906         CHECK(counterparty_node_id->arr_len == 33);
28907         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28908         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28909         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28910         return tag_ptr(ret_conv, true);
28911 }
28912
28913 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) {
28914         LDKChannelManager this_arg_conv;
28915         this_arg_conv.inner = untag_ptr(this_arg);
28916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28918         this_arg_conv.is_owned = false;
28919         uint8_t channel_id_arr[32];
28920         CHECK(channel_id->arr_len == 32);
28921         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28922         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28923         LDKPublicKey counterparty_node_id_ref;
28924         CHECK(counterparty_node_id->arr_len == 33);
28925         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28926         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28927         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
28928         return tag_ptr(ret_conv, true);
28929 }
28930
28931 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) {
28932         LDKChannelManager this_arg_conv;
28933         this_arg_conv.inner = untag_ptr(this_arg);
28934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28936         this_arg_conv.is_owned = false;
28937         uint8_t channel_id_arr[32];
28938         CHECK(channel_id->arr_len == 32);
28939         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28940         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28941         LDKPublicKey counterparty_node_id_ref;
28942         CHECK(counterparty_node_id->arr_len == 33);
28943         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28944         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28945         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28946         return tag_ptr(ret_conv, true);
28947 }
28948
28949 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) {
28950         LDKChannelManager this_arg_conv;
28951         this_arg_conv.inner = untag_ptr(this_arg);
28952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28954         this_arg_conv.is_owned = false;
28955         uint8_t channel_id_arr[32];
28956         CHECK(channel_id->arr_len == 32);
28957         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28958         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28959         LDKPublicKey counterparty_node_id_ref;
28960         CHECK(counterparty_node_id->arr_len == 33);
28961         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28962         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28963         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28964         return tag_ptr(ret_conv, true);
28965 }
28966
28967 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) {
28968         LDKChannelManager this_arg_conv;
28969         this_arg_conv.inner = untag_ptr(this_arg);
28970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28972         this_arg_conv.is_owned = false;
28973         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
28974 }
28975
28976 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) {
28977         LDKChannelManager this_arg_conv;
28978         this_arg_conv.inner = untag_ptr(this_arg);
28979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28981         this_arg_conv.is_owned = false;
28982         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
28983 }
28984
28985 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) {
28986         LDKChannelManager this_arg_conv;
28987         this_arg_conv.inner = untag_ptr(this_arg);
28988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28990         this_arg_conv.is_owned = false;
28991         LDKRoute route_conv;
28992         route_conv.inner = untag_ptr(route);
28993         route_conv.is_owned = ptr_is_owned(route);
28994         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28995         route_conv.is_owned = false;
28996         LDKThirtyTwoBytes payment_hash_ref;
28997         CHECK(payment_hash->arr_len == 32);
28998         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28999         LDKRecipientOnionFields recipient_onion_conv;
29000         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29001         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29002         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29003         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29004         LDKThirtyTwoBytes payment_id_ref;
29005         CHECK(payment_id->arr_len == 32);
29006         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29007         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29008         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
29009         return tag_ptr(ret_conv, true);
29010 }
29011
29012 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) {
29013         LDKChannelManager this_arg_conv;
29014         this_arg_conv.inner = untag_ptr(this_arg);
29015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29017         this_arg_conv.is_owned = false;
29018         LDKThirtyTwoBytes payment_hash_ref;
29019         CHECK(payment_hash->arr_len == 32);
29020         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29021         LDKRecipientOnionFields recipient_onion_conv;
29022         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29023         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29024         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29025         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29026         LDKThirtyTwoBytes payment_id_ref;
29027         CHECK(payment_id->arr_len == 32);
29028         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29029         LDKRouteParameters route_params_conv;
29030         route_params_conv.inner = untag_ptr(route_params);
29031         route_params_conv.is_owned = ptr_is_owned(route_params);
29032         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29033         route_params_conv = RouteParameters_clone(&route_params_conv);
29034         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29035         CHECK_ACCESS(retry_strategy_ptr);
29036         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29037         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29038         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29039         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
29040         return tag_ptr(ret_conv, true);
29041 }
29042
29043 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
29044         LDKChannelManager this_arg_conv;
29045         this_arg_conv.inner = untag_ptr(this_arg);
29046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29048         this_arg_conv.is_owned = false;
29049         LDKThirtyTwoBytes payment_id_ref;
29050         CHECK(payment_id->arr_len == 32);
29051         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29052         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29053 }
29054
29055 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) {
29056         LDKChannelManager this_arg_conv;
29057         this_arg_conv.inner = untag_ptr(this_arg);
29058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29060         this_arg_conv.is_owned = false;
29061         LDKRoute route_conv;
29062         route_conv.inner = untag_ptr(route);
29063         route_conv.is_owned = ptr_is_owned(route);
29064         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29065         route_conv.is_owned = false;
29066         LDKThirtyTwoBytes payment_preimage_ref;
29067         CHECK(payment_preimage->arr_len == 32);
29068         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29069         LDKRecipientOnionFields recipient_onion_conv;
29070         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29071         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29072         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29073         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29074         LDKThirtyTwoBytes payment_id_ref;
29075         CHECK(payment_id->arr_len == 32);
29076         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29077         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
29078         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, recipient_onion_conv, payment_id_ref);
29079         return tag_ptr(ret_conv, true);
29080 }
29081
29082 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) {
29083         LDKChannelManager this_arg_conv;
29084         this_arg_conv.inner = untag_ptr(this_arg);
29085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29087         this_arg_conv.is_owned = false;
29088         LDKThirtyTwoBytes payment_preimage_ref;
29089         CHECK(payment_preimage->arr_len == 32);
29090         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29091         LDKRecipientOnionFields recipient_onion_conv;
29092         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29093         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29094         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29095         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29096         LDKThirtyTwoBytes payment_id_ref;
29097         CHECK(payment_id->arr_len == 32);
29098         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29099         LDKRouteParameters route_params_conv;
29100         route_params_conv.inner = untag_ptr(route_params);
29101         route_params_conv.is_owned = ptr_is_owned(route_params);
29102         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29103         route_params_conv = RouteParameters_clone(&route_params_conv);
29104         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29105         CHECK_ACCESS(retry_strategy_ptr);
29106         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29107         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29108         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
29109         *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);
29110         return tag_ptr(ret_conv, true);
29111 }
29112
29113 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
29114         LDKChannelManager this_arg_conv;
29115         this_arg_conv.inner = untag_ptr(this_arg);
29116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29118         this_arg_conv.is_owned = false;
29119         LDKPath path_conv;
29120         path_conv.inner = untag_ptr(path);
29121         path_conv.is_owned = ptr_is_owned(path);
29122         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
29123         path_conv = Path_clone(&path_conv);
29124         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29125         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
29126         return tag_ptr(ret_conv, true);
29127 }
29128
29129 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) {
29130         LDKChannelManager this_arg_conv;
29131         this_arg_conv.inner = untag_ptr(this_arg);
29132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29134         this_arg_conv.is_owned = false;
29135         uint8_t temporary_channel_id_arr[32];
29136         CHECK(temporary_channel_id->arr_len == 32);
29137         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29138         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29139         LDKPublicKey counterparty_node_id_ref;
29140         CHECK(counterparty_node_id->arr_len == 33);
29141         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29142         LDKTransaction funding_transaction_ref;
29143         funding_transaction_ref.datalen = funding_transaction->arr_len;
29144         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29145         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
29146         funding_transaction_ref.data_is_owned = true;
29147         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29148         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
29149         return tag_ptr(ret_conv, true);
29150 }
29151
29152 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) {
29153         LDKChannelManager this_arg_conv;
29154         this_arg_conv.inner = untag_ptr(this_arg);
29155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29157         this_arg_conv.is_owned = false;
29158         LDKPublicKey counterparty_node_id_ref;
29159         CHECK(counterparty_node_id->arr_len == 33);
29160         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29161         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
29162         channel_ids_constr.datalen = channel_ids->arr_len;
29163         if (channel_ids_constr.datalen > 0)
29164                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
29165         else
29166                 channel_ids_constr.data = NULL;
29167         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
29168         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
29169                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
29170                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
29171                 CHECK(channel_ids_conv_12->arr_len == 32);
29172                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
29173                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
29174         }
29175         FREE(channel_ids);
29176         LDKChannelConfig config_conv;
29177         config_conv.inner = untag_ptr(config);
29178         config_conv.is_owned = ptr_is_owned(config);
29179         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29180         config_conv.is_owned = false;
29181         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29182         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
29183         return tag_ptr(ret_conv, true);
29184 }
29185
29186 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) {
29187         LDKChannelManager this_arg_conv;
29188         this_arg_conv.inner = untag_ptr(this_arg);
29189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29191         this_arg_conv.is_owned = false;
29192         LDKThirtyTwoBytes intercept_id_ref;
29193         CHECK(intercept_id->arr_len == 32);
29194         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29195         uint8_t next_hop_channel_id_arr[32];
29196         CHECK(next_hop_channel_id->arr_len == 32);
29197         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
29198         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
29199         LDKPublicKey next_node_id_ref;
29200         CHECK(next_node_id->arr_len == 33);
29201         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
29202         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29203         *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);
29204         return tag_ptr(ret_conv, true);
29205 }
29206
29207 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
29208         LDKChannelManager this_arg_conv;
29209         this_arg_conv.inner = untag_ptr(this_arg);
29210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29212         this_arg_conv.is_owned = false;
29213         LDKThirtyTwoBytes intercept_id_ref;
29214         CHECK(intercept_id->arr_len == 32);
29215         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29216         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29217         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
29218         return tag_ptr(ret_conv, true);
29219 }
29220
29221 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
29222         LDKChannelManager this_arg_conv;
29223         this_arg_conv.inner = untag_ptr(this_arg);
29224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29226         this_arg_conv.is_owned = false;
29227         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29228 }
29229
29230 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
29231         LDKChannelManager this_arg_conv;
29232         this_arg_conv.inner = untag_ptr(this_arg);
29233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29235         this_arg_conv.is_owned = false;
29236         ChannelManager_timer_tick_occurred(&this_arg_conv);
29237 }
29238
29239 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
29240         LDKChannelManager this_arg_conv;
29241         this_arg_conv.inner = untag_ptr(this_arg);
29242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29244         this_arg_conv.is_owned = false;
29245         uint8_t payment_hash_arr[32];
29246         CHECK(payment_hash->arr_len == 32);
29247         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29248         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29249         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29250 }
29251
29252 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) {
29253         LDKChannelManager this_arg_conv;
29254         this_arg_conv.inner = untag_ptr(this_arg);
29255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29257         this_arg_conv.is_owned = false;
29258         uint8_t payment_hash_arr[32];
29259         CHECK(payment_hash->arr_len == 32);
29260         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29261         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29262         LDKFailureCode failure_code_conv = LDKFailureCode_from_js(failure_code);
29263         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
29264 }
29265
29266 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
29267         LDKChannelManager this_arg_conv;
29268         this_arg_conv.inner = untag_ptr(this_arg);
29269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29271         this_arg_conv.is_owned = false;
29272         LDKThirtyTwoBytes payment_preimage_ref;
29273         CHECK(payment_preimage->arr_len == 32);
29274         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29275         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29276 }
29277
29278 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
29279         LDKChannelManager this_arg_conv;
29280         this_arg_conv.inner = untag_ptr(this_arg);
29281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29283         this_arg_conv.is_owned = false;
29284         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29285         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
29286         return ret_arr;
29287 }
29288
29289 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) {
29290         LDKChannelManager this_arg_conv;
29291         this_arg_conv.inner = untag_ptr(this_arg);
29292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29294         this_arg_conv.is_owned = false;
29295         uint8_t temporary_channel_id_arr[32];
29296         CHECK(temporary_channel_id->arr_len == 32);
29297         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29298         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29299         LDKPublicKey counterparty_node_id_ref;
29300         CHECK(counterparty_node_id->arr_len == 33);
29301         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29302         LDKU128 user_channel_id_ref;
29303         CHECK(user_channel_id->arr_len == 16);
29304         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29305         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29306         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
29307         return tag_ptr(ret_conv, true);
29308 }
29309
29310 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) {
29311         LDKChannelManager this_arg_conv;
29312         this_arg_conv.inner = untag_ptr(this_arg);
29313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29315         this_arg_conv.is_owned = false;
29316         uint8_t temporary_channel_id_arr[32];
29317         CHECK(temporary_channel_id->arr_len == 32);
29318         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29319         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29320         LDKPublicKey counterparty_node_id_ref;
29321         CHECK(counterparty_node_id->arr_len == 33);
29322         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29323         LDKU128 user_channel_id_ref;
29324         CHECK(user_channel_id->arr_len == 16);
29325         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29326         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29327         *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);
29328         return tag_ptr(ret_conv, true);
29329 }
29330
29331 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) {
29332         LDKChannelManager this_arg_conv;
29333         this_arg_conv.inner = untag_ptr(this_arg);
29334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29336         this_arg_conv.is_owned = false;
29337         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29338         CHECK_ACCESS(min_value_msat_ptr);
29339         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29340         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29341         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
29342         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
29343         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
29344         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
29345         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29346         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
29347         return tag_ptr(ret_conv, true);
29348 }
29349
29350 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) {
29351         LDKChannelManager this_arg_conv;
29352         this_arg_conv.inner = untag_ptr(this_arg);
29353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29355         this_arg_conv.is_owned = false;
29356         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29357         CHECK_ACCESS(min_value_msat_ptr);
29358         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29359         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29360         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
29361         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29362         return tag_ptr(ret_conv, true);
29363 }
29364
29365 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) {
29366         LDKChannelManager this_arg_conv;
29367         this_arg_conv.inner = untag_ptr(this_arg);
29368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29370         this_arg_conv.is_owned = false;
29371         LDKThirtyTwoBytes payment_hash_ref;
29372         CHECK(payment_hash->arr_len == 32);
29373         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29374         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29375         CHECK_ACCESS(min_value_msat_ptr);
29376         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29377         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29378         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
29379         CHECK_ACCESS(min_final_cltv_expiry_ptr);
29380         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
29381         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
29382         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29383         *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);
29384         return tag_ptr(ret_conv, true);
29385 }
29386
29387 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) {
29388         LDKChannelManager this_arg_conv;
29389         this_arg_conv.inner = untag_ptr(this_arg);
29390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29392         this_arg_conv.is_owned = false;
29393         LDKThirtyTwoBytes payment_hash_ref;
29394         CHECK(payment_hash->arr_len == 32);
29395         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29396         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29397         CHECK_ACCESS(min_value_msat_ptr);
29398         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29399         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29400         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
29401         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29402         return tag_ptr(ret_conv, true);
29403 }
29404
29405 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) {
29406         LDKChannelManager this_arg_conv;
29407         this_arg_conv.inner = untag_ptr(this_arg);
29408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29410         this_arg_conv.is_owned = false;
29411         LDKThirtyTwoBytes payment_hash_ref;
29412         CHECK(payment_hash->arr_len == 32);
29413         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29414         LDKThirtyTwoBytes payment_secret_ref;
29415         CHECK(payment_secret->arr_len == 32);
29416         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29417         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
29418         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
29419         return tag_ptr(ret_conv, true);
29420 }
29421
29422 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
29423         LDKChannelManager this_arg_conv;
29424         this_arg_conv.inner = untag_ptr(this_arg);
29425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29427         this_arg_conv.is_owned = false;
29428         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
29429         return ret_conv;
29430 }
29431
29432 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
29433         LDKChannelManager this_arg_conv;
29434         this_arg_conv.inner = untag_ptr(this_arg);
29435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29437         this_arg_conv.is_owned = false;
29438         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
29439         uint64_t ret_ref = 0;
29440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29442         return ret_ref;
29443 }
29444
29445 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
29446         LDKChannelManager this_arg_conv;
29447         this_arg_conv.inner = untag_ptr(this_arg);
29448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29450         this_arg_conv.is_owned = false;
29451         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
29452         return ret_conv;
29453 }
29454
29455 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
29456         LDKChannelManager this_arg_conv;
29457         this_arg_conv.inner = untag_ptr(this_arg);
29458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29460         this_arg_conv.is_owned = false;
29461         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
29462         uint64_t ret_ref = 0;
29463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29465         return ret_ref;
29466 }
29467
29468 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
29469         LDKChannelManager this_arg_conv;
29470         this_arg_conv.inner = untag_ptr(this_arg);
29471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29473         this_arg_conv.is_owned = false;
29474         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29475         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
29476         return tag_ptr(ret_ret, true);
29477 }
29478
29479 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
29480         LDKChannelManager this_arg_conv;
29481         this_arg_conv.inner = untag_ptr(this_arg);
29482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29484         this_arg_conv.is_owned = false;
29485         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29486         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
29487         return tag_ptr(ret_ret, true);
29488 }
29489
29490 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
29491         LDKChannelManager this_arg_conv;
29492         this_arg_conv.inner = untag_ptr(this_arg);
29493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29495         this_arg_conv.is_owned = false;
29496         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29497         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29498         return tag_ptr(ret_ret, true);
29499 }
29500
29501 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
29502         LDKChannelManager this_arg_conv;
29503         this_arg_conv.inner = untag_ptr(this_arg);
29504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29506         this_arg_conv.is_owned = false;
29507         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29508         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29509         return tag_ptr(ret_ret, true);
29510 }
29511
29512 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
29513         LDKChannelManager this_arg_conv;
29514         this_arg_conv.inner = untag_ptr(this_arg);
29515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29517         this_arg_conv.is_owned = false;
29518         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
29519         uint64_t ret_ref = 0;
29520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29522         return ret_ref;
29523 }
29524
29525 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
29526         LDKChannelManager this_arg_conv;
29527         this_arg_conv.inner = untag_ptr(this_arg);
29528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29530         this_arg_conv.is_owned = false;
29531         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29532         uint64_t ret_ref = 0;
29533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29535         return ret_ref;
29536 }
29537
29538 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
29539         LDKChannelManager this_arg_conv;
29540         this_arg_conv.inner = untag_ptr(this_arg);
29541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29543         this_arg_conv.is_owned = false;
29544         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
29545         uint64_t ret_ref = 0;
29546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29548         return ret_ref;
29549 }
29550
29551 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
29552         LDKChannelManager this_arg_conv;
29553         this_arg_conv.inner = untag_ptr(this_arg);
29554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29556         this_arg_conv.is_owned = false;
29557         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
29558         uint64_t ret_ref = 0;
29559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29561         return ret_ref;
29562 }
29563
29564 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
29565         LDKChannelManager this_arg_conv;
29566         this_arg_conv.inner = untag_ptr(this_arg);
29567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29569         this_arg_conv.is_owned = false;
29570         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
29571         uint64_t ret_ref = 0;
29572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29574         return ret_ref;
29575 }
29576
29577 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
29578         LDKChannelManager this_arg_conv;
29579         this_arg_conv.inner = untag_ptr(this_arg);
29580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29582         this_arg_conv.is_owned = false;
29583         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
29584         uint64_t ret_ref = 0;
29585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29587         return ret_ref;
29588 }
29589
29590 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
29591         LDKChannelManager this_arg_conv;
29592         this_arg_conv.inner = untag_ptr(this_arg);
29593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29595         this_arg_conv.is_owned = false;
29596         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29597         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29598         return tag_ptr(ret_ret, true);
29599 }
29600
29601 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t _config) {
29602         LDKUserConfig _config_conv;
29603         _config_conv.inner = untag_ptr(_config);
29604         _config_conv.is_owned = ptr_is_owned(_config);
29605         CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv);
29606         _config_conv.is_owned = false;
29607         LDKInitFeatures ret_var = provided_init_features(&_config_conv);
29608         uint64_t ret_ref = 0;
29609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29611         return ret_ref;
29612 }
29613
29614 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
29615         LDKCounterpartyForwardingInfo obj_conv;
29616         obj_conv.inner = untag_ptr(obj);
29617         obj_conv.is_owned = ptr_is_owned(obj);
29618         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29619         obj_conv.is_owned = false;
29620         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29621         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29622         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29623         CVec_u8Z_free(ret_var);
29624         return ret_arr;
29625 }
29626
29627 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
29628         LDKu8slice ser_ref;
29629         ser_ref.datalen = ser->arr_len;
29630         ser_ref.data = ser->elems;
29631         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29632         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29633         FREE(ser);
29634         return tag_ptr(ret_conv, true);
29635 }
29636
29637 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
29638         LDKChannelCounterparty obj_conv;
29639         obj_conv.inner = untag_ptr(obj);
29640         obj_conv.is_owned = ptr_is_owned(obj);
29641         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29642         obj_conv.is_owned = false;
29643         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29644         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29645         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29646         CVec_u8Z_free(ret_var);
29647         return ret_arr;
29648 }
29649
29650 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
29651         LDKu8slice ser_ref;
29652         ser_ref.datalen = ser->arr_len;
29653         ser_ref.data = ser->elems;
29654         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29655         *ret_conv = ChannelCounterparty_read(ser_ref);
29656         FREE(ser);
29657         return tag_ptr(ret_conv, true);
29658 }
29659
29660 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
29661         LDKChannelDetails obj_conv;
29662         obj_conv.inner = untag_ptr(obj);
29663         obj_conv.is_owned = ptr_is_owned(obj);
29664         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29665         obj_conv.is_owned = false;
29666         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29667         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29668         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29669         CVec_u8Z_free(ret_var);
29670         return ret_arr;
29671 }
29672
29673 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
29674         LDKu8slice ser_ref;
29675         ser_ref.datalen = ser->arr_len;
29676         ser_ref.data = ser->elems;
29677         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29678         *ret_conv = ChannelDetails_read(ser_ref);
29679         FREE(ser);
29680         return tag_ptr(ret_conv, true);
29681 }
29682
29683 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
29684         LDKPhantomRouteHints obj_conv;
29685         obj_conv.inner = untag_ptr(obj);
29686         obj_conv.is_owned = ptr_is_owned(obj);
29687         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29688         obj_conv.is_owned = false;
29689         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29690         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29691         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29692         CVec_u8Z_free(ret_var);
29693         return ret_arr;
29694 }
29695
29696 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
29697         LDKu8slice ser_ref;
29698         ser_ref.datalen = ser->arr_len;
29699         ser_ref.data = ser->elems;
29700         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29701         *ret_conv = PhantomRouteHints_read(ser_ref);
29702         FREE(ser);
29703         return tag_ptr(ret_conv, true);
29704 }
29705
29706 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
29707         LDKChannelManager obj_conv;
29708         obj_conv.inner = untag_ptr(obj);
29709         obj_conv.is_owned = ptr_is_owned(obj);
29710         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29711         obj_conv.is_owned = false;
29712         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29713         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29714         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29715         CVec_u8Z_free(ret_var);
29716         return ret_arr;
29717 }
29718
29719 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
29720         LDKChannelManagerReadArgs this_obj_conv;
29721         this_obj_conv.inner = untag_ptr(this_obj);
29722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29724         ChannelManagerReadArgs_free(this_obj_conv);
29725 }
29726
29727 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
29728         LDKChannelManagerReadArgs this_ptr_conv;
29729         this_ptr_conv.inner = untag_ptr(this_ptr);
29730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29732         this_ptr_conv.is_owned = false;
29733         // WARNING: This object doesn't live past this scope, needs clone!
29734         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
29735         return ret_ret;
29736 }
29737
29738 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
29739         LDKChannelManagerReadArgs this_ptr_conv;
29740         this_ptr_conv.inner = untag_ptr(this_ptr);
29741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29743         this_ptr_conv.is_owned = false;
29744         void* val_ptr = untag_ptr(val);
29745         CHECK_ACCESS(val_ptr);
29746         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
29747         if (val_conv.free == LDKEntropySource_JCalls_free) {
29748                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29749                 LDKEntropySource_JCalls_cloned(&val_conv);
29750         }
29751         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
29752 }
29753
29754 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
29755         LDKChannelManagerReadArgs this_ptr_conv;
29756         this_ptr_conv.inner = untag_ptr(this_ptr);
29757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29759         this_ptr_conv.is_owned = false;
29760         // WARNING: This object doesn't live past this scope, needs clone!
29761         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
29762         return ret_ret;
29763 }
29764
29765 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
29766         LDKChannelManagerReadArgs this_ptr_conv;
29767         this_ptr_conv.inner = untag_ptr(this_ptr);
29768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29770         this_ptr_conv.is_owned = false;
29771         void* val_ptr = untag_ptr(val);
29772         CHECK_ACCESS(val_ptr);
29773         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
29774         if (val_conv.free == LDKNodeSigner_JCalls_free) {
29775                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29776                 LDKNodeSigner_JCalls_cloned(&val_conv);
29777         }
29778         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
29779 }
29780
29781 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
29782         LDKChannelManagerReadArgs this_ptr_conv;
29783         this_ptr_conv.inner = untag_ptr(this_ptr);
29784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29786         this_ptr_conv.is_owned = false;
29787         // WARNING: This object doesn't live past this scope, needs clone!
29788         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
29789         return ret_ret;
29790 }
29791
29792 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
29793         LDKChannelManagerReadArgs this_ptr_conv;
29794         this_ptr_conv.inner = untag_ptr(this_ptr);
29795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29797         this_ptr_conv.is_owned = false;
29798         void* val_ptr = untag_ptr(val);
29799         CHECK_ACCESS(val_ptr);
29800         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
29801         if (val_conv.free == LDKSignerProvider_JCalls_free) {
29802                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29803                 LDKSignerProvider_JCalls_cloned(&val_conv);
29804         }
29805         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
29806 }
29807
29808 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
29809         LDKChannelManagerReadArgs this_ptr_conv;
29810         this_ptr_conv.inner = untag_ptr(this_ptr);
29811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29813         this_ptr_conv.is_owned = false;
29814         // WARNING: This object doesn't live past this scope, needs clone!
29815         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
29816         return ret_ret;
29817 }
29818
29819 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
29820         LDKChannelManagerReadArgs this_ptr_conv;
29821         this_ptr_conv.inner = untag_ptr(this_ptr);
29822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29824         this_ptr_conv.is_owned = false;
29825         void* val_ptr = untag_ptr(val);
29826         CHECK_ACCESS(val_ptr);
29827         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29828         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29829                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29830                 LDKFeeEstimator_JCalls_cloned(&val_conv);
29831         }
29832         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29833 }
29834
29835 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
29836         LDKChannelManagerReadArgs this_ptr_conv;
29837         this_ptr_conv.inner = untag_ptr(this_ptr);
29838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29840         this_ptr_conv.is_owned = false;
29841         // WARNING: This object doesn't live past this scope, needs clone!
29842         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
29843         return ret_ret;
29844 }
29845
29846 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
29847         LDKChannelManagerReadArgs this_ptr_conv;
29848         this_ptr_conv.inner = untag_ptr(this_ptr);
29849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29851         this_ptr_conv.is_owned = false;
29852         void* val_ptr = untag_ptr(val);
29853         CHECK_ACCESS(val_ptr);
29854         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29855         if (val_conv.free == LDKWatch_JCalls_free) {
29856                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29857                 LDKWatch_JCalls_cloned(&val_conv);
29858         }
29859         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29860 }
29861
29862 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
29863         LDKChannelManagerReadArgs this_ptr_conv;
29864         this_ptr_conv.inner = untag_ptr(this_ptr);
29865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29867         this_ptr_conv.is_owned = false;
29868         // WARNING: This object doesn't live past this scope, needs clone!
29869         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
29870         return ret_ret;
29871 }
29872
29873 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
29874         LDKChannelManagerReadArgs this_ptr_conv;
29875         this_ptr_conv.inner = untag_ptr(this_ptr);
29876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29878         this_ptr_conv.is_owned = false;
29879         void* val_ptr = untag_ptr(val);
29880         CHECK_ACCESS(val_ptr);
29881         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29882         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29883                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29884                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29885         }
29886         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29887 }
29888
29889 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
29890         LDKChannelManagerReadArgs this_ptr_conv;
29891         this_ptr_conv.inner = untag_ptr(this_ptr);
29892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29894         this_ptr_conv.is_owned = false;
29895         // WARNING: This object doesn't live past this scope, needs clone!
29896         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
29897         return ret_ret;
29898 }
29899
29900 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
29901         LDKChannelManagerReadArgs this_ptr_conv;
29902         this_ptr_conv.inner = untag_ptr(this_ptr);
29903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29905         this_ptr_conv.is_owned = false;
29906         void* val_ptr = untag_ptr(val);
29907         CHECK_ACCESS(val_ptr);
29908         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
29909         if (val_conv.free == LDKRouter_JCalls_free) {
29910                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29911                 LDKRouter_JCalls_cloned(&val_conv);
29912         }
29913         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
29914 }
29915
29916 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
29917         LDKChannelManagerReadArgs this_ptr_conv;
29918         this_ptr_conv.inner = untag_ptr(this_ptr);
29919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29921         this_ptr_conv.is_owned = false;
29922         // WARNING: This object doesn't live past this scope, needs clone!
29923         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
29924         return ret_ret;
29925 }
29926
29927 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
29928         LDKChannelManagerReadArgs this_ptr_conv;
29929         this_ptr_conv.inner = untag_ptr(this_ptr);
29930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29932         this_ptr_conv.is_owned = false;
29933         void* val_ptr = untag_ptr(val);
29934         CHECK_ACCESS(val_ptr);
29935         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29936         if (val_conv.free == LDKLogger_JCalls_free) {
29937                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29938                 LDKLogger_JCalls_cloned(&val_conv);
29939         }
29940         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29941 }
29942
29943 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
29944         LDKChannelManagerReadArgs this_ptr_conv;
29945         this_ptr_conv.inner = untag_ptr(this_ptr);
29946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29948         this_ptr_conv.is_owned = false;
29949         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29950         uint64_t ret_ref = 0;
29951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29953         return ret_ref;
29954 }
29955
29956 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
29957         LDKChannelManagerReadArgs this_ptr_conv;
29958         this_ptr_conv.inner = untag_ptr(this_ptr);
29959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29961         this_ptr_conv.is_owned = false;
29962         LDKUserConfig val_conv;
29963         val_conv.inner = untag_ptr(val);
29964         val_conv.is_owned = ptr_is_owned(val);
29965         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29966         val_conv = UserConfig_clone(&val_conv);
29967         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29968 }
29969
29970 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) {
29971         void* entropy_source_ptr = untag_ptr(entropy_source);
29972         CHECK_ACCESS(entropy_source_ptr);
29973         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
29974         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
29975                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29976                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
29977         }
29978         void* node_signer_ptr = untag_ptr(node_signer);
29979         CHECK_ACCESS(node_signer_ptr);
29980         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
29981         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
29982                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29983                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
29984         }
29985         void* signer_provider_ptr = untag_ptr(signer_provider);
29986         CHECK_ACCESS(signer_provider_ptr);
29987         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
29988         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
29989                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29990                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
29991         }
29992         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29993         CHECK_ACCESS(fee_estimator_ptr);
29994         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29995         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29996                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29997                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29998         }
29999         void* chain_monitor_ptr = untag_ptr(chain_monitor);
30000         CHECK_ACCESS(chain_monitor_ptr);
30001         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30002         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30003                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30004                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30005         }
30006         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
30007         CHECK_ACCESS(tx_broadcaster_ptr);
30008         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30009         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30010                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30011                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30012         }
30013         void* router_ptr = untag_ptr(router);
30014         CHECK_ACCESS(router_ptr);
30015         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
30016         if (router_conv.free == LDKRouter_JCalls_free) {
30017                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30018                 LDKRouter_JCalls_cloned(&router_conv);
30019         }
30020         void* logger_ptr = untag_ptr(logger);
30021         CHECK_ACCESS(logger_ptr);
30022         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30023         if (logger_conv.free == LDKLogger_JCalls_free) {
30024                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30025                 LDKLogger_JCalls_cloned(&logger_conv);
30026         }
30027         LDKUserConfig default_config_conv;
30028         default_config_conv.inner = untag_ptr(default_config);
30029         default_config_conv.is_owned = ptr_is_owned(default_config);
30030         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30031         default_config_conv = UserConfig_clone(&default_config_conv);
30032         LDKCVec_ChannelMonitorZ channel_monitors_constr;
30033         channel_monitors_constr.datalen = channel_monitors->arr_len;
30034         if (channel_monitors_constr.datalen > 0)
30035                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30036         else
30037                 channel_monitors_constr.data = NULL;
30038         uint64_t* channel_monitors_vals = channel_monitors->elems;
30039         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30040                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30041                 LDKChannelMonitor channel_monitors_conv_16_conv;
30042                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
30043                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
30044                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30045                 channel_monitors_conv_16_conv.is_owned = false;
30046                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30047         }
30048         FREE(channel_monitors);
30049         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);
30050         uint64_t ret_ref = 0;
30051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30053         return ret_ref;
30054 }
30055
30056 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
30057         LDKu8slice ser_ref;
30058         ser_ref.datalen = ser->arr_len;
30059         ser_ref.data = ser->elems;
30060         LDKChannelManagerReadArgs arg_conv;
30061         arg_conv.inner = untag_ptr(arg);
30062         arg_conv.is_owned = ptr_is_owned(arg);
30063         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30064         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30065         
30066         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30067         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30068         FREE(ser);
30069         return tag_ptr(ret_conv, true);
30070 }
30071
30072 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
30073         LDKExpandedKey this_obj_conv;
30074         this_obj_conv.inner = untag_ptr(this_obj);
30075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30077         ExpandedKey_free(this_obj_conv);
30078 }
30079
30080 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
30081         uint8_t key_material_arr[32];
30082         CHECK(key_material->arr_len == 32);
30083         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
30084         uint8_t (*key_material_ref)[32] = &key_material_arr;
30085         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30086         uint64_t ret_ref = 0;
30087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30089         return ret_ref;
30090 }
30091
30092 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) {
30093         LDKExpandedKey keys_conv;
30094         keys_conv.inner = untag_ptr(keys);
30095         keys_conv.is_owned = ptr_is_owned(keys);
30096         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30097         keys_conv.is_owned = false;
30098         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30099         CHECK_ACCESS(min_value_msat_ptr);
30100         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30101         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30102         void* entropy_source_ptr = untag_ptr(entropy_source);
30103         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
30104         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
30105         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30106         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30107         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30108         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30109         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30110         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
30111         return tag_ptr(ret_conv, true);
30112 }
30113
30114 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) {
30115         LDKExpandedKey keys_conv;
30116         keys_conv.inner = untag_ptr(keys);
30117         keys_conv.is_owned = ptr_is_owned(keys);
30118         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30119         keys_conv.is_owned = false;
30120         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30121         CHECK_ACCESS(min_value_msat_ptr);
30122         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30123         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30124         LDKThirtyTwoBytes payment_hash_ref;
30125         CHECK(payment_hash->arr_len == 32);
30126         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30127         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30128         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30129         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30130         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30131         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30132         *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);
30133         return tag_ptr(ret_conv, true);
30134 }
30135
30136 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
30137         if (!ptr_is_owned(this_ptr)) return;
30138         void* this_ptr_ptr = untag_ptr(this_ptr);
30139         CHECK_ACCESS(this_ptr_ptr);
30140         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
30141         FREE(untag_ptr(this_ptr));
30142         DecodeError_free(this_ptr_conv);
30143 }
30144
30145 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30146         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30147         *ret_copy = DecodeError_clone(arg);
30148         uint64_t ret_ref = tag_ptr(ret_copy, true);
30149         return ret_ref;
30150 }
30151 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
30152         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
30153         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
30154         return ret_conv;
30155 }
30156
30157 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
30158         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
30159         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30160         *ret_copy = DecodeError_clone(orig_conv);
30161         uint64_t ret_ref = tag_ptr(ret_copy, true);
30162         return ret_ref;
30163 }
30164
30165 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
30166         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30167         *ret_copy = DecodeError_unknown_version();
30168         uint64_t ret_ref = tag_ptr(ret_copy, true);
30169         return ret_ref;
30170 }
30171
30172 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
30173         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30174         *ret_copy = DecodeError_unknown_required_feature();
30175         uint64_t ret_ref = tag_ptr(ret_copy, true);
30176         return ret_ref;
30177 }
30178
30179 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
30180         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30181         *ret_copy = DecodeError_invalid_value();
30182         uint64_t ret_ref = tag_ptr(ret_copy, true);
30183         return ret_ref;
30184 }
30185
30186 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
30187         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30188         *ret_copy = DecodeError_short_read();
30189         uint64_t ret_ref = tag_ptr(ret_copy, true);
30190         return ret_ref;
30191 }
30192
30193 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
30194         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30195         *ret_copy = DecodeError_bad_length_descriptor();
30196         uint64_t ret_ref = tag_ptr(ret_copy, true);
30197         return ret_ref;
30198 }
30199
30200 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
30201         LDKIOError a_conv = LDKIOError_from_js(a);
30202         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30203         *ret_copy = DecodeError_io(a_conv);
30204         uint64_t ret_ref = tag_ptr(ret_copy, true);
30205         return ret_ref;
30206 }
30207
30208 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
30209         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30210         *ret_copy = DecodeError_unsupported_compression();
30211         uint64_t ret_ref = tag_ptr(ret_copy, true);
30212         return ret_ref;
30213 }
30214
30215 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
30216         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
30217         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
30218         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
30219         return ret_conv;
30220 }
30221
30222 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
30223         LDKInit this_obj_conv;
30224         this_obj_conv.inner = untag_ptr(this_obj);
30225         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30227         Init_free(this_obj_conv);
30228 }
30229
30230 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
30231         LDKInit this_ptr_conv;
30232         this_ptr_conv.inner = untag_ptr(this_ptr);
30233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30235         this_ptr_conv.is_owned = false;
30236         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30237         uint64_t ret_ref = 0;
30238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30240         return ret_ref;
30241 }
30242
30243 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
30244         LDKInit this_ptr_conv;
30245         this_ptr_conv.inner = untag_ptr(this_ptr);
30246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30248         this_ptr_conv.is_owned = false;
30249         LDKInitFeatures val_conv;
30250         val_conv.inner = untag_ptr(val);
30251         val_conv.is_owned = ptr_is_owned(val);
30252         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30253         val_conv = InitFeatures_clone(&val_conv);
30254         Init_set_features(&this_ptr_conv, val_conv);
30255 }
30256
30257 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
30258         LDKInit this_ptr_conv;
30259         this_ptr_conv.inner = untag_ptr(this_ptr);
30260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30262         this_ptr_conv.is_owned = false;
30263         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30264         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30265         uint64_t ret_ref = tag_ptr(ret_copy, true);
30266         return ret_ref;
30267 }
30268
30269 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
30270         LDKInit this_ptr_conv;
30271         this_ptr_conv.inner = untag_ptr(this_ptr);
30272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30274         this_ptr_conv.is_owned = false;
30275         void* val_ptr = untag_ptr(val);
30276         CHECK_ACCESS(val_ptr);
30277         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30278         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
30279         Init_set_remote_network_address(&this_ptr_conv, val_conv);
30280 }
30281
30282 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
30283         LDKInitFeatures features_arg_conv;
30284         features_arg_conv.inner = untag_ptr(features_arg);
30285         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30286         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30287         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30288         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
30289         CHECK_ACCESS(remote_network_address_arg_ptr);
30290         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30291         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30292         uint64_t ret_ref = 0;
30293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30295         return ret_ref;
30296 }
30297
30298 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30299         LDKInit ret_var = Init_clone(arg);
30300         uint64_t ret_ref = 0;
30301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30303         return ret_ref;
30304 }
30305 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
30306         LDKInit arg_conv;
30307         arg_conv.inner = untag_ptr(arg);
30308         arg_conv.is_owned = ptr_is_owned(arg);
30309         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30310         arg_conv.is_owned = false;
30311         int64_t ret_conv = Init_clone_ptr(&arg_conv);
30312         return ret_conv;
30313 }
30314
30315 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
30316         LDKInit orig_conv;
30317         orig_conv.inner = untag_ptr(orig);
30318         orig_conv.is_owned = ptr_is_owned(orig);
30319         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30320         orig_conv.is_owned = false;
30321         LDKInit ret_var = Init_clone(&orig_conv);
30322         uint64_t ret_ref = 0;
30323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30325         return ret_ref;
30326 }
30327
30328 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
30329         LDKInit a_conv;
30330         a_conv.inner = untag_ptr(a);
30331         a_conv.is_owned = ptr_is_owned(a);
30332         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30333         a_conv.is_owned = false;
30334         LDKInit b_conv;
30335         b_conv.inner = untag_ptr(b);
30336         b_conv.is_owned = ptr_is_owned(b);
30337         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30338         b_conv.is_owned = false;
30339         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
30340         return ret_conv;
30341 }
30342
30343 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
30344         LDKErrorMessage this_obj_conv;
30345         this_obj_conv.inner = untag_ptr(this_obj);
30346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30348         ErrorMessage_free(this_obj_conv);
30349 }
30350
30351 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
30352         LDKErrorMessage this_ptr_conv;
30353         this_ptr_conv.inner = untag_ptr(this_ptr);
30354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30356         this_ptr_conv.is_owned = false;
30357         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30358         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
30359         return ret_arr;
30360 }
30361
30362 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30363         LDKErrorMessage this_ptr_conv;
30364         this_ptr_conv.inner = untag_ptr(this_ptr);
30365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30367         this_ptr_conv.is_owned = false;
30368         LDKThirtyTwoBytes val_ref;
30369         CHECK(val->arr_len == 32);
30370         memcpy(val_ref.data, val->elems, 32); FREE(val);
30371         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30372 }
30373
30374 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
30375         LDKErrorMessage this_ptr_conv;
30376         this_ptr_conv.inner = untag_ptr(this_ptr);
30377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30379         this_ptr_conv.is_owned = false;
30380         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30381         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30382         Str_free(ret_str);
30383         return ret_conv;
30384 }
30385
30386 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
30387         LDKErrorMessage this_ptr_conv;
30388         this_ptr_conv.inner = untag_ptr(this_ptr);
30389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30391         this_ptr_conv.is_owned = false;
30392         LDKStr val_conv = str_ref_to_owned_c(val);
30393         ErrorMessage_set_data(&this_ptr_conv, val_conv);
30394 }
30395
30396 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30397         LDKThirtyTwoBytes channel_id_arg_ref;
30398         CHECK(channel_id_arg->arr_len == 32);
30399         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30400         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30401         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30402         uint64_t ret_ref = 0;
30403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30405         return ret_ref;
30406 }
30407
30408 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30409         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30410         uint64_t ret_ref = 0;
30411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30413         return ret_ref;
30414 }
30415 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
30416         LDKErrorMessage arg_conv;
30417         arg_conv.inner = untag_ptr(arg);
30418         arg_conv.is_owned = ptr_is_owned(arg);
30419         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30420         arg_conv.is_owned = false;
30421         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30422         return ret_conv;
30423 }
30424
30425 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
30426         LDKErrorMessage orig_conv;
30427         orig_conv.inner = untag_ptr(orig);
30428         orig_conv.is_owned = ptr_is_owned(orig);
30429         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30430         orig_conv.is_owned = false;
30431         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30432         uint64_t ret_ref = 0;
30433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30435         return ret_ref;
30436 }
30437
30438 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
30439         LDKErrorMessage a_conv;
30440         a_conv.inner = untag_ptr(a);
30441         a_conv.is_owned = ptr_is_owned(a);
30442         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30443         a_conv.is_owned = false;
30444         LDKErrorMessage b_conv;
30445         b_conv.inner = untag_ptr(b);
30446         b_conv.is_owned = ptr_is_owned(b);
30447         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30448         b_conv.is_owned = false;
30449         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
30450         return ret_conv;
30451 }
30452
30453 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
30454         LDKWarningMessage this_obj_conv;
30455         this_obj_conv.inner = untag_ptr(this_obj);
30456         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30458         WarningMessage_free(this_obj_conv);
30459 }
30460
30461 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
30462         LDKWarningMessage this_ptr_conv;
30463         this_ptr_conv.inner = untag_ptr(this_ptr);
30464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30466         this_ptr_conv.is_owned = false;
30467         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30468         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
30469         return ret_arr;
30470 }
30471
30472 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30473         LDKWarningMessage this_ptr_conv;
30474         this_ptr_conv.inner = untag_ptr(this_ptr);
30475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30477         this_ptr_conv.is_owned = false;
30478         LDKThirtyTwoBytes val_ref;
30479         CHECK(val->arr_len == 32);
30480         memcpy(val_ref.data, val->elems, 32); FREE(val);
30481         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30482 }
30483
30484 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
30485         LDKWarningMessage this_ptr_conv;
30486         this_ptr_conv.inner = untag_ptr(this_ptr);
30487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30489         this_ptr_conv.is_owned = false;
30490         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30491         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30492         Str_free(ret_str);
30493         return ret_conv;
30494 }
30495
30496 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
30497         LDKWarningMessage this_ptr_conv;
30498         this_ptr_conv.inner = untag_ptr(this_ptr);
30499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30501         this_ptr_conv.is_owned = false;
30502         LDKStr val_conv = str_ref_to_owned_c(val);
30503         WarningMessage_set_data(&this_ptr_conv, val_conv);
30504 }
30505
30506 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30507         LDKThirtyTwoBytes channel_id_arg_ref;
30508         CHECK(channel_id_arg->arr_len == 32);
30509         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30510         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30511         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30512         uint64_t ret_ref = 0;
30513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30515         return ret_ref;
30516 }
30517
30518 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30519         LDKWarningMessage ret_var = WarningMessage_clone(arg);
30520         uint64_t ret_ref = 0;
30521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30523         return ret_ref;
30524 }
30525 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
30526         LDKWarningMessage arg_conv;
30527         arg_conv.inner = untag_ptr(arg);
30528         arg_conv.is_owned = ptr_is_owned(arg);
30529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30530         arg_conv.is_owned = false;
30531         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30532         return ret_conv;
30533 }
30534
30535 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
30536         LDKWarningMessage orig_conv;
30537         orig_conv.inner = untag_ptr(orig);
30538         orig_conv.is_owned = ptr_is_owned(orig);
30539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30540         orig_conv.is_owned = false;
30541         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30542         uint64_t ret_ref = 0;
30543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30545         return ret_ref;
30546 }
30547
30548 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
30549         LDKWarningMessage a_conv;
30550         a_conv.inner = untag_ptr(a);
30551         a_conv.is_owned = ptr_is_owned(a);
30552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30553         a_conv.is_owned = false;
30554         LDKWarningMessage b_conv;
30555         b_conv.inner = untag_ptr(b);
30556         b_conv.is_owned = ptr_is_owned(b);
30557         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30558         b_conv.is_owned = false;
30559         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
30560         return ret_conv;
30561 }
30562
30563 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
30564         LDKPing this_obj_conv;
30565         this_obj_conv.inner = untag_ptr(this_obj);
30566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30568         Ping_free(this_obj_conv);
30569 }
30570
30571 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
30572         LDKPing this_ptr_conv;
30573         this_ptr_conv.inner = untag_ptr(this_ptr);
30574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30576         this_ptr_conv.is_owned = false;
30577         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30578         return ret_conv;
30579 }
30580
30581 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
30582         LDKPing this_ptr_conv;
30583         this_ptr_conv.inner = untag_ptr(this_ptr);
30584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30586         this_ptr_conv.is_owned = false;
30587         Ping_set_ponglen(&this_ptr_conv, val);
30588 }
30589
30590 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
30591         LDKPing this_ptr_conv;
30592         this_ptr_conv.inner = untag_ptr(this_ptr);
30593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30595         this_ptr_conv.is_owned = false;
30596         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30597         return ret_conv;
30598 }
30599
30600 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
30601         LDKPing this_ptr_conv;
30602         this_ptr_conv.inner = untag_ptr(this_ptr);
30603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30605         this_ptr_conv.is_owned = false;
30606         Ping_set_byteslen(&this_ptr_conv, val);
30607 }
30608
30609 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
30610         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30611         uint64_t ret_ref = 0;
30612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30614         return ret_ref;
30615 }
30616
30617 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30618         LDKPing ret_var = Ping_clone(arg);
30619         uint64_t ret_ref = 0;
30620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30622         return ret_ref;
30623 }
30624 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
30625         LDKPing arg_conv;
30626         arg_conv.inner = untag_ptr(arg);
30627         arg_conv.is_owned = ptr_is_owned(arg);
30628         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30629         arg_conv.is_owned = false;
30630         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30631         return ret_conv;
30632 }
30633
30634 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
30635         LDKPing orig_conv;
30636         orig_conv.inner = untag_ptr(orig);
30637         orig_conv.is_owned = ptr_is_owned(orig);
30638         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30639         orig_conv.is_owned = false;
30640         LDKPing ret_var = Ping_clone(&orig_conv);
30641         uint64_t ret_ref = 0;
30642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30644         return ret_ref;
30645 }
30646
30647 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
30648         LDKPing a_conv;
30649         a_conv.inner = untag_ptr(a);
30650         a_conv.is_owned = ptr_is_owned(a);
30651         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30652         a_conv.is_owned = false;
30653         LDKPing b_conv;
30654         b_conv.inner = untag_ptr(b);
30655         b_conv.is_owned = ptr_is_owned(b);
30656         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30657         b_conv.is_owned = false;
30658         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
30659         return ret_conv;
30660 }
30661
30662 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
30663         LDKPong this_obj_conv;
30664         this_obj_conv.inner = untag_ptr(this_obj);
30665         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30667         Pong_free(this_obj_conv);
30668 }
30669
30670 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
30671         LDKPong this_ptr_conv;
30672         this_ptr_conv.inner = untag_ptr(this_ptr);
30673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30675         this_ptr_conv.is_owned = false;
30676         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30677         return ret_conv;
30678 }
30679
30680 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
30681         LDKPong this_ptr_conv;
30682         this_ptr_conv.inner = untag_ptr(this_ptr);
30683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30685         this_ptr_conv.is_owned = false;
30686         Pong_set_byteslen(&this_ptr_conv, val);
30687 }
30688
30689 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
30690         LDKPong ret_var = Pong_new(byteslen_arg);
30691         uint64_t ret_ref = 0;
30692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30694         return ret_ref;
30695 }
30696
30697 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30698         LDKPong ret_var = Pong_clone(arg);
30699         uint64_t ret_ref = 0;
30700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30702         return ret_ref;
30703 }
30704 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
30705         LDKPong arg_conv;
30706         arg_conv.inner = untag_ptr(arg);
30707         arg_conv.is_owned = ptr_is_owned(arg);
30708         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30709         arg_conv.is_owned = false;
30710         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30711         return ret_conv;
30712 }
30713
30714 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
30715         LDKPong orig_conv;
30716         orig_conv.inner = untag_ptr(orig);
30717         orig_conv.is_owned = ptr_is_owned(orig);
30718         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30719         orig_conv.is_owned = false;
30720         LDKPong ret_var = Pong_clone(&orig_conv);
30721         uint64_t ret_ref = 0;
30722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30724         return ret_ref;
30725 }
30726
30727 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
30728         LDKPong a_conv;
30729         a_conv.inner = untag_ptr(a);
30730         a_conv.is_owned = ptr_is_owned(a);
30731         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30732         a_conv.is_owned = false;
30733         LDKPong b_conv;
30734         b_conv.inner = untag_ptr(b);
30735         b_conv.is_owned = ptr_is_owned(b);
30736         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30737         b_conv.is_owned = false;
30738         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
30739         return ret_conv;
30740 }
30741
30742 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
30743         LDKOpenChannel this_obj_conv;
30744         this_obj_conv.inner = untag_ptr(this_obj);
30745         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30747         OpenChannel_free(this_obj_conv);
30748 }
30749
30750 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
30751         LDKOpenChannel this_ptr_conv;
30752         this_ptr_conv.inner = untag_ptr(this_ptr);
30753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30755         this_ptr_conv.is_owned = false;
30756         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30757         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
30758         return ret_arr;
30759 }
30760
30761 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30762         LDKOpenChannel this_ptr_conv;
30763         this_ptr_conv.inner = untag_ptr(this_ptr);
30764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30766         this_ptr_conv.is_owned = false;
30767         LDKThirtyTwoBytes val_ref;
30768         CHECK(val->arr_len == 32);
30769         memcpy(val_ref.data, val->elems, 32); FREE(val);
30770         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30771 }
30772
30773 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
30774         LDKOpenChannel this_ptr_conv;
30775         this_ptr_conv.inner = untag_ptr(this_ptr);
30776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30778         this_ptr_conv.is_owned = false;
30779         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30780         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30781         return ret_arr;
30782 }
30783
30784 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30785         LDKOpenChannel this_ptr_conv;
30786         this_ptr_conv.inner = untag_ptr(this_ptr);
30787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30789         this_ptr_conv.is_owned = false;
30790         LDKThirtyTwoBytes val_ref;
30791         CHECK(val->arr_len == 32);
30792         memcpy(val_ref.data, val->elems, 32); FREE(val);
30793         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30794 }
30795
30796 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
30797         LDKOpenChannel this_ptr_conv;
30798         this_ptr_conv.inner = untag_ptr(this_ptr);
30799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30801         this_ptr_conv.is_owned = false;
30802         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30803         return ret_conv;
30804 }
30805
30806 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
30807         LDKOpenChannel this_ptr_conv;
30808         this_ptr_conv.inner = untag_ptr(this_ptr);
30809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30811         this_ptr_conv.is_owned = false;
30812         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30813 }
30814
30815 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
30816         LDKOpenChannel this_ptr_conv;
30817         this_ptr_conv.inner = untag_ptr(this_ptr);
30818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30820         this_ptr_conv.is_owned = false;
30821         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30822         return ret_conv;
30823 }
30824
30825 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
30826         LDKOpenChannel this_ptr_conv;
30827         this_ptr_conv.inner = untag_ptr(this_ptr);
30828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30830         this_ptr_conv.is_owned = false;
30831         OpenChannel_set_push_msat(&this_ptr_conv, val);
30832 }
30833
30834 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30835         LDKOpenChannel this_ptr_conv;
30836         this_ptr_conv.inner = untag_ptr(this_ptr);
30837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30839         this_ptr_conv.is_owned = false;
30840         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30841         return ret_conv;
30842 }
30843
30844 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30845         LDKOpenChannel this_ptr_conv;
30846         this_ptr_conv.inner = untag_ptr(this_ptr);
30847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30849         this_ptr_conv.is_owned = false;
30850         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30851 }
30852
30853 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) {
30854         LDKOpenChannel this_ptr_conv;
30855         this_ptr_conv.inner = untag_ptr(this_ptr);
30856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30858         this_ptr_conv.is_owned = false;
30859         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30860         return ret_conv;
30861 }
30862
30863 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) {
30864         LDKOpenChannel this_ptr_conv;
30865         this_ptr_conv.inner = untag_ptr(this_ptr);
30866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30868         this_ptr_conv.is_owned = false;
30869         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30870 }
30871
30872 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30873         LDKOpenChannel this_ptr_conv;
30874         this_ptr_conv.inner = untag_ptr(this_ptr);
30875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30877         this_ptr_conv.is_owned = false;
30878         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30879         return ret_conv;
30880 }
30881
30882 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
30883         LDKOpenChannel this_ptr_conv;
30884         this_ptr_conv.inner = untag_ptr(this_ptr);
30885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30887         this_ptr_conv.is_owned = false;
30888         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30889 }
30890
30891 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30892         LDKOpenChannel this_ptr_conv;
30893         this_ptr_conv.inner = untag_ptr(this_ptr);
30894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30896         this_ptr_conv.is_owned = false;
30897         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30898         return ret_conv;
30899 }
30900
30901 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30902         LDKOpenChannel this_ptr_conv;
30903         this_ptr_conv.inner = untag_ptr(this_ptr);
30904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30906         this_ptr_conv.is_owned = false;
30907         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30908 }
30909
30910 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
30911         LDKOpenChannel this_ptr_conv;
30912         this_ptr_conv.inner = untag_ptr(this_ptr);
30913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30915         this_ptr_conv.is_owned = false;
30916         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
30917         return ret_conv;
30918 }
30919
30920 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
30921         LDKOpenChannel this_ptr_conv;
30922         this_ptr_conv.inner = untag_ptr(this_ptr);
30923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30925         this_ptr_conv.is_owned = false;
30926         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
30927 }
30928
30929 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
30930         LDKOpenChannel this_ptr_conv;
30931         this_ptr_conv.inner = untag_ptr(this_ptr);
30932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30934         this_ptr_conv.is_owned = false;
30935         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
30936         return ret_conv;
30937 }
30938
30939 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
30940         LDKOpenChannel this_ptr_conv;
30941         this_ptr_conv.inner = untag_ptr(this_ptr);
30942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30944         this_ptr_conv.is_owned = false;
30945         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
30946 }
30947
30948 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
30949         LDKOpenChannel this_ptr_conv;
30950         this_ptr_conv.inner = untag_ptr(this_ptr);
30951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30953         this_ptr_conv.is_owned = false;
30954         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
30955         return ret_conv;
30956 }
30957
30958 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t 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         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30965 }
30966
30967 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
30968         LDKOpenChannel this_ptr_conv;
30969         this_ptr_conv.inner = untag_ptr(this_ptr);
30970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30972         this_ptr_conv.is_owned = false;
30973         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30974         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
30975         return ret_arr;
30976 }
30977
30978 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
30979         LDKOpenChannel this_ptr_conv;
30980         this_ptr_conv.inner = untag_ptr(this_ptr);
30981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30983         this_ptr_conv.is_owned = false;
30984         LDKPublicKey val_ref;
30985         CHECK(val->arr_len == 33);
30986         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30987         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30988 }
30989
30990 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
30991         LDKOpenChannel this_ptr_conv;
30992         this_ptr_conv.inner = untag_ptr(this_ptr);
30993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30995         this_ptr_conv.is_owned = false;
30996         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30997         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
30998         return ret_arr;
30999 }
31000
31001 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31002         LDKOpenChannel this_ptr_conv;
31003         this_ptr_conv.inner = untag_ptr(this_ptr);
31004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31006         this_ptr_conv.is_owned = false;
31007         LDKPublicKey val_ref;
31008         CHECK(val->arr_len == 33);
31009         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31010         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31011 }
31012
31013 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
31014         LDKOpenChannel this_ptr_conv;
31015         this_ptr_conv.inner = untag_ptr(this_ptr);
31016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31018         this_ptr_conv.is_owned = false;
31019         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31020         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31021         return ret_arr;
31022 }
31023
31024 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31025         LDKOpenChannel this_ptr_conv;
31026         this_ptr_conv.inner = untag_ptr(this_ptr);
31027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31029         this_ptr_conv.is_owned = false;
31030         LDKPublicKey val_ref;
31031         CHECK(val->arr_len == 33);
31032         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31033         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31034 }
31035
31036 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31037         LDKOpenChannel this_ptr_conv;
31038         this_ptr_conv.inner = untag_ptr(this_ptr);
31039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31041         this_ptr_conv.is_owned = false;
31042         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31043         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31044         return ret_arr;
31045 }
31046
31047 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31048         LDKOpenChannel this_ptr_conv;
31049         this_ptr_conv.inner = untag_ptr(this_ptr);
31050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31052         this_ptr_conv.is_owned = false;
31053         LDKPublicKey val_ref;
31054         CHECK(val->arr_len == 33);
31055         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31056         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31057 }
31058
31059 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
31060         LDKOpenChannel this_ptr_conv;
31061         this_ptr_conv.inner = untag_ptr(this_ptr);
31062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31064         this_ptr_conv.is_owned = false;
31065         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31066         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31067         return ret_arr;
31068 }
31069
31070 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31071         LDKOpenChannel this_ptr_conv;
31072         this_ptr_conv.inner = untag_ptr(this_ptr);
31073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31075         this_ptr_conv.is_owned = false;
31076         LDKPublicKey val_ref;
31077         CHECK(val->arr_len == 33);
31078         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31079         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31080 }
31081
31082 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31083         LDKOpenChannel this_ptr_conv;
31084         this_ptr_conv.inner = untag_ptr(this_ptr);
31085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31087         this_ptr_conv.is_owned = false;
31088         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31089         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31090         return ret_arr;
31091 }
31092
31093 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) {
31094         LDKOpenChannel this_ptr_conv;
31095         this_ptr_conv.inner = untag_ptr(this_ptr);
31096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31098         this_ptr_conv.is_owned = false;
31099         LDKPublicKey val_ref;
31100         CHECK(val->arr_len == 33);
31101         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31102         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31103 }
31104
31105 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
31106         LDKOpenChannel this_ptr_conv;
31107         this_ptr_conv.inner = untag_ptr(this_ptr);
31108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31110         this_ptr_conv.is_owned = false;
31111         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31112         return ret_conv;
31113 }
31114
31115 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
31116         LDKOpenChannel this_ptr_conv;
31117         this_ptr_conv.inner = untag_ptr(this_ptr);
31118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31120         this_ptr_conv.is_owned = false;
31121         OpenChannel_set_channel_flags(&this_ptr_conv, val);
31122 }
31123
31124 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
31125         LDKOpenChannel this_ptr_conv;
31126         this_ptr_conv.inner = untag_ptr(this_ptr);
31127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31129         this_ptr_conv.is_owned = false;
31130         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31131         uint64_t ret_ref = 0;
31132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31134         return ret_ref;
31135 }
31136
31137 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31138         LDKOpenChannel this_ptr_conv;
31139         this_ptr_conv.inner = untag_ptr(this_ptr);
31140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31142         this_ptr_conv.is_owned = false;
31143         LDKChannelTypeFeatures val_conv;
31144         val_conv.inner = untag_ptr(val);
31145         val_conv.is_owned = ptr_is_owned(val);
31146         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31147         val_conv = ChannelTypeFeatures_clone(&val_conv);
31148         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31149 }
31150
31151 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31152         LDKOpenChannel ret_var = OpenChannel_clone(arg);
31153         uint64_t ret_ref = 0;
31154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31156         return ret_ref;
31157 }
31158 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
31159         LDKOpenChannel arg_conv;
31160         arg_conv.inner = untag_ptr(arg);
31161         arg_conv.is_owned = ptr_is_owned(arg);
31162         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31163         arg_conv.is_owned = false;
31164         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31165         return ret_conv;
31166 }
31167
31168 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
31169         LDKOpenChannel orig_conv;
31170         orig_conv.inner = untag_ptr(orig);
31171         orig_conv.is_owned = ptr_is_owned(orig);
31172         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31173         orig_conv.is_owned = false;
31174         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31175         uint64_t ret_ref = 0;
31176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31178         return ret_ref;
31179 }
31180
31181 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
31182         LDKOpenChannel a_conv;
31183         a_conv.inner = untag_ptr(a);
31184         a_conv.is_owned = ptr_is_owned(a);
31185         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31186         a_conv.is_owned = false;
31187         LDKOpenChannel b_conv;
31188         b_conv.inner = untag_ptr(b);
31189         b_conv.is_owned = ptr_is_owned(b);
31190         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31191         b_conv.is_owned = false;
31192         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
31193         return ret_conv;
31194 }
31195
31196 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
31197         LDKAcceptChannel this_obj_conv;
31198         this_obj_conv.inner = untag_ptr(this_obj);
31199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31201         AcceptChannel_free(this_obj_conv);
31202 }
31203
31204 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
31205         LDKAcceptChannel this_ptr_conv;
31206         this_ptr_conv.inner = untag_ptr(this_ptr);
31207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31209         this_ptr_conv.is_owned = false;
31210         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31211         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
31212         return ret_arr;
31213 }
31214
31215 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31216         LDKAcceptChannel this_ptr_conv;
31217         this_ptr_conv.inner = untag_ptr(this_ptr);
31218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31220         this_ptr_conv.is_owned = false;
31221         LDKThirtyTwoBytes val_ref;
31222         CHECK(val->arr_len == 32);
31223         memcpy(val_ref.data, val->elems, 32); FREE(val);
31224         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31225 }
31226
31227 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
31228         LDKAcceptChannel this_ptr_conv;
31229         this_ptr_conv.inner = untag_ptr(this_ptr);
31230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31232         this_ptr_conv.is_owned = false;
31233         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31234         return ret_conv;
31235 }
31236
31237 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
31238         LDKAcceptChannel this_ptr_conv;
31239         this_ptr_conv.inner = untag_ptr(this_ptr);
31240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31242         this_ptr_conv.is_owned = false;
31243         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31244 }
31245
31246 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) {
31247         LDKAcceptChannel this_ptr_conv;
31248         this_ptr_conv.inner = untag_ptr(this_ptr);
31249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31251         this_ptr_conv.is_owned = false;
31252         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31253         return ret_conv;
31254 }
31255
31256 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) {
31257         LDKAcceptChannel this_ptr_conv;
31258         this_ptr_conv.inner = untag_ptr(this_ptr);
31259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31261         this_ptr_conv.is_owned = false;
31262         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31263 }
31264
31265 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
31266         LDKAcceptChannel this_ptr_conv;
31267         this_ptr_conv.inner = untag_ptr(this_ptr);
31268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31270         this_ptr_conv.is_owned = false;
31271         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31272         return ret_conv;
31273 }
31274
31275 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
31276         LDKAcceptChannel this_ptr_conv;
31277         this_ptr_conv.inner = untag_ptr(this_ptr);
31278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31280         this_ptr_conv.is_owned = false;
31281         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31282 }
31283
31284 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
31285         LDKAcceptChannel this_ptr_conv;
31286         this_ptr_conv.inner = untag_ptr(this_ptr);
31287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31289         this_ptr_conv.is_owned = false;
31290         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31291         return ret_conv;
31292 }
31293
31294 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
31295         LDKAcceptChannel this_ptr_conv;
31296         this_ptr_conv.inner = untag_ptr(this_ptr);
31297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31299         this_ptr_conv.is_owned = false;
31300         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31301 }
31302
31303 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
31304         LDKAcceptChannel this_ptr_conv;
31305         this_ptr_conv.inner = untag_ptr(this_ptr);
31306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31308         this_ptr_conv.is_owned = false;
31309         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31310         return ret_conv;
31311 }
31312
31313 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
31314         LDKAcceptChannel this_ptr_conv;
31315         this_ptr_conv.inner = untag_ptr(this_ptr);
31316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31318         this_ptr_conv.is_owned = false;
31319         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31320 }
31321
31322 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
31323         LDKAcceptChannel this_ptr_conv;
31324         this_ptr_conv.inner = untag_ptr(this_ptr);
31325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31327         this_ptr_conv.is_owned = false;
31328         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31329         return ret_conv;
31330 }
31331
31332 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
31333         LDKAcceptChannel this_ptr_conv;
31334         this_ptr_conv.inner = untag_ptr(this_ptr);
31335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31337         this_ptr_conv.is_owned = false;
31338         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31339 }
31340
31341 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
31342         LDKAcceptChannel this_ptr_conv;
31343         this_ptr_conv.inner = untag_ptr(this_ptr);
31344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31346         this_ptr_conv.is_owned = false;
31347         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31348         return ret_conv;
31349 }
31350
31351 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t 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         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31358 }
31359
31360 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
31361         LDKAcceptChannel this_ptr_conv;
31362         this_ptr_conv.inner = untag_ptr(this_ptr);
31363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31365         this_ptr_conv.is_owned = false;
31366         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31367         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
31368         return ret_arr;
31369 }
31370
31371 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
31372         LDKAcceptChannel this_ptr_conv;
31373         this_ptr_conv.inner = untag_ptr(this_ptr);
31374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31376         this_ptr_conv.is_owned = false;
31377         LDKPublicKey val_ref;
31378         CHECK(val->arr_len == 33);
31379         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31380         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31381 }
31382
31383 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
31384         LDKAcceptChannel this_ptr_conv;
31385         this_ptr_conv.inner = untag_ptr(this_ptr);
31386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31388         this_ptr_conv.is_owned = false;
31389         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31390         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
31391         return ret_arr;
31392 }
31393
31394 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31395         LDKAcceptChannel this_ptr_conv;
31396         this_ptr_conv.inner = untag_ptr(this_ptr);
31397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31399         this_ptr_conv.is_owned = false;
31400         LDKPublicKey val_ref;
31401         CHECK(val->arr_len == 33);
31402         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31403         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31404 }
31405
31406 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
31407         LDKAcceptChannel this_ptr_conv;
31408         this_ptr_conv.inner = untag_ptr(this_ptr);
31409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31411         this_ptr_conv.is_owned = false;
31412         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31413         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31414         return ret_arr;
31415 }
31416
31417 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31418         LDKAcceptChannel this_ptr_conv;
31419         this_ptr_conv.inner = untag_ptr(this_ptr);
31420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31422         this_ptr_conv.is_owned = false;
31423         LDKPublicKey val_ref;
31424         CHECK(val->arr_len == 33);
31425         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31426         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31427 }
31428
31429 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31430         LDKAcceptChannel this_ptr_conv;
31431         this_ptr_conv.inner = untag_ptr(this_ptr);
31432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31434         this_ptr_conv.is_owned = false;
31435         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31436         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31437         return ret_arr;
31438 }
31439
31440 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31441         LDKAcceptChannel this_ptr_conv;
31442         this_ptr_conv.inner = untag_ptr(this_ptr);
31443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31445         this_ptr_conv.is_owned = false;
31446         LDKPublicKey val_ref;
31447         CHECK(val->arr_len == 33);
31448         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31449         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31450 }
31451
31452 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
31453         LDKAcceptChannel this_ptr_conv;
31454         this_ptr_conv.inner = untag_ptr(this_ptr);
31455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31457         this_ptr_conv.is_owned = false;
31458         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31459         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31460         return ret_arr;
31461 }
31462
31463 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31464         LDKAcceptChannel this_ptr_conv;
31465         this_ptr_conv.inner = untag_ptr(this_ptr);
31466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31468         this_ptr_conv.is_owned = false;
31469         LDKPublicKey val_ref;
31470         CHECK(val->arr_len == 33);
31471         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31472         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31473 }
31474
31475 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31476         LDKAcceptChannel this_ptr_conv;
31477         this_ptr_conv.inner = untag_ptr(this_ptr);
31478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31480         this_ptr_conv.is_owned = false;
31481         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31482         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31483         return ret_arr;
31484 }
31485
31486 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) {
31487         LDKAcceptChannel this_ptr_conv;
31488         this_ptr_conv.inner = untag_ptr(this_ptr);
31489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31491         this_ptr_conv.is_owned = false;
31492         LDKPublicKey val_ref;
31493         CHECK(val->arr_len == 33);
31494         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31495         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31496 }
31497
31498 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
31499         LDKAcceptChannel this_ptr_conv;
31500         this_ptr_conv.inner = untag_ptr(this_ptr);
31501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31503         this_ptr_conv.is_owned = false;
31504         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31505         uint64_t ret_ref = 0;
31506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31508         return ret_ref;
31509 }
31510
31511 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31512         LDKAcceptChannel this_ptr_conv;
31513         this_ptr_conv.inner = untag_ptr(this_ptr);
31514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31516         this_ptr_conv.is_owned = false;
31517         LDKChannelTypeFeatures val_conv;
31518         val_conv.inner = untag_ptr(val);
31519         val_conv.is_owned = ptr_is_owned(val);
31520         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31521         val_conv = ChannelTypeFeatures_clone(&val_conv);
31522         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31523 }
31524
31525 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31526         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31527         uint64_t ret_ref = 0;
31528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31530         return ret_ref;
31531 }
31532 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
31533         LDKAcceptChannel arg_conv;
31534         arg_conv.inner = untag_ptr(arg);
31535         arg_conv.is_owned = ptr_is_owned(arg);
31536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31537         arg_conv.is_owned = false;
31538         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31539         return ret_conv;
31540 }
31541
31542 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
31543         LDKAcceptChannel orig_conv;
31544         orig_conv.inner = untag_ptr(orig);
31545         orig_conv.is_owned = ptr_is_owned(orig);
31546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31547         orig_conv.is_owned = false;
31548         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31549         uint64_t ret_ref = 0;
31550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31552         return ret_ref;
31553 }
31554
31555 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
31556         LDKAcceptChannel a_conv;
31557         a_conv.inner = untag_ptr(a);
31558         a_conv.is_owned = ptr_is_owned(a);
31559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31560         a_conv.is_owned = false;
31561         LDKAcceptChannel b_conv;
31562         b_conv.inner = untag_ptr(b);
31563         b_conv.is_owned = ptr_is_owned(b);
31564         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31565         b_conv.is_owned = false;
31566         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
31567         return ret_conv;
31568 }
31569
31570 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
31571         LDKFundingCreated this_obj_conv;
31572         this_obj_conv.inner = untag_ptr(this_obj);
31573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31575         FundingCreated_free(this_obj_conv);
31576 }
31577
31578 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
31579         LDKFundingCreated this_ptr_conv;
31580         this_ptr_conv.inner = untag_ptr(this_ptr);
31581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31583         this_ptr_conv.is_owned = false;
31584         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31585         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
31586         return ret_arr;
31587 }
31588
31589 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31590         LDKFundingCreated this_ptr_conv;
31591         this_ptr_conv.inner = untag_ptr(this_ptr);
31592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31594         this_ptr_conv.is_owned = false;
31595         LDKThirtyTwoBytes val_ref;
31596         CHECK(val->arr_len == 32);
31597         memcpy(val_ref.data, val->elems, 32); FREE(val);
31598         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31599 }
31600
31601 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
31602         LDKFundingCreated this_ptr_conv;
31603         this_ptr_conv.inner = untag_ptr(this_ptr);
31604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31606         this_ptr_conv.is_owned = false;
31607         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31608         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
31609         return ret_arr;
31610 }
31611
31612 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
31613         LDKFundingCreated this_ptr_conv;
31614         this_ptr_conv.inner = untag_ptr(this_ptr);
31615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31617         this_ptr_conv.is_owned = false;
31618         LDKThirtyTwoBytes val_ref;
31619         CHECK(val->arr_len == 32);
31620         memcpy(val_ref.data, val->elems, 32); FREE(val);
31621         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31622 }
31623
31624 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
31625         LDKFundingCreated this_ptr_conv;
31626         this_ptr_conv.inner = untag_ptr(this_ptr);
31627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31629         this_ptr_conv.is_owned = false;
31630         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31631         return ret_conv;
31632 }
31633
31634 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t 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         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31641 }
31642
31643 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
31644         LDKFundingCreated this_ptr_conv;
31645         this_ptr_conv.inner = untag_ptr(this_ptr);
31646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31648         this_ptr_conv.is_owned = false;
31649         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31650         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
31651         return ret_arr;
31652 }
31653
31654 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
31655         LDKFundingCreated this_ptr_conv;
31656         this_ptr_conv.inner = untag_ptr(this_ptr);
31657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31659         this_ptr_conv.is_owned = false;
31660         LDKSignature val_ref;
31661         CHECK(val->arr_len == 64);
31662         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31663         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31664 }
31665
31666 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) {
31667         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31668         CHECK(temporary_channel_id_arg->arr_len == 32);
31669         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
31670         LDKThirtyTwoBytes funding_txid_arg_ref;
31671         CHECK(funding_txid_arg->arr_len == 32);
31672         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
31673         LDKSignature signature_arg_ref;
31674         CHECK(signature_arg->arr_len == 64);
31675         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31676         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31677         uint64_t ret_ref = 0;
31678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31680         return ret_ref;
31681 }
31682
31683 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31684         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31685         uint64_t ret_ref = 0;
31686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31688         return ret_ref;
31689 }
31690 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
31691         LDKFundingCreated arg_conv;
31692         arg_conv.inner = untag_ptr(arg);
31693         arg_conv.is_owned = ptr_is_owned(arg);
31694         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31695         arg_conv.is_owned = false;
31696         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31697         return ret_conv;
31698 }
31699
31700 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
31701         LDKFundingCreated orig_conv;
31702         orig_conv.inner = untag_ptr(orig);
31703         orig_conv.is_owned = ptr_is_owned(orig);
31704         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31705         orig_conv.is_owned = false;
31706         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31707         uint64_t ret_ref = 0;
31708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31710         return ret_ref;
31711 }
31712
31713 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
31714         LDKFundingCreated a_conv;
31715         a_conv.inner = untag_ptr(a);
31716         a_conv.is_owned = ptr_is_owned(a);
31717         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31718         a_conv.is_owned = false;
31719         LDKFundingCreated b_conv;
31720         b_conv.inner = untag_ptr(b);
31721         b_conv.is_owned = ptr_is_owned(b);
31722         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31723         b_conv.is_owned = false;
31724         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
31725         return ret_conv;
31726 }
31727
31728 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
31729         LDKFundingSigned this_obj_conv;
31730         this_obj_conv.inner = untag_ptr(this_obj);
31731         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31733         FundingSigned_free(this_obj_conv);
31734 }
31735
31736 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
31737         LDKFundingSigned this_ptr_conv;
31738         this_ptr_conv.inner = untag_ptr(this_ptr);
31739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31741         this_ptr_conv.is_owned = false;
31742         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31743         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
31744         return ret_arr;
31745 }
31746
31747 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31748         LDKFundingSigned this_ptr_conv;
31749         this_ptr_conv.inner = untag_ptr(this_ptr);
31750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31752         this_ptr_conv.is_owned = false;
31753         LDKThirtyTwoBytes val_ref;
31754         CHECK(val->arr_len == 32);
31755         memcpy(val_ref.data, val->elems, 32); FREE(val);
31756         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31757 }
31758
31759 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
31760         LDKFundingSigned this_ptr_conv;
31761         this_ptr_conv.inner = untag_ptr(this_ptr);
31762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31764         this_ptr_conv.is_owned = false;
31765         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31766         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31767         return ret_arr;
31768 }
31769
31770 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31771         LDKFundingSigned this_ptr_conv;
31772         this_ptr_conv.inner = untag_ptr(this_ptr);
31773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31775         this_ptr_conv.is_owned = false;
31776         LDKSignature val_ref;
31777         CHECK(val->arr_len == 64);
31778         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31779         FundingSigned_set_signature(&this_ptr_conv, val_ref);
31780 }
31781
31782 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
31783         LDKThirtyTwoBytes channel_id_arg_ref;
31784         CHECK(channel_id_arg->arr_len == 32);
31785         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31786         LDKSignature signature_arg_ref;
31787         CHECK(signature_arg->arr_len == 64);
31788         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31789         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31790         uint64_t ret_ref = 0;
31791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31793         return ret_ref;
31794 }
31795
31796 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31797         LDKFundingSigned ret_var = FundingSigned_clone(arg);
31798         uint64_t ret_ref = 0;
31799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31801         return ret_ref;
31802 }
31803 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
31804         LDKFundingSigned arg_conv;
31805         arg_conv.inner = untag_ptr(arg);
31806         arg_conv.is_owned = ptr_is_owned(arg);
31807         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31808         arg_conv.is_owned = false;
31809         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31810         return ret_conv;
31811 }
31812
31813 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
31814         LDKFundingSigned orig_conv;
31815         orig_conv.inner = untag_ptr(orig);
31816         orig_conv.is_owned = ptr_is_owned(orig);
31817         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31818         orig_conv.is_owned = false;
31819         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31820         uint64_t ret_ref = 0;
31821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31823         return ret_ref;
31824 }
31825
31826 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
31827         LDKFundingSigned a_conv;
31828         a_conv.inner = untag_ptr(a);
31829         a_conv.is_owned = ptr_is_owned(a);
31830         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31831         a_conv.is_owned = false;
31832         LDKFundingSigned b_conv;
31833         b_conv.inner = untag_ptr(b);
31834         b_conv.is_owned = ptr_is_owned(b);
31835         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31836         b_conv.is_owned = false;
31837         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
31838         return ret_conv;
31839 }
31840
31841 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
31842         LDKChannelReady this_obj_conv;
31843         this_obj_conv.inner = untag_ptr(this_obj);
31844         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31846         ChannelReady_free(this_obj_conv);
31847 }
31848
31849 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
31850         LDKChannelReady this_ptr_conv;
31851         this_ptr_conv.inner = untag_ptr(this_ptr);
31852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31854         this_ptr_conv.is_owned = false;
31855         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31856         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
31857         return ret_arr;
31858 }
31859
31860 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31861         LDKChannelReady this_ptr_conv;
31862         this_ptr_conv.inner = untag_ptr(this_ptr);
31863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31865         this_ptr_conv.is_owned = false;
31866         LDKThirtyTwoBytes val_ref;
31867         CHECK(val->arr_len == 32);
31868         memcpy(val_ref.data, val->elems, 32); FREE(val);
31869         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
31870 }
31871
31872 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
31873         LDKChannelReady this_ptr_conv;
31874         this_ptr_conv.inner = untag_ptr(this_ptr);
31875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31877         this_ptr_conv.is_owned = false;
31878         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31879         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31880         return ret_arr;
31881 }
31882
31883 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) {
31884         LDKChannelReady this_ptr_conv;
31885         this_ptr_conv.inner = untag_ptr(this_ptr);
31886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31888         this_ptr_conv.is_owned = false;
31889         LDKPublicKey val_ref;
31890         CHECK(val->arr_len == 33);
31891         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31892         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31893 }
31894
31895 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
31896         LDKChannelReady this_ptr_conv;
31897         this_ptr_conv.inner = untag_ptr(this_ptr);
31898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31900         this_ptr_conv.is_owned = false;
31901         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31902         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
31903         uint64_t ret_ref = tag_ptr(ret_copy, true);
31904         return ret_ref;
31905 }
31906
31907 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) {
31908         LDKChannelReady this_ptr_conv;
31909         this_ptr_conv.inner = untag_ptr(this_ptr);
31910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31912         this_ptr_conv.is_owned = false;
31913         void* val_ptr = untag_ptr(val);
31914         CHECK_ACCESS(val_ptr);
31915         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31916         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31917         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
31918 }
31919
31920 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) {
31921         LDKThirtyTwoBytes channel_id_arg_ref;
31922         CHECK(channel_id_arg->arr_len == 32);
31923         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31924         LDKPublicKey next_per_commitment_point_arg_ref;
31925         CHECK(next_per_commitment_point_arg->arr_len == 33);
31926         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
31927         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
31928         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
31929         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
31930         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
31931         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
31932         uint64_t ret_ref = 0;
31933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31935         return ret_ref;
31936 }
31937
31938 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
31939         LDKChannelReady ret_var = ChannelReady_clone(arg);
31940         uint64_t ret_ref = 0;
31941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31943         return ret_ref;
31944 }
31945 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
31946         LDKChannelReady arg_conv;
31947         arg_conv.inner = untag_ptr(arg);
31948         arg_conv.is_owned = ptr_is_owned(arg);
31949         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31950         arg_conv.is_owned = false;
31951         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
31952         return ret_conv;
31953 }
31954
31955 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
31956         LDKChannelReady orig_conv;
31957         orig_conv.inner = untag_ptr(orig);
31958         orig_conv.is_owned = ptr_is_owned(orig);
31959         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31960         orig_conv.is_owned = false;
31961         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
31962         uint64_t ret_ref = 0;
31963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31965         return ret_ref;
31966 }
31967
31968 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
31969         LDKChannelReady a_conv;
31970         a_conv.inner = untag_ptr(a);
31971         a_conv.is_owned = ptr_is_owned(a);
31972         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31973         a_conv.is_owned = false;
31974         LDKChannelReady b_conv;
31975         b_conv.inner = untag_ptr(b);
31976         b_conv.is_owned = ptr_is_owned(b);
31977         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31978         b_conv.is_owned = false;
31979         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
31980         return ret_conv;
31981 }
31982
31983 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
31984         LDKShutdown this_obj_conv;
31985         this_obj_conv.inner = untag_ptr(this_obj);
31986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31988         Shutdown_free(this_obj_conv);
31989 }
31990
31991 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
31992         LDKShutdown this_ptr_conv;
31993         this_ptr_conv.inner = untag_ptr(this_ptr);
31994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31996         this_ptr_conv.is_owned = false;
31997         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31998         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
31999         return ret_arr;
32000 }
32001
32002 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32003         LDKShutdown this_ptr_conv;
32004         this_ptr_conv.inner = untag_ptr(this_ptr);
32005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32007         this_ptr_conv.is_owned = false;
32008         LDKThirtyTwoBytes val_ref;
32009         CHECK(val->arr_len == 32);
32010         memcpy(val_ref.data, val->elems, 32); FREE(val);
32011         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
32012 }
32013
32014 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
32015         LDKShutdown this_ptr_conv;
32016         this_ptr_conv.inner = untag_ptr(this_ptr);
32017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32019         this_ptr_conv.is_owned = false;
32020         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32021         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32022         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32023         return ret_arr;
32024 }
32025
32026 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
32027         LDKShutdown this_ptr_conv;
32028         this_ptr_conv.inner = untag_ptr(this_ptr);
32029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32031         this_ptr_conv.is_owned = false;
32032         LDKCVec_u8Z val_ref;
32033         val_ref.datalen = val->arr_len;
32034         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32035         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32036         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32037 }
32038
32039 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32040         LDKThirtyTwoBytes channel_id_arg_ref;
32041         CHECK(channel_id_arg->arr_len == 32);
32042         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32043         LDKCVec_u8Z scriptpubkey_arg_ref;
32044         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
32045         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32046         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
32047         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32048         uint64_t ret_ref = 0;
32049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32051         return ret_ref;
32052 }
32053
32054 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32055         LDKShutdown ret_var = Shutdown_clone(arg);
32056         uint64_t ret_ref = 0;
32057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32059         return ret_ref;
32060 }
32061 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
32062         LDKShutdown arg_conv;
32063         arg_conv.inner = untag_ptr(arg);
32064         arg_conv.is_owned = ptr_is_owned(arg);
32065         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32066         arg_conv.is_owned = false;
32067         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32068         return ret_conv;
32069 }
32070
32071 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
32072         LDKShutdown orig_conv;
32073         orig_conv.inner = untag_ptr(orig);
32074         orig_conv.is_owned = ptr_is_owned(orig);
32075         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32076         orig_conv.is_owned = false;
32077         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32078         uint64_t ret_ref = 0;
32079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32081         return ret_ref;
32082 }
32083
32084 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
32085         LDKShutdown a_conv;
32086         a_conv.inner = untag_ptr(a);
32087         a_conv.is_owned = ptr_is_owned(a);
32088         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32089         a_conv.is_owned = false;
32090         LDKShutdown b_conv;
32091         b_conv.inner = untag_ptr(b);
32092         b_conv.is_owned = ptr_is_owned(b);
32093         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32094         b_conv.is_owned = false;
32095         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
32096         return ret_conv;
32097 }
32098
32099 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
32100         LDKClosingSignedFeeRange this_obj_conv;
32101         this_obj_conv.inner = untag_ptr(this_obj);
32102         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32104         ClosingSignedFeeRange_free(this_obj_conv);
32105 }
32106
32107 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
32108         LDKClosingSignedFeeRange this_ptr_conv;
32109         this_ptr_conv.inner = untag_ptr(this_ptr);
32110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32112         this_ptr_conv.is_owned = false;
32113         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32114         return ret_conv;
32115 }
32116
32117 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
32118         LDKClosingSignedFeeRange this_ptr_conv;
32119         this_ptr_conv.inner = untag_ptr(this_ptr);
32120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32122         this_ptr_conv.is_owned = false;
32123         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32124 }
32125
32126 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
32127         LDKClosingSignedFeeRange this_ptr_conv;
32128         this_ptr_conv.inner = untag_ptr(this_ptr);
32129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32131         this_ptr_conv.is_owned = false;
32132         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32133         return ret_conv;
32134 }
32135
32136 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
32137         LDKClosingSignedFeeRange this_ptr_conv;
32138         this_ptr_conv.inner = untag_ptr(this_ptr);
32139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32141         this_ptr_conv.is_owned = false;
32142         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32143 }
32144
32145 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
32146         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32147         uint64_t ret_ref = 0;
32148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32150         return ret_ref;
32151 }
32152
32153 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32154         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32155         uint64_t ret_ref = 0;
32156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32158         return ret_ref;
32159 }
32160 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
32161         LDKClosingSignedFeeRange arg_conv;
32162         arg_conv.inner = untag_ptr(arg);
32163         arg_conv.is_owned = ptr_is_owned(arg);
32164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32165         arg_conv.is_owned = false;
32166         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32167         return ret_conv;
32168 }
32169
32170 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
32171         LDKClosingSignedFeeRange orig_conv;
32172         orig_conv.inner = untag_ptr(orig);
32173         orig_conv.is_owned = ptr_is_owned(orig);
32174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32175         orig_conv.is_owned = false;
32176         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32177         uint64_t ret_ref = 0;
32178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32180         return ret_ref;
32181 }
32182
32183 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
32184         LDKClosingSignedFeeRange a_conv;
32185         a_conv.inner = untag_ptr(a);
32186         a_conv.is_owned = ptr_is_owned(a);
32187         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32188         a_conv.is_owned = false;
32189         LDKClosingSignedFeeRange b_conv;
32190         b_conv.inner = untag_ptr(b);
32191         b_conv.is_owned = ptr_is_owned(b);
32192         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32193         b_conv.is_owned = false;
32194         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
32195         return ret_conv;
32196 }
32197
32198 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
32199         LDKClosingSigned this_obj_conv;
32200         this_obj_conv.inner = untag_ptr(this_obj);
32201         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32203         ClosingSigned_free(this_obj_conv);
32204 }
32205
32206 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
32207         LDKClosingSigned this_ptr_conv;
32208         this_ptr_conv.inner = untag_ptr(this_ptr);
32209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32211         this_ptr_conv.is_owned = false;
32212         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32213         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
32214         return ret_arr;
32215 }
32216
32217 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32218         LDKClosingSigned this_ptr_conv;
32219         this_ptr_conv.inner = untag_ptr(this_ptr);
32220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32222         this_ptr_conv.is_owned = false;
32223         LDKThirtyTwoBytes val_ref;
32224         CHECK(val->arr_len == 32);
32225         memcpy(val_ref.data, val->elems, 32); FREE(val);
32226         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32227 }
32228
32229 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
32230         LDKClosingSigned this_ptr_conv;
32231         this_ptr_conv.inner = untag_ptr(this_ptr);
32232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32234         this_ptr_conv.is_owned = false;
32235         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32236         return ret_conv;
32237 }
32238
32239 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t 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         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32246 }
32247
32248 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
32249         LDKClosingSigned this_ptr_conv;
32250         this_ptr_conv.inner = untag_ptr(this_ptr);
32251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32253         this_ptr_conv.is_owned = false;
32254         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32255         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
32256         return ret_arr;
32257 }
32258
32259 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32260         LDKClosingSigned this_ptr_conv;
32261         this_ptr_conv.inner = untag_ptr(this_ptr);
32262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32264         this_ptr_conv.is_owned = false;
32265         LDKSignature val_ref;
32266         CHECK(val->arr_len == 64);
32267         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32268         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32269 }
32270
32271 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
32272         LDKClosingSigned this_ptr_conv;
32273         this_ptr_conv.inner = untag_ptr(this_ptr);
32274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32276         this_ptr_conv.is_owned = false;
32277         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32278         uint64_t ret_ref = 0;
32279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32281         return ret_ref;
32282 }
32283
32284 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
32285         LDKClosingSigned this_ptr_conv;
32286         this_ptr_conv.inner = untag_ptr(this_ptr);
32287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32289         this_ptr_conv.is_owned = false;
32290         LDKClosingSignedFeeRange val_conv;
32291         val_conv.inner = untag_ptr(val);
32292         val_conv.is_owned = ptr_is_owned(val);
32293         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32294         val_conv = ClosingSignedFeeRange_clone(&val_conv);
32295         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32296 }
32297
32298 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) {
32299         LDKThirtyTwoBytes channel_id_arg_ref;
32300         CHECK(channel_id_arg->arr_len == 32);
32301         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32302         LDKSignature signature_arg_ref;
32303         CHECK(signature_arg->arr_len == 64);
32304         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32305         LDKClosingSignedFeeRange fee_range_arg_conv;
32306         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
32307         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
32308         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32309         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32310         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
32311         uint64_t ret_ref = 0;
32312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32314         return ret_ref;
32315 }
32316
32317 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32318         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
32319         uint64_t ret_ref = 0;
32320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32322         return ret_ref;
32323 }
32324 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
32325         LDKClosingSigned arg_conv;
32326         arg_conv.inner = untag_ptr(arg);
32327         arg_conv.is_owned = ptr_is_owned(arg);
32328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32329         arg_conv.is_owned = false;
32330         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
32331         return ret_conv;
32332 }
32333
32334 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
32335         LDKClosingSigned orig_conv;
32336         orig_conv.inner = untag_ptr(orig);
32337         orig_conv.is_owned = ptr_is_owned(orig);
32338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32339         orig_conv.is_owned = false;
32340         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
32341         uint64_t ret_ref = 0;
32342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32344         return ret_ref;
32345 }
32346
32347 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
32348         LDKClosingSigned a_conv;
32349         a_conv.inner = untag_ptr(a);
32350         a_conv.is_owned = ptr_is_owned(a);
32351         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32352         a_conv.is_owned = false;
32353         LDKClosingSigned b_conv;
32354         b_conv.inner = untag_ptr(b);
32355         b_conv.is_owned = ptr_is_owned(b);
32356         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32357         b_conv.is_owned = false;
32358         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
32359         return ret_conv;
32360 }
32361
32362 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
32363         LDKUpdateAddHTLC this_obj_conv;
32364         this_obj_conv.inner = untag_ptr(this_obj);
32365         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32367         UpdateAddHTLC_free(this_obj_conv);
32368 }
32369
32370 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
32371         LDKUpdateAddHTLC this_ptr_conv;
32372         this_ptr_conv.inner = untag_ptr(this_ptr);
32373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32375         this_ptr_conv.is_owned = false;
32376         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32377         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
32378         return ret_arr;
32379 }
32380
32381 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32382         LDKUpdateAddHTLC this_ptr_conv;
32383         this_ptr_conv.inner = untag_ptr(this_ptr);
32384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32386         this_ptr_conv.is_owned = false;
32387         LDKThirtyTwoBytes val_ref;
32388         CHECK(val->arr_len == 32);
32389         memcpy(val_ref.data, val->elems, 32); FREE(val);
32390         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32391 }
32392
32393 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
32394         LDKUpdateAddHTLC this_ptr_conv;
32395         this_ptr_conv.inner = untag_ptr(this_ptr);
32396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32398         this_ptr_conv.is_owned = false;
32399         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32400         return ret_conv;
32401 }
32402
32403 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32404         LDKUpdateAddHTLC this_ptr_conv;
32405         this_ptr_conv.inner = untag_ptr(this_ptr);
32406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32408         this_ptr_conv.is_owned = false;
32409         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32410 }
32411
32412 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
32413         LDKUpdateAddHTLC this_ptr_conv;
32414         this_ptr_conv.inner = untag_ptr(this_ptr);
32415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32417         this_ptr_conv.is_owned = false;
32418         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32419         return ret_conv;
32420 }
32421
32422 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t 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         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32429 }
32430
32431 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
32432         LDKUpdateAddHTLC this_ptr_conv;
32433         this_ptr_conv.inner = untag_ptr(this_ptr);
32434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32436         this_ptr_conv.is_owned = false;
32437         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32438         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
32439         return ret_arr;
32440 }
32441
32442 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
32443         LDKUpdateAddHTLC this_ptr_conv;
32444         this_ptr_conv.inner = untag_ptr(this_ptr);
32445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32447         this_ptr_conv.is_owned = false;
32448         LDKThirtyTwoBytes val_ref;
32449         CHECK(val->arr_len == 32);
32450         memcpy(val_ref.data, val->elems, 32); FREE(val);
32451         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32452 }
32453
32454 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
32455         LDKUpdateAddHTLC this_ptr_conv;
32456         this_ptr_conv.inner = untag_ptr(this_ptr);
32457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32459         this_ptr_conv.is_owned = false;
32460         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32461         return ret_conv;
32462 }
32463
32464 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
32465         LDKUpdateAddHTLC this_ptr_conv;
32466         this_ptr_conv.inner = untag_ptr(this_ptr);
32467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32469         this_ptr_conv.is_owned = false;
32470         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32471 }
32472
32473 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32474         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32475         uint64_t ret_ref = 0;
32476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32478         return ret_ref;
32479 }
32480 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
32481         LDKUpdateAddHTLC arg_conv;
32482         arg_conv.inner = untag_ptr(arg);
32483         arg_conv.is_owned = ptr_is_owned(arg);
32484         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32485         arg_conv.is_owned = false;
32486         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32487         return ret_conv;
32488 }
32489
32490 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
32491         LDKUpdateAddHTLC orig_conv;
32492         orig_conv.inner = untag_ptr(orig);
32493         orig_conv.is_owned = ptr_is_owned(orig);
32494         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32495         orig_conv.is_owned = false;
32496         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32497         uint64_t ret_ref = 0;
32498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32500         return ret_ref;
32501 }
32502
32503 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
32504         LDKUpdateAddHTLC a_conv;
32505         a_conv.inner = untag_ptr(a);
32506         a_conv.is_owned = ptr_is_owned(a);
32507         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32508         a_conv.is_owned = false;
32509         LDKUpdateAddHTLC b_conv;
32510         b_conv.inner = untag_ptr(b);
32511         b_conv.is_owned = ptr_is_owned(b);
32512         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32513         b_conv.is_owned = false;
32514         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
32515         return ret_conv;
32516 }
32517
32518 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
32519         LDKOnionMessage this_obj_conv;
32520         this_obj_conv.inner = untag_ptr(this_obj);
32521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32523         OnionMessage_free(this_obj_conv);
32524 }
32525
32526 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
32527         LDKOnionMessage this_ptr_conv;
32528         this_ptr_conv.inner = untag_ptr(this_ptr);
32529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32531         this_ptr_conv.is_owned = false;
32532         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32533         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
32534         return ret_arr;
32535 }
32536
32537 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
32538         LDKOnionMessage this_ptr_conv;
32539         this_ptr_conv.inner = untag_ptr(this_ptr);
32540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32542         this_ptr_conv.is_owned = false;
32543         LDKPublicKey val_ref;
32544         CHECK(val->arr_len == 33);
32545         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32546         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
32547 }
32548
32549 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
32550         LDKOnionMessage ret_var = OnionMessage_clone(arg);
32551         uint64_t ret_ref = 0;
32552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32554         return ret_ref;
32555 }
32556 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
32557         LDKOnionMessage arg_conv;
32558         arg_conv.inner = untag_ptr(arg);
32559         arg_conv.is_owned = ptr_is_owned(arg);
32560         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32561         arg_conv.is_owned = false;
32562         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
32563         return ret_conv;
32564 }
32565
32566 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
32567         LDKOnionMessage orig_conv;
32568         orig_conv.inner = untag_ptr(orig);
32569         orig_conv.is_owned = ptr_is_owned(orig);
32570         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32571         orig_conv.is_owned = false;
32572         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
32573         uint64_t ret_ref = 0;
32574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32576         return ret_ref;
32577 }
32578
32579 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
32580         LDKOnionMessage a_conv;
32581         a_conv.inner = untag_ptr(a);
32582         a_conv.is_owned = ptr_is_owned(a);
32583         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32584         a_conv.is_owned = false;
32585         LDKOnionMessage b_conv;
32586         b_conv.inner = untag_ptr(b);
32587         b_conv.is_owned = ptr_is_owned(b);
32588         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32589         b_conv.is_owned = false;
32590         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
32591         return ret_conv;
32592 }
32593
32594 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
32595         LDKUpdateFulfillHTLC this_obj_conv;
32596         this_obj_conv.inner = untag_ptr(this_obj);
32597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32599         UpdateFulfillHTLC_free(this_obj_conv);
32600 }
32601
32602 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
32603         LDKUpdateFulfillHTLC this_ptr_conv;
32604         this_ptr_conv.inner = untag_ptr(this_ptr);
32605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32607         this_ptr_conv.is_owned = false;
32608         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32609         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
32610         return ret_arr;
32611 }
32612
32613 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32614         LDKUpdateFulfillHTLC this_ptr_conv;
32615         this_ptr_conv.inner = untag_ptr(this_ptr);
32616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32618         this_ptr_conv.is_owned = false;
32619         LDKThirtyTwoBytes val_ref;
32620         CHECK(val->arr_len == 32);
32621         memcpy(val_ref.data, val->elems, 32); FREE(val);
32622         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32623 }
32624
32625 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
32626         LDKUpdateFulfillHTLC this_ptr_conv;
32627         this_ptr_conv.inner = untag_ptr(this_ptr);
32628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32630         this_ptr_conv.is_owned = false;
32631         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32632         return ret_conv;
32633 }
32634
32635 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t 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         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32642 }
32643
32644 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
32645         LDKUpdateFulfillHTLC this_ptr_conv;
32646         this_ptr_conv.inner = untag_ptr(this_ptr);
32647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32649         this_ptr_conv.is_owned = false;
32650         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32651         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
32652         return ret_arr;
32653 }
32654
32655 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
32656         LDKUpdateFulfillHTLC this_ptr_conv;
32657         this_ptr_conv.inner = untag_ptr(this_ptr);
32658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32660         this_ptr_conv.is_owned = false;
32661         LDKThirtyTwoBytes val_ref;
32662         CHECK(val->arr_len == 32);
32663         memcpy(val_ref.data, val->elems, 32); FREE(val);
32664         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32665 }
32666
32667 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) {
32668         LDKThirtyTwoBytes channel_id_arg_ref;
32669         CHECK(channel_id_arg->arr_len == 32);
32670         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32671         LDKThirtyTwoBytes payment_preimage_arg_ref;
32672         CHECK(payment_preimage_arg->arr_len == 32);
32673         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
32674         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32675         uint64_t ret_ref = 0;
32676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32678         return ret_ref;
32679 }
32680
32681 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32682         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32683         uint64_t ret_ref = 0;
32684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32686         return ret_ref;
32687 }
32688 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
32689         LDKUpdateFulfillHTLC arg_conv;
32690         arg_conv.inner = untag_ptr(arg);
32691         arg_conv.is_owned = ptr_is_owned(arg);
32692         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32693         arg_conv.is_owned = false;
32694         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32695         return ret_conv;
32696 }
32697
32698 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
32699         LDKUpdateFulfillHTLC orig_conv;
32700         orig_conv.inner = untag_ptr(orig);
32701         orig_conv.is_owned = ptr_is_owned(orig);
32702         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32703         orig_conv.is_owned = false;
32704         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32705         uint64_t ret_ref = 0;
32706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32708         return ret_ref;
32709 }
32710
32711 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
32712         LDKUpdateFulfillHTLC a_conv;
32713         a_conv.inner = untag_ptr(a);
32714         a_conv.is_owned = ptr_is_owned(a);
32715         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32716         a_conv.is_owned = false;
32717         LDKUpdateFulfillHTLC b_conv;
32718         b_conv.inner = untag_ptr(b);
32719         b_conv.is_owned = ptr_is_owned(b);
32720         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32721         b_conv.is_owned = false;
32722         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
32723         return ret_conv;
32724 }
32725
32726 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
32727         LDKUpdateFailHTLC this_obj_conv;
32728         this_obj_conv.inner = untag_ptr(this_obj);
32729         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32731         UpdateFailHTLC_free(this_obj_conv);
32732 }
32733
32734 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
32735         LDKUpdateFailHTLC this_ptr_conv;
32736         this_ptr_conv.inner = untag_ptr(this_ptr);
32737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32739         this_ptr_conv.is_owned = false;
32740         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32741         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
32742         return ret_arr;
32743 }
32744
32745 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32746         LDKUpdateFailHTLC this_ptr_conv;
32747         this_ptr_conv.inner = untag_ptr(this_ptr);
32748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32750         this_ptr_conv.is_owned = false;
32751         LDKThirtyTwoBytes val_ref;
32752         CHECK(val->arr_len == 32);
32753         memcpy(val_ref.data, val->elems, 32); FREE(val);
32754         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32755 }
32756
32757 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
32758         LDKUpdateFailHTLC this_ptr_conv;
32759         this_ptr_conv.inner = untag_ptr(this_ptr);
32760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32762         this_ptr_conv.is_owned = false;
32763         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32764         return ret_conv;
32765 }
32766
32767 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32768         LDKUpdateFailHTLC this_ptr_conv;
32769         this_ptr_conv.inner = untag_ptr(this_ptr);
32770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32772         this_ptr_conv.is_owned = false;
32773         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32774 }
32775
32776 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32777         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32778         uint64_t ret_ref = 0;
32779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32781         return ret_ref;
32782 }
32783 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
32784         LDKUpdateFailHTLC arg_conv;
32785         arg_conv.inner = untag_ptr(arg);
32786         arg_conv.is_owned = ptr_is_owned(arg);
32787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32788         arg_conv.is_owned = false;
32789         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32790         return ret_conv;
32791 }
32792
32793 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
32794         LDKUpdateFailHTLC orig_conv;
32795         orig_conv.inner = untag_ptr(orig);
32796         orig_conv.is_owned = ptr_is_owned(orig);
32797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32798         orig_conv.is_owned = false;
32799         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32800         uint64_t ret_ref = 0;
32801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32803         return ret_ref;
32804 }
32805
32806 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
32807         LDKUpdateFailHTLC a_conv;
32808         a_conv.inner = untag_ptr(a);
32809         a_conv.is_owned = ptr_is_owned(a);
32810         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32811         a_conv.is_owned = false;
32812         LDKUpdateFailHTLC b_conv;
32813         b_conv.inner = untag_ptr(b);
32814         b_conv.is_owned = ptr_is_owned(b);
32815         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32816         b_conv.is_owned = false;
32817         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
32818         return ret_conv;
32819 }
32820
32821 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
32822         LDKUpdateFailMalformedHTLC this_obj_conv;
32823         this_obj_conv.inner = untag_ptr(this_obj);
32824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32826         UpdateFailMalformedHTLC_free(this_obj_conv);
32827 }
32828
32829 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
32830         LDKUpdateFailMalformedHTLC this_ptr_conv;
32831         this_ptr_conv.inner = untag_ptr(this_ptr);
32832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32834         this_ptr_conv.is_owned = false;
32835         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32836         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
32837         return ret_arr;
32838 }
32839
32840 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32841         LDKUpdateFailMalformedHTLC this_ptr_conv;
32842         this_ptr_conv.inner = untag_ptr(this_ptr);
32843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32845         this_ptr_conv.is_owned = false;
32846         LDKThirtyTwoBytes val_ref;
32847         CHECK(val->arr_len == 32);
32848         memcpy(val_ref.data, val->elems, 32); FREE(val);
32849         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32850 }
32851
32852 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
32853         LDKUpdateFailMalformedHTLC this_ptr_conv;
32854         this_ptr_conv.inner = untag_ptr(this_ptr);
32855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32857         this_ptr_conv.is_owned = false;
32858         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32859         return ret_conv;
32860 }
32861
32862 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32863         LDKUpdateFailMalformedHTLC this_ptr_conv;
32864         this_ptr_conv.inner = untag_ptr(this_ptr);
32865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32867         this_ptr_conv.is_owned = false;
32868         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32869 }
32870
32871 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
32872         LDKUpdateFailMalformedHTLC this_ptr_conv;
32873         this_ptr_conv.inner = untag_ptr(this_ptr);
32874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32876         this_ptr_conv.is_owned = false;
32877         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32878         return ret_conv;
32879 }
32880
32881 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
32882         LDKUpdateFailMalformedHTLC this_ptr_conv;
32883         this_ptr_conv.inner = untag_ptr(this_ptr);
32884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32886         this_ptr_conv.is_owned = false;
32887         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32888 }
32889
32890 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32891         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32892         uint64_t ret_ref = 0;
32893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32895         return ret_ref;
32896 }
32897 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
32898         LDKUpdateFailMalformedHTLC arg_conv;
32899         arg_conv.inner = untag_ptr(arg);
32900         arg_conv.is_owned = ptr_is_owned(arg);
32901         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32902         arg_conv.is_owned = false;
32903         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32904         return ret_conv;
32905 }
32906
32907 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
32908         LDKUpdateFailMalformedHTLC orig_conv;
32909         orig_conv.inner = untag_ptr(orig);
32910         orig_conv.is_owned = ptr_is_owned(orig);
32911         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32912         orig_conv.is_owned = false;
32913         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
32914         uint64_t ret_ref = 0;
32915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32917         return ret_ref;
32918 }
32919
32920 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
32921         LDKUpdateFailMalformedHTLC a_conv;
32922         a_conv.inner = untag_ptr(a);
32923         a_conv.is_owned = ptr_is_owned(a);
32924         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32925         a_conv.is_owned = false;
32926         LDKUpdateFailMalformedHTLC b_conv;
32927         b_conv.inner = untag_ptr(b);
32928         b_conv.is_owned = ptr_is_owned(b);
32929         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32930         b_conv.is_owned = false;
32931         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
32932         return ret_conv;
32933 }
32934
32935 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
32936         LDKCommitmentSigned this_obj_conv;
32937         this_obj_conv.inner = untag_ptr(this_obj);
32938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32940         CommitmentSigned_free(this_obj_conv);
32941 }
32942
32943 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
32944         LDKCommitmentSigned this_ptr_conv;
32945         this_ptr_conv.inner = untag_ptr(this_ptr);
32946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32948         this_ptr_conv.is_owned = false;
32949         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32950         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
32951         return ret_arr;
32952 }
32953
32954 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32955         LDKCommitmentSigned this_ptr_conv;
32956         this_ptr_conv.inner = untag_ptr(this_ptr);
32957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32959         this_ptr_conv.is_owned = false;
32960         LDKThirtyTwoBytes val_ref;
32961         CHECK(val->arr_len == 32);
32962         memcpy(val_ref.data, val->elems, 32); FREE(val);
32963         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
32964 }
32965
32966 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
32967         LDKCommitmentSigned this_ptr_conv;
32968         this_ptr_conv.inner = untag_ptr(this_ptr);
32969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32971         this_ptr_conv.is_owned = false;
32972         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32973         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
32974         return ret_arr;
32975 }
32976
32977 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32978         LDKCommitmentSigned this_ptr_conv;
32979         this_ptr_conv.inner = untag_ptr(this_ptr);
32980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32982         this_ptr_conv.is_owned = false;
32983         LDKSignature val_ref;
32984         CHECK(val->arr_len == 64);
32985         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32986         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
32987 }
32988
32989 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
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 ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
32996         ptrArray ret_arr = NULL;
32997         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32998         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
32999         for (size_t m = 0; m < ret_var.datalen; m++) {
33000                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
33001                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
33002                 ret_arr_ptr[m] = ret_conv_12_arr;
33003         }
33004         
33005         FREE(ret_var.data);
33006         return ret_arr;
33007 }
33008
33009 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
33010         LDKCommitmentSigned this_ptr_conv;
33011         this_ptr_conv.inner = untag_ptr(this_ptr);
33012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33014         this_ptr_conv.is_owned = false;
33015         LDKCVec_SignatureZ val_constr;
33016         val_constr.datalen = val->arr_len;
33017         if (val_constr.datalen > 0)
33018                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33019         else
33020                 val_constr.data = NULL;
33021         int8_tArray* val_vals = (void*) val->elems;
33022         for (size_t m = 0; m < val_constr.datalen; m++) {
33023                 int8_tArray val_conv_12 = val_vals[m];
33024                 LDKSignature val_conv_12_ref;
33025                 CHECK(val_conv_12->arr_len == 64);
33026                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
33027                 val_constr.data[m] = val_conv_12_ref;
33028         }
33029         FREE(val);
33030         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33031 }
33032
33033 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
33034         LDKThirtyTwoBytes channel_id_arg_ref;
33035         CHECK(channel_id_arg->arr_len == 32);
33036         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33037         LDKSignature signature_arg_ref;
33038         CHECK(signature_arg->arr_len == 64);
33039         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33040         LDKCVec_SignatureZ htlc_signatures_arg_constr;
33041         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
33042         if (htlc_signatures_arg_constr.datalen > 0)
33043                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33044         else
33045                 htlc_signatures_arg_constr.data = NULL;
33046         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
33047         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
33048                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
33049                 LDKSignature htlc_signatures_arg_conv_12_ref;
33050                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
33051                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
33052                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
33053         }
33054         FREE(htlc_signatures_arg);
33055         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33056         uint64_t ret_ref = 0;
33057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33059         return ret_ref;
33060 }
33061
33062 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33063         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33064         uint64_t ret_ref = 0;
33065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33067         return ret_ref;
33068 }
33069 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
33070         LDKCommitmentSigned arg_conv;
33071         arg_conv.inner = untag_ptr(arg);
33072         arg_conv.is_owned = ptr_is_owned(arg);
33073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33074         arg_conv.is_owned = false;
33075         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33076         return ret_conv;
33077 }
33078
33079 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
33080         LDKCommitmentSigned orig_conv;
33081         orig_conv.inner = untag_ptr(orig);
33082         orig_conv.is_owned = ptr_is_owned(orig);
33083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33084         orig_conv.is_owned = false;
33085         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33086         uint64_t ret_ref = 0;
33087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33089         return ret_ref;
33090 }
33091
33092 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
33093         LDKCommitmentSigned a_conv;
33094         a_conv.inner = untag_ptr(a);
33095         a_conv.is_owned = ptr_is_owned(a);
33096         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33097         a_conv.is_owned = false;
33098         LDKCommitmentSigned b_conv;
33099         b_conv.inner = untag_ptr(b);
33100         b_conv.is_owned = ptr_is_owned(b);
33101         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33102         b_conv.is_owned = false;
33103         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
33104         return ret_conv;
33105 }
33106
33107 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
33108         LDKRevokeAndACK this_obj_conv;
33109         this_obj_conv.inner = untag_ptr(this_obj);
33110         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33112         RevokeAndACK_free(this_obj_conv);
33113 }
33114
33115 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
33116         LDKRevokeAndACK this_ptr_conv;
33117         this_ptr_conv.inner = untag_ptr(this_ptr);
33118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33120         this_ptr_conv.is_owned = false;
33121         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33122         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
33123         return ret_arr;
33124 }
33125
33126 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33127         LDKRevokeAndACK this_ptr_conv;
33128         this_ptr_conv.inner = untag_ptr(this_ptr);
33129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33131         this_ptr_conv.is_owned = false;
33132         LDKThirtyTwoBytes val_ref;
33133         CHECK(val->arr_len == 32);
33134         memcpy(val_ref.data, val->elems, 32); FREE(val);
33135         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33136 }
33137
33138 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
33139         LDKRevokeAndACK this_ptr_conv;
33140         this_ptr_conv.inner = untag_ptr(this_ptr);
33141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33143         this_ptr_conv.is_owned = false;
33144         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33145         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
33146         return ret_arr;
33147 }
33148
33149 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
33150         LDKRevokeAndACK this_ptr_conv;
33151         this_ptr_conv.inner = untag_ptr(this_ptr);
33152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33154         this_ptr_conv.is_owned = false;
33155         LDKThirtyTwoBytes val_ref;
33156         CHECK(val->arr_len == 32);
33157         memcpy(val_ref.data, val->elems, 32); FREE(val);
33158         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33159 }
33160
33161 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
33162         LDKRevokeAndACK this_ptr_conv;
33163         this_ptr_conv.inner = untag_ptr(this_ptr);
33164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33166         this_ptr_conv.is_owned = false;
33167         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33168         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33169         return ret_arr;
33170 }
33171
33172 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) {
33173         LDKRevokeAndACK this_ptr_conv;
33174         this_ptr_conv.inner = untag_ptr(this_ptr);
33175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33177         this_ptr_conv.is_owned = false;
33178         LDKPublicKey val_ref;
33179         CHECK(val->arr_len == 33);
33180         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33181         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33182 }
33183
33184 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) {
33185         LDKThirtyTwoBytes channel_id_arg_ref;
33186         CHECK(channel_id_arg->arr_len == 32);
33187         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33188         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33189         CHECK(per_commitment_secret_arg->arr_len == 32);
33190         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
33191         LDKPublicKey next_per_commitment_point_arg_ref;
33192         CHECK(next_per_commitment_point_arg->arr_len == 33);
33193         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
33194         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33195         uint64_t ret_ref = 0;
33196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33198         return ret_ref;
33199 }
33200
33201 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33202         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33203         uint64_t ret_ref = 0;
33204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33206         return ret_ref;
33207 }
33208 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
33209         LDKRevokeAndACK arg_conv;
33210         arg_conv.inner = untag_ptr(arg);
33211         arg_conv.is_owned = ptr_is_owned(arg);
33212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33213         arg_conv.is_owned = false;
33214         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33215         return ret_conv;
33216 }
33217
33218 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
33219         LDKRevokeAndACK orig_conv;
33220         orig_conv.inner = untag_ptr(orig);
33221         orig_conv.is_owned = ptr_is_owned(orig);
33222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33223         orig_conv.is_owned = false;
33224         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33225         uint64_t ret_ref = 0;
33226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33228         return ret_ref;
33229 }
33230
33231 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
33232         LDKRevokeAndACK a_conv;
33233         a_conv.inner = untag_ptr(a);
33234         a_conv.is_owned = ptr_is_owned(a);
33235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33236         a_conv.is_owned = false;
33237         LDKRevokeAndACK b_conv;
33238         b_conv.inner = untag_ptr(b);
33239         b_conv.is_owned = ptr_is_owned(b);
33240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33241         b_conv.is_owned = false;
33242         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
33243         return ret_conv;
33244 }
33245
33246 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
33247         LDKUpdateFee this_obj_conv;
33248         this_obj_conv.inner = untag_ptr(this_obj);
33249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33251         UpdateFee_free(this_obj_conv);
33252 }
33253
33254 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
33255         LDKUpdateFee this_ptr_conv;
33256         this_ptr_conv.inner = untag_ptr(this_ptr);
33257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33259         this_ptr_conv.is_owned = false;
33260         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33261         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
33262         return ret_arr;
33263 }
33264
33265 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33266         LDKUpdateFee this_ptr_conv;
33267         this_ptr_conv.inner = untag_ptr(this_ptr);
33268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33270         this_ptr_conv.is_owned = false;
33271         LDKThirtyTwoBytes val_ref;
33272         CHECK(val->arr_len == 32);
33273         memcpy(val_ref.data, val->elems, 32); FREE(val);
33274         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33275 }
33276
33277 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
33278         LDKUpdateFee this_ptr_conv;
33279         this_ptr_conv.inner = untag_ptr(this_ptr);
33280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33282         this_ptr_conv.is_owned = false;
33283         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33284         return ret_conv;
33285 }
33286
33287 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
33288         LDKUpdateFee this_ptr_conv;
33289         this_ptr_conv.inner = untag_ptr(this_ptr);
33290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33292         this_ptr_conv.is_owned = false;
33293         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33294 }
33295
33296 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
33297         LDKThirtyTwoBytes channel_id_arg_ref;
33298         CHECK(channel_id_arg->arr_len == 32);
33299         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33300         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33301         uint64_t ret_ref = 0;
33302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33304         return ret_ref;
33305 }
33306
33307 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33308         LDKUpdateFee ret_var = UpdateFee_clone(arg);
33309         uint64_t ret_ref = 0;
33310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33312         return ret_ref;
33313 }
33314 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
33315         LDKUpdateFee arg_conv;
33316         arg_conv.inner = untag_ptr(arg);
33317         arg_conv.is_owned = ptr_is_owned(arg);
33318         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33319         arg_conv.is_owned = false;
33320         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33321         return ret_conv;
33322 }
33323
33324 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
33325         LDKUpdateFee orig_conv;
33326         orig_conv.inner = untag_ptr(orig);
33327         orig_conv.is_owned = ptr_is_owned(orig);
33328         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33329         orig_conv.is_owned = false;
33330         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33331         uint64_t ret_ref = 0;
33332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33334         return ret_ref;
33335 }
33336
33337 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
33338         LDKUpdateFee a_conv;
33339         a_conv.inner = untag_ptr(a);
33340         a_conv.is_owned = ptr_is_owned(a);
33341         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33342         a_conv.is_owned = false;
33343         LDKUpdateFee b_conv;
33344         b_conv.inner = untag_ptr(b);
33345         b_conv.is_owned = ptr_is_owned(b);
33346         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33347         b_conv.is_owned = false;
33348         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
33349         return ret_conv;
33350 }
33351
33352 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
33353         LDKDataLossProtect this_obj_conv;
33354         this_obj_conv.inner = untag_ptr(this_obj);
33355         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33357         DataLossProtect_free(this_obj_conv);
33358 }
33359
33360 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) {
33361         LDKDataLossProtect this_ptr_conv;
33362         this_ptr_conv.inner = untag_ptr(this_ptr);
33363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33365         this_ptr_conv.is_owned = false;
33366         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33367         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
33368         return ret_arr;
33369 }
33370
33371 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) {
33372         LDKDataLossProtect this_ptr_conv;
33373         this_ptr_conv.inner = untag_ptr(this_ptr);
33374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33376         this_ptr_conv.is_owned = false;
33377         LDKThirtyTwoBytes val_ref;
33378         CHECK(val->arr_len == 32);
33379         memcpy(val_ref.data, val->elems, 32); FREE(val);
33380         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33381 }
33382
33383 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) {
33384         LDKDataLossProtect this_ptr_conv;
33385         this_ptr_conv.inner = untag_ptr(this_ptr);
33386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33388         this_ptr_conv.is_owned = false;
33389         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33390         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33391         return ret_arr;
33392 }
33393
33394 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) {
33395         LDKDataLossProtect this_ptr_conv;
33396         this_ptr_conv.inner = untag_ptr(this_ptr);
33397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33399         this_ptr_conv.is_owned = false;
33400         LDKPublicKey val_ref;
33401         CHECK(val->arr_len == 33);
33402         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33403         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33404 }
33405
33406 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) {
33407         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33408         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
33409         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
33410         LDKPublicKey my_current_per_commitment_point_arg_ref;
33411         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
33412         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);
33413         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33414         uint64_t ret_ref = 0;
33415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33417         return ret_ref;
33418 }
33419
33420 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33421         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33422         uint64_t ret_ref = 0;
33423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33425         return ret_ref;
33426 }
33427 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
33428         LDKDataLossProtect arg_conv;
33429         arg_conv.inner = untag_ptr(arg);
33430         arg_conv.is_owned = ptr_is_owned(arg);
33431         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33432         arg_conv.is_owned = false;
33433         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33434         return ret_conv;
33435 }
33436
33437 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
33438         LDKDataLossProtect orig_conv;
33439         orig_conv.inner = untag_ptr(orig);
33440         orig_conv.is_owned = ptr_is_owned(orig);
33441         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33442         orig_conv.is_owned = false;
33443         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33444         uint64_t ret_ref = 0;
33445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33447         return ret_ref;
33448 }
33449
33450 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
33451         LDKDataLossProtect a_conv;
33452         a_conv.inner = untag_ptr(a);
33453         a_conv.is_owned = ptr_is_owned(a);
33454         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33455         a_conv.is_owned = false;
33456         LDKDataLossProtect b_conv;
33457         b_conv.inner = untag_ptr(b);
33458         b_conv.is_owned = ptr_is_owned(b);
33459         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33460         b_conv.is_owned = false;
33461         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
33462         return ret_conv;
33463 }
33464
33465 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
33466         LDKChannelReestablish this_obj_conv;
33467         this_obj_conv.inner = untag_ptr(this_obj);
33468         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33470         ChannelReestablish_free(this_obj_conv);
33471 }
33472
33473 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
33474         LDKChannelReestablish this_ptr_conv;
33475         this_ptr_conv.inner = untag_ptr(this_ptr);
33476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33478         this_ptr_conv.is_owned = false;
33479         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33480         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
33481         return ret_arr;
33482 }
33483
33484 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33485         LDKChannelReestablish this_ptr_conv;
33486         this_ptr_conv.inner = untag_ptr(this_ptr);
33487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33489         this_ptr_conv.is_owned = false;
33490         LDKThirtyTwoBytes val_ref;
33491         CHECK(val->arr_len == 32);
33492         memcpy(val_ref.data, val->elems, 32); FREE(val);
33493         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33494 }
33495
33496 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
33497         LDKChannelReestablish this_ptr_conv;
33498         this_ptr_conv.inner = untag_ptr(this_ptr);
33499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33501         this_ptr_conv.is_owned = false;
33502         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33503         return ret_conv;
33504 }
33505
33506 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) {
33507         LDKChannelReestablish this_ptr_conv;
33508         this_ptr_conv.inner = untag_ptr(this_ptr);
33509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33511         this_ptr_conv.is_owned = false;
33512         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33513 }
33514
33515 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
33516         LDKChannelReestablish this_ptr_conv;
33517         this_ptr_conv.inner = untag_ptr(this_ptr);
33518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33520         this_ptr_conv.is_owned = false;
33521         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33522         return ret_conv;
33523 }
33524
33525 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) {
33526         LDKChannelReestablish this_ptr_conv;
33527         this_ptr_conv.inner = untag_ptr(this_ptr);
33528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33530         this_ptr_conv.is_owned = false;
33531         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33532 }
33533
33534 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33535         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33536         uint64_t ret_ref = 0;
33537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33539         return ret_ref;
33540 }
33541 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
33542         LDKChannelReestablish arg_conv;
33543         arg_conv.inner = untag_ptr(arg);
33544         arg_conv.is_owned = ptr_is_owned(arg);
33545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33546         arg_conv.is_owned = false;
33547         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33548         return ret_conv;
33549 }
33550
33551 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
33552         LDKChannelReestablish orig_conv;
33553         orig_conv.inner = untag_ptr(orig);
33554         orig_conv.is_owned = ptr_is_owned(orig);
33555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33556         orig_conv.is_owned = false;
33557         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33558         uint64_t ret_ref = 0;
33559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33561         return ret_ref;
33562 }
33563
33564 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
33565         LDKChannelReestablish a_conv;
33566         a_conv.inner = untag_ptr(a);
33567         a_conv.is_owned = ptr_is_owned(a);
33568         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33569         a_conv.is_owned = false;
33570         LDKChannelReestablish b_conv;
33571         b_conv.inner = untag_ptr(b);
33572         b_conv.is_owned = ptr_is_owned(b);
33573         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33574         b_conv.is_owned = false;
33575         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
33576         return ret_conv;
33577 }
33578
33579 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
33580         LDKAnnouncementSignatures this_obj_conv;
33581         this_obj_conv.inner = untag_ptr(this_obj);
33582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33584         AnnouncementSignatures_free(this_obj_conv);
33585 }
33586
33587 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
33588         LDKAnnouncementSignatures this_ptr_conv;
33589         this_ptr_conv.inner = untag_ptr(this_ptr);
33590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33592         this_ptr_conv.is_owned = false;
33593         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33594         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
33595         return ret_arr;
33596 }
33597
33598 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33599         LDKAnnouncementSignatures this_ptr_conv;
33600         this_ptr_conv.inner = untag_ptr(this_ptr);
33601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33603         this_ptr_conv.is_owned = false;
33604         LDKThirtyTwoBytes val_ref;
33605         CHECK(val->arr_len == 32);
33606         memcpy(val_ref.data, val->elems, 32); FREE(val);
33607         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33608 }
33609
33610 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
33611         LDKAnnouncementSignatures this_ptr_conv;
33612         this_ptr_conv.inner = untag_ptr(this_ptr);
33613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33615         this_ptr_conv.is_owned = false;
33616         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33617         return ret_conv;
33618 }
33619
33620 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t 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         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33627 }
33628
33629 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
33630         LDKAnnouncementSignatures this_ptr_conv;
33631         this_ptr_conv.inner = untag_ptr(this_ptr);
33632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33634         this_ptr_conv.is_owned = false;
33635         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33636         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
33637         return ret_arr;
33638 }
33639
33640 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
33641         LDKAnnouncementSignatures this_ptr_conv;
33642         this_ptr_conv.inner = untag_ptr(this_ptr);
33643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33645         this_ptr_conv.is_owned = false;
33646         LDKSignature val_ref;
33647         CHECK(val->arr_len == 64);
33648         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33649         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33650 }
33651
33652 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
33653         LDKAnnouncementSignatures this_ptr_conv;
33654         this_ptr_conv.inner = untag_ptr(this_ptr);
33655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33657         this_ptr_conv.is_owned = false;
33658         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33659         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
33660         return ret_arr;
33661 }
33662
33663 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
33664         LDKAnnouncementSignatures this_ptr_conv;
33665         this_ptr_conv.inner = untag_ptr(this_ptr);
33666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33668         this_ptr_conv.is_owned = false;
33669         LDKSignature val_ref;
33670         CHECK(val->arr_len == 64);
33671         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33672         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33673 }
33674
33675 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) {
33676         LDKThirtyTwoBytes channel_id_arg_ref;
33677         CHECK(channel_id_arg->arr_len == 32);
33678         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33679         LDKSignature node_signature_arg_ref;
33680         CHECK(node_signature_arg->arr_len == 64);
33681         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
33682         LDKSignature bitcoin_signature_arg_ref;
33683         CHECK(bitcoin_signature_arg->arr_len == 64);
33684         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
33685         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33686         uint64_t ret_ref = 0;
33687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33689         return ret_ref;
33690 }
33691
33692 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33693         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33694         uint64_t ret_ref = 0;
33695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33697         return ret_ref;
33698 }
33699 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
33700         LDKAnnouncementSignatures arg_conv;
33701         arg_conv.inner = untag_ptr(arg);
33702         arg_conv.is_owned = ptr_is_owned(arg);
33703         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33704         arg_conv.is_owned = false;
33705         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33706         return ret_conv;
33707 }
33708
33709 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
33710         LDKAnnouncementSignatures orig_conv;
33711         orig_conv.inner = untag_ptr(orig);
33712         orig_conv.is_owned = ptr_is_owned(orig);
33713         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33714         orig_conv.is_owned = false;
33715         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33716         uint64_t ret_ref = 0;
33717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33719         return ret_ref;
33720 }
33721
33722 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
33723         LDKAnnouncementSignatures a_conv;
33724         a_conv.inner = untag_ptr(a);
33725         a_conv.is_owned = ptr_is_owned(a);
33726         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33727         a_conv.is_owned = false;
33728         LDKAnnouncementSignatures b_conv;
33729         b_conv.inner = untag_ptr(b);
33730         b_conv.is_owned = ptr_is_owned(b);
33731         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33732         b_conv.is_owned = false;
33733         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
33734         return ret_conv;
33735 }
33736
33737 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
33738         if (!ptr_is_owned(this_ptr)) return;
33739         void* this_ptr_ptr = untag_ptr(this_ptr);
33740         CHECK_ACCESS(this_ptr_ptr);
33741         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33742         FREE(untag_ptr(this_ptr));
33743         NetAddress_free(this_ptr_conv);
33744 }
33745
33746 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33747         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33748         *ret_copy = NetAddress_clone(arg);
33749         uint64_t ret_ref = tag_ptr(ret_copy, true);
33750         return ret_ref;
33751 }
33752 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
33753         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33754         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33755         return ret_conv;
33756 }
33757
33758 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
33759         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33760         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33761         *ret_copy = NetAddress_clone(orig_conv);
33762         uint64_t ret_ref = tag_ptr(ret_copy, true);
33763         return ret_ref;
33764 }
33765
33766 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
33767         LDKFourBytes addr_ref;
33768         CHECK(addr->arr_len == 4);
33769         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
33770         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33771         *ret_copy = NetAddress_ipv4(addr_ref, port);
33772         uint64_t ret_ref = tag_ptr(ret_copy, true);
33773         return ret_ref;
33774 }
33775
33776 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
33777         LDKSixteenBytes addr_ref;
33778         CHECK(addr->arr_len == 16);
33779         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
33780         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33781         *ret_copy = NetAddress_ipv6(addr_ref, 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_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
33787         LDKTwelveBytes a_ref;
33788         CHECK(a->arr_len == 12);
33789         memcpy(a_ref.data, a->elems, 12); FREE(a);
33790         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33791         *ret_copy = NetAddress_onion_v2(a_ref);
33792         uint64_t ret_ref = tag_ptr(ret_copy, true);
33793         return ret_ref;
33794 }
33795
33796 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) {
33797         LDKThirtyTwoBytes ed25519_pubkey_ref;
33798         CHECK(ed25519_pubkey->arr_len == 32);
33799         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
33800         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33801         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33802         uint64_t ret_ref = tag_ptr(ret_copy, true);
33803         return ret_ref;
33804 }
33805
33806 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
33807         LDKHostname hostname_conv;
33808         hostname_conv.inner = untag_ptr(hostname);
33809         hostname_conv.is_owned = ptr_is_owned(hostname);
33810         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33811         hostname_conv = Hostname_clone(&hostname_conv);
33812         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33813         *ret_copy = NetAddress_hostname(hostname_conv, port);
33814         uint64_t ret_ref = tag_ptr(ret_copy, true);
33815         return ret_ref;
33816 }
33817
33818 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
33819         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
33820         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
33821         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
33822         return ret_conv;
33823 }
33824
33825 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
33826         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33827         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33828         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33829         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33830         CVec_u8Z_free(ret_var);
33831         return ret_arr;
33832 }
33833
33834 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
33835         LDKu8slice ser_ref;
33836         ser_ref.datalen = ser->arr_len;
33837         ser_ref.data = ser->elems;
33838         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33839         *ret_conv = NetAddress_read(ser_ref);
33840         FREE(ser);
33841         return tag_ptr(ret_conv, true);
33842 }
33843
33844 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
33845         if (!ptr_is_owned(this_ptr)) return;
33846         void* this_ptr_ptr = untag_ptr(this_ptr);
33847         CHECK_ACCESS(this_ptr_ptr);
33848         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
33849         FREE(untag_ptr(this_ptr));
33850         UnsignedGossipMessage_free(this_ptr_conv);
33851 }
33852
33853 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
33854         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33855         *ret_copy = UnsignedGossipMessage_clone(arg);
33856         uint64_t ret_ref = tag_ptr(ret_copy, true);
33857         return ret_ref;
33858 }
33859 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
33860         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
33861         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
33862         return ret_conv;
33863 }
33864
33865 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
33866         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
33867         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33868         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
33869         uint64_t ret_ref = tag_ptr(ret_copy, true);
33870         return ret_ref;
33871 }
33872
33873 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
33874         LDKUnsignedChannelAnnouncement a_conv;
33875         a_conv.inner = untag_ptr(a);
33876         a_conv.is_owned = ptr_is_owned(a);
33877         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33878         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
33879         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33880         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
33881         uint64_t ret_ref = tag_ptr(ret_copy, true);
33882         return ret_ref;
33883 }
33884
33885 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
33886         LDKUnsignedChannelUpdate a_conv;
33887         a_conv.inner = untag_ptr(a);
33888         a_conv.is_owned = ptr_is_owned(a);
33889         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33890         a_conv = UnsignedChannelUpdate_clone(&a_conv);
33891         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33892         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
33893         uint64_t ret_ref = tag_ptr(ret_copy, true);
33894         return ret_ref;
33895 }
33896
33897 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
33898         LDKUnsignedNodeAnnouncement a_conv;
33899         a_conv.inner = untag_ptr(a);
33900         a_conv.is_owned = ptr_is_owned(a);
33901         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33902         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
33903         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33904         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
33905         uint64_t ret_ref = tag_ptr(ret_copy, true);
33906         return ret_ref;
33907 }
33908
33909 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
33910         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
33911         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
33912         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33913         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33914         CVec_u8Z_free(ret_var);
33915         return ret_arr;
33916 }
33917
33918 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
33919         LDKUnsignedNodeAnnouncement this_obj_conv;
33920         this_obj_conv.inner = untag_ptr(this_obj);
33921         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33923         UnsignedNodeAnnouncement_free(this_obj_conv);
33924 }
33925
33926 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
33927         LDKUnsignedNodeAnnouncement this_ptr_conv;
33928         this_ptr_conv.inner = untag_ptr(this_ptr);
33929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33931         this_ptr_conv.is_owned = false;
33932         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33933         uint64_t ret_ref = 0;
33934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33936         return ret_ref;
33937 }
33938
33939 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
33940         LDKUnsignedNodeAnnouncement this_ptr_conv;
33941         this_ptr_conv.inner = untag_ptr(this_ptr);
33942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33944         this_ptr_conv.is_owned = false;
33945         LDKNodeFeatures val_conv;
33946         val_conv.inner = untag_ptr(val);
33947         val_conv.is_owned = ptr_is_owned(val);
33948         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33949         val_conv = NodeFeatures_clone(&val_conv);
33950         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33951 }
33952
33953 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
33954         LDKUnsignedNodeAnnouncement this_ptr_conv;
33955         this_ptr_conv.inner = untag_ptr(this_ptr);
33956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33958         this_ptr_conv.is_owned = false;
33959         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33960         return ret_conv;
33961 }
33962
33963 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
33964         LDKUnsignedNodeAnnouncement this_ptr_conv;
33965         this_ptr_conv.inner = untag_ptr(this_ptr);
33966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33968         this_ptr_conv.is_owned = false;
33969         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33970 }
33971
33972 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
33973         LDKUnsignedNodeAnnouncement this_ptr_conv;
33974         this_ptr_conv.inner = untag_ptr(this_ptr);
33975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33977         this_ptr_conv.is_owned = false;
33978         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
33979         uint64_t ret_ref = 0;
33980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33982         return ret_ref;
33983 }
33984
33985 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
33986         LDKUnsignedNodeAnnouncement this_ptr_conv;
33987         this_ptr_conv.inner = untag_ptr(this_ptr);
33988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33990         this_ptr_conv.is_owned = false;
33991         LDKNodeId val_conv;
33992         val_conv.inner = untag_ptr(val);
33993         val_conv.is_owned = ptr_is_owned(val);
33994         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33995         val_conv = NodeId_clone(&val_conv);
33996         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
33997 }
33998
33999 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
34000         LDKUnsignedNodeAnnouncement this_ptr_conv;
34001         this_ptr_conv.inner = untag_ptr(this_ptr);
34002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34004         this_ptr_conv.is_owned = false;
34005         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
34006         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
34007         return ret_arr;
34008 }
34009
34010 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
34011         LDKUnsignedNodeAnnouncement this_ptr_conv;
34012         this_ptr_conv.inner = untag_ptr(this_ptr);
34013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34015         this_ptr_conv.is_owned = false;
34016         LDKThreeBytes val_ref;
34017         CHECK(val->arr_len == 3);
34018         memcpy(val_ref.data, val->elems, 3); FREE(val);
34019         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
34020 }
34021
34022 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
34023         LDKUnsignedNodeAnnouncement this_ptr_conv;
34024         this_ptr_conv.inner = untag_ptr(this_ptr);
34025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34027         this_ptr_conv.is_owned = false;
34028         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
34029         uint64_t ret_ref = 0;
34030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34032         return ret_ref;
34033 }
34034
34035 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
34036         LDKUnsignedNodeAnnouncement this_ptr_conv;
34037         this_ptr_conv.inner = untag_ptr(this_ptr);
34038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34040         this_ptr_conv.is_owned = false;
34041         LDKNodeAlias val_conv;
34042         val_conv.inner = untag_ptr(val);
34043         val_conv.is_owned = ptr_is_owned(val);
34044         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34045         val_conv = NodeAlias_clone(&val_conv);
34046         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
34047 }
34048
34049 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
34050         LDKUnsignedNodeAnnouncement this_ptr_conv;
34051         this_ptr_conv.inner = untag_ptr(this_ptr);
34052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34054         this_ptr_conv.is_owned = false;
34055         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
34056         uint64_tArray ret_arr = NULL;
34057         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34058         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34059         for (size_t m = 0; m < ret_var.datalen; m++) {
34060                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34061                 *ret_conv_12_copy = ret_var.data[m];
34062                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
34063                 ret_arr_ptr[m] = ret_conv_12_ref;
34064         }
34065         
34066         FREE(ret_var.data);
34067         return ret_arr;
34068 }
34069
34070 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
34071         LDKUnsignedNodeAnnouncement this_ptr_conv;
34072         this_ptr_conv.inner = untag_ptr(this_ptr);
34073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34075         this_ptr_conv.is_owned = false;
34076         LDKCVec_NetAddressZ val_constr;
34077         val_constr.datalen = val->arr_len;
34078         if (val_constr.datalen > 0)
34079                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
34080         else
34081                 val_constr.data = NULL;
34082         uint64_t* val_vals = val->elems;
34083         for (size_t m = 0; m < val_constr.datalen; m++) {
34084                 uint64_t val_conv_12 = val_vals[m];
34085                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
34086                 CHECK_ACCESS(val_conv_12_ptr);
34087                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
34088                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
34089                 val_constr.data[m] = val_conv_12_conv;
34090         }
34091         FREE(val);
34092         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
34093 }
34094
34095 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
34096         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
34097         uint64_t ret_ref = 0;
34098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34100         return ret_ref;
34101 }
34102 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
34103         LDKUnsignedNodeAnnouncement arg_conv;
34104         arg_conv.inner = untag_ptr(arg);
34105         arg_conv.is_owned = ptr_is_owned(arg);
34106         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34107         arg_conv.is_owned = false;
34108         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
34109         return ret_conv;
34110 }
34111
34112 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
34113         LDKUnsignedNodeAnnouncement orig_conv;
34114         orig_conv.inner = untag_ptr(orig);
34115         orig_conv.is_owned = ptr_is_owned(orig);
34116         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34117         orig_conv.is_owned = false;
34118         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34119         uint64_t ret_ref = 0;
34120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34122         return ret_ref;
34123 }
34124
34125 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
34126         LDKUnsignedNodeAnnouncement a_conv;
34127         a_conv.inner = untag_ptr(a);
34128         a_conv.is_owned = ptr_is_owned(a);
34129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34130         a_conv.is_owned = false;
34131         LDKUnsignedNodeAnnouncement b_conv;
34132         b_conv.inner = untag_ptr(b);
34133         b_conv.is_owned = ptr_is_owned(b);
34134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34135         b_conv.is_owned = false;
34136         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
34137         return ret_conv;
34138 }
34139
34140 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
34141         LDKNodeAnnouncement this_obj_conv;
34142         this_obj_conv.inner = untag_ptr(this_obj);
34143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34145         NodeAnnouncement_free(this_obj_conv);
34146 }
34147
34148 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
34149         LDKNodeAnnouncement this_ptr_conv;
34150         this_ptr_conv.inner = untag_ptr(this_ptr);
34151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34153         this_ptr_conv.is_owned = false;
34154         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34155         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
34156         return ret_arr;
34157 }
34158
34159 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
34160         LDKNodeAnnouncement this_ptr_conv;
34161         this_ptr_conv.inner = untag_ptr(this_ptr);
34162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34164         this_ptr_conv.is_owned = false;
34165         LDKSignature val_ref;
34166         CHECK(val->arr_len == 64);
34167         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34168         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34169 }
34170
34171 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
34172         LDKNodeAnnouncement this_ptr_conv;
34173         this_ptr_conv.inner = untag_ptr(this_ptr);
34174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34176         this_ptr_conv.is_owned = false;
34177         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34178         uint64_t ret_ref = 0;
34179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34181         return ret_ref;
34182 }
34183
34184 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34185         LDKNodeAnnouncement this_ptr_conv;
34186         this_ptr_conv.inner = untag_ptr(this_ptr);
34187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34189         this_ptr_conv.is_owned = false;
34190         LDKUnsignedNodeAnnouncement val_conv;
34191         val_conv.inner = untag_ptr(val);
34192         val_conv.is_owned = ptr_is_owned(val);
34193         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34194         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34195         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34196 }
34197
34198 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
34199         LDKSignature signature_arg_ref;
34200         CHECK(signature_arg->arr_len == 64);
34201         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34202         LDKUnsignedNodeAnnouncement contents_arg_conv;
34203         contents_arg_conv.inner = untag_ptr(contents_arg);
34204         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34205         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34206         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34207         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34208         uint64_t ret_ref = 0;
34209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34211         return ret_ref;
34212 }
34213
34214 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34215         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34216         uint64_t ret_ref = 0;
34217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34219         return ret_ref;
34220 }
34221 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
34222         LDKNodeAnnouncement arg_conv;
34223         arg_conv.inner = untag_ptr(arg);
34224         arg_conv.is_owned = ptr_is_owned(arg);
34225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34226         arg_conv.is_owned = false;
34227         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34228         return ret_conv;
34229 }
34230
34231 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
34232         LDKNodeAnnouncement orig_conv;
34233         orig_conv.inner = untag_ptr(orig);
34234         orig_conv.is_owned = ptr_is_owned(orig);
34235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34236         orig_conv.is_owned = false;
34237         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34238         uint64_t ret_ref = 0;
34239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34241         return ret_ref;
34242 }
34243
34244 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
34245         LDKNodeAnnouncement a_conv;
34246         a_conv.inner = untag_ptr(a);
34247         a_conv.is_owned = ptr_is_owned(a);
34248         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34249         a_conv.is_owned = false;
34250         LDKNodeAnnouncement b_conv;
34251         b_conv.inner = untag_ptr(b);
34252         b_conv.is_owned = ptr_is_owned(b);
34253         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34254         b_conv.is_owned = false;
34255         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
34256         return ret_conv;
34257 }
34258
34259 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
34260         LDKUnsignedChannelAnnouncement this_obj_conv;
34261         this_obj_conv.inner = untag_ptr(this_obj);
34262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34264         UnsignedChannelAnnouncement_free(this_obj_conv);
34265 }
34266
34267 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
34268         LDKUnsignedChannelAnnouncement this_ptr_conv;
34269         this_ptr_conv.inner = untag_ptr(this_ptr);
34270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34272         this_ptr_conv.is_owned = false;
34273         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34274         uint64_t ret_ref = 0;
34275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34277         return ret_ref;
34278 }
34279
34280 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
34281         LDKUnsignedChannelAnnouncement this_ptr_conv;
34282         this_ptr_conv.inner = untag_ptr(this_ptr);
34283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34285         this_ptr_conv.is_owned = false;
34286         LDKChannelFeatures val_conv;
34287         val_conv.inner = untag_ptr(val);
34288         val_conv.is_owned = ptr_is_owned(val);
34289         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34290         val_conv = ChannelFeatures_clone(&val_conv);
34291         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34292 }
34293
34294 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
34295         LDKUnsignedChannelAnnouncement this_ptr_conv;
34296         this_ptr_conv.inner = untag_ptr(this_ptr);
34297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34299         this_ptr_conv.is_owned = false;
34300         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34301         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
34302         return ret_arr;
34303 }
34304
34305 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34306         LDKUnsignedChannelAnnouncement this_ptr_conv;
34307         this_ptr_conv.inner = untag_ptr(this_ptr);
34308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34310         this_ptr_conv.is_owned = false;
34311         LDKThirtyTwoBytes val_ref;
34312         CHECK(val->arr_len == 32);
34313         memcpy(val_ref.data, val->elems, 32); FREE(val);
34314         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34315 }
34316
34317 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
34318         LDKUnsignedChannelAnnouncement this_ptr_conv;
34319         this_ptr_conv.inner = untag_ptr(this_ptr);
34320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34322         this_ptr_conv.is_owned = false;
34323         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34324         return ret_conv;
34325 }
34326
34327 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34328         LDKUnsignedChannelAnnouncement this_ptr_conv;
34329         this_ptr_conv.inner = untag_ptr(this_ptr);
34330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34332         this_ptr_conv.is_owned = false;
34333         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34334 }
34335
34336 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
34337         LDKUnsignedChannelAnnouncement this_ptr_conv;
34338         this_ptr_conv.inner = untag_ptr(this_ptr);
34339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34341         this_ptr_conv.is_owned = false;
34342         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
34343         uint64_t ret_ref = 0;
34344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34346         return ret_ref;
34347 }
34348
34349 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
34350         LDKUnsignedChannelAnnouncement this_ptr_conv;
34351         this_ptr_conv.inner = untag_ptr(this_ptr);
34352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34354         this_ptr_conv.is_owned = false;
34355         LDKNodeId val_conv;
34356         val_conv.inner = untag_ptr(val);
34357         val_conv.is_owned = ptr_is_owned(val);
34358         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34359         val_conv = NodeId_clone(&val_conv);
34360         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
34361 }
34362
34363 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
34364         LDKUnsignedChannelAnnouncement this_ptr_conv;
34365         this_ptr_conv.inner = untag_ptr(this_ptr);
34366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34368         this_ptr_conv.is_owned = false;
34369         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
34370         uint64_t ret_ref = 0;
34371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34373         return ret_ref;
34374 }
34375
34376 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
34377         LDKUnsignedChannelAnnouncement this_ptr_conv;
34378         this_ptr_conv.inner = untag_ptr(this_ptr);
34379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34381         this_ptr_conv.is_owned = false;
34382         LDKNodeId val_conv;
34383         val_conv.inner = untag_ptr(val);
34384         val_conv.is_owned = ptr_is_owned(val);
34385         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34386         val_conv = NodeId_clone(&val_conv);
34387         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
34388 }
34389
34390 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
34391         LDKUnsignedChannelAnnouncement this_ptr_conv;
34392         this_ptr_conv.inner = untag_ptr(this_ptr);
34393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34395         this_ptr_conv.is_owned = false;
34396         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
34397         uint64_t ret_ref = 0;
34398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34400         return ret_ref;
34401 }
34402
34403 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
34404         LDKUnsignedChannelAnnouncement this_ptr_conv;
34405         this_ptr_conv.inner = untag_ptr(this_ptr);
34406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34408         this_ptr_conv.is_owned = false;
34409         LDKNodeId val_conv;
34410         val_conv.inner = untag_ptr(val);
34411         val_conv.is_owned = ptr_is_owned(val);
34412         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34413         val_conv = NodeId_clone(&val_conv);
34414         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
34415 }
34416
34417 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
34418         LDKUnsignedChannelAnnouncement this_ptr_conv;
34419         this_ptr_conv.inner = untag_ptr(this_ptr);
34420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34422         this_ptr_conv.is_owned = false;
34423         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
34424         uint64_t ret_ref = 0;
34425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34427         return ret_ref;
34428 }
34429
34430 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
34431         LDKUnsignedChannelAnnouncement this_ptr_conv;
34432         this_ptr_conv.inner = untag_ptr(this_ptr);
34433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34435         this_ptr_conv.is_owned = false;
34436         LDKNodeId val_conv;
34437         val_conv.inner = untag_ptr(val);
34438         val_conv.is_owned = ptr_is_owned(val);
34439         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34440         val_conv = NodeId_clone(&val_conv);
34441         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
34442 }
34443
34444 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34445         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34446         uint64_t ret_ref = 0;
34447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34449         return ret_ref;
34450 }
34451 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
34452         LDKUnsignedChannelAnnouncement arg_conv;
34453         arg_conv.inner = untag_ptr(arg);
34454         arg_conv.is_owned = ptr_is_owned(arg);
34455         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34456         arg_conv.is_owned = false;
34457         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34458         return ret_conv;
34459 }
34460
34461 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
34462         LDKUnsignedChannelAnnouncement orig_conv;
34463         orig_conv.inner = untag_ptr(orig);
34464         orig_conv.is_owned = ptr_is_owned(orig);
34465         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34466         orig_conv.is_owned = false;
34467         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34468         uint64_t ret_ref = 0;
34469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34471         return ret_ref;
34472 }
34473
34474 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34475         LDKUnsignedChannelAnnouncement a_conv;
34476         a_conv.inner = untag_ptr(a);
34477         a_conv.is_owned = ptr_is_owned(a);
34478         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34479         a_conv.is_owned = false;
34480         LDKUnsignedChannelAnnouncement b_conv;
34481         b_conv.inner = untag_ptr(b);
34482         b_conv.is_owned = ptr_is_owned(b);
34483         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34484         b_conv.is_owned = false;
34485         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
34486         return ret_conv;
34487 }
34488
34489 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
34490         LDKChannelAnnouncement this_obj_conv;
34491         this_obj_conv.inner = untag_ptr(this_obj);
34492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34494         ChannelAnnouncement_free(this_obj_conv);
34495 }
34496
34497 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
34498         LDKChannelAnnouncement this_ptr_conv;
34499         this_ptr_conv.inner = untag_ptr(this_ptr);
34500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34502         this_ptr_conv.is_owned = false;
34503         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34504         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
34505         return ret_arr;
34506 }
34507
34508 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
34509         LDKChannelAnnouncement this_ptr_conv;
34510         this_ptr_conv.inner = untag_ptr(this_ptr);
34511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34513         this_ptr_conv.is_owned = false;
34514         LDKSignature val_ref;
34515         CHECK(val->arr_len == 64);
34516         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34517         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34518 }
34519
34520 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
34521         LDKChannelAnnouncement this_ptr_conv;
34522         this_ptr_conv.inner = untag_ptr(this_ptr);
34523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34525         this_ptr_conv.is_owned = false;
34526         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34527         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
34528         return ret_arr;
34529 }
34530
34531 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
34532         LDKChannelAnnouncement this_ptr_conv;
34533         this_ptr_conv.inner = untag_ptr(this_ptr);
34534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34536         this_ptr_conv.is_owned = false;
34537         LDKSignature val_ref;
34538         CHECK(val->arr_len == 64);
34539         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34540         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34541 }
34542
34543 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
34544         LDKChannelAnnouncement this_ptr_conv;
34545         this_ptr_conv.inner = untag_ptr(this_ptr);
34546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34548         this_ptr_conv.is_owned = false;
34549         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34550         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
34551         return ret_arr;
34552 }
34553
34554 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
34555         LDKChannelAnnouncement this_ptr_conv;
34556         this_ptr_conv.inner = untag_ptr(this_ptr);
34557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34559         this_ptr_conv.is_owned = false;
34560         LDKSignature val_ref;
34561         CHECK(val->arr_len == 64);
34562         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34563         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34564 }
34565
34566 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
34567         LDKChannelAnnouncement this_ptr_conv;
34568         this_ptr_conv.inner = untag_ptr(this_ptr);
34569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34571         this_ptr_conv.is_owned = false;
34572         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34573         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
34574         return ret_arr;
34575 }
34576
34577 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
34578         LDKChannelAnnouncement this_ptr_conv;
34579         this_ptr_conv.inner = untag_ptr(this_ptr);
34580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34582         this_ptr_conv.is_owned = false;
34583         LDKSignature val_ref;
34584         CHECK(val->arr_len == 64);
34585         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34586         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34587 }
34588
34589 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
34590         LDKChannelAnnouncement this_ptr_conv;
34591         this_ptr_conv.inner = untag_ptr(this_ptr);
34592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34594         this_ptr_conv.is_owned = false;
34595         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34596         uint64_t ret_ref = 0;
34597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34599         return ret_ref;
34600 }
34601
34602 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34603         LDKChannelAnnouncement this_ptr_conv;
34604         this_ptr_conv.inner = untag_ptr(this_ptr);
34605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34607         this_ptr_conv.is_owned = false;
34608         LDKUnsignedChannelAnnouncement val_conv;
34609         val_conv.inner = untag_ptr(val);
34610         val_conv.is_owned = ptr_is_owned(val);
34611         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34612         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34613         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34614 }
34615
34616 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) {
34617         LDKSignature node_signature_1_arg_ref;
34618         CHECK(node_signature_1_arg->arr_len == 64);
34619         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
34620         LDKSignature node_signature_2_arg_ref;
34621         CHECK(node_signature_2_arg->arr_len == 64);
34622         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
34623         LDKSignature bitcoin_signature_1_arg_ref;
34624         CHECK(bitcoin_signature_1_arg->arr_len == 64);
34625         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
34626         LDKSignature bitcoin_signature_2_arg_ref;
34627         CHECK(bitcoin_signature_2_arg->arr_len == 64);
34628         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
34629         LDKUnsignedChannelAnnouncement contents_arg_conv;
34630         contents_arg_conv.inner = untag_ptr(contents_arg);
34631         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34632         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34633         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34634         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);
34635         uint64_t ret_ref = 0;
34636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34638         return ret_ref;
34639 }
34640
34641 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34642         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34643         uint64_t ret_ref = 0;
34644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34646         return ret_ref;
34647 }
34648 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
34649         LDKChannelAnnouncement arg_conv;
34650         arg_conv.inner = untag_ptr(arg);
34651         arg_conv.is_owned = ptr_is_owned(arg);
34652         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34653         arg_conv.is_owned = false;
34654         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34655         return ret_conv;
34656 }
34657
34658 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
34659         LDKChannelAnnouncement orig_conv;
34660         orig_conv.inner = untag_ptr(orig);
34661         orig_conv.is_owned = ptr_is_owned(orig);
34662         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34663         orig_conv.is_owned = false;
34664         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34665         uint64_t ret_ref = 0;
34666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34668         return ret_ref;
34669 }
34670
34671 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34672         LDKChannelAnnouncement a_conv;
34673         a_conv.inner = untag_ptr(a);
34674         a_conv.is_owned = ptr_is_owned(a);
34675         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34676         a_conv.is_owned = false;
34677         LDKChannelAnnouncement b_conv;
34678         b_conv.inner = untag_ptr(b);
34679         b_conv.is_owned = ptr_is_owned(b);
34680         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34681         b_conv.is_owned = false;
34682         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
34683         return ret_conv;
34684 }
34685
34686 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
34687         LDKUnsignedChannelUpdate this_obj_conv;
34688         this_obj_conv.inner = untag_ptr(this_obj);
34689         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34691         UnsignedChannelUpdate_free(this_obj_conv);
34692 }
34693
34694 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
34695         LDKUnsignedChannelUpdate this_ptr_conv;
34696         this_ptr_conv.inner = untag_ptr(this_ptr);
34697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34699         this_ptr_conv.is_owned = false;
34700         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34701         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
34702         return ret_arr;
34703 }
34704
34705 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34706         LDKUnsignedChannelUpdate this_ptr_conv;
34707         this_ptr_conv.inner = untag_ptr(this_ptr);
34708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34710         this_ptr_conv.is_owned = false;
34711         LDKThirtyTwoBytes val_ref;
34712         CHECK(val->arr_len == 32);
34713         memcpy(val_ref.data, val->elems, 32); FREE(val);
34714         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34715 }
34716
34717 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
34718         LDKUnsignedChannelUpdate this_ptr_conv;
34719         this_ptr_conv.inner = untag_ptr(this_ptr);
34720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34722         this_ptr_conv.is_owned = false;
34723         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34724         return ret_conv;
34725 }
34726
34727 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34728         LDKUnsignedChannelUpdate this_ptr_conv;
34729         this_ptr_conv.inner = untag_ptr(this_ptr);
34730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34732         this_ptr_conv.is_owned = false;
34733         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34734 }
34735
34736 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
34737         LDKUnsignedChannelUpdate this_ptr_conv;
34738         this_ptr_conv.inner = untag_ptr(this_ptr);
34739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34741         this_ptr_conv.is_owned = false;
34742         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34743         return ret_conv;
34744 }
34745
34746 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
34747         LDKUnsignedChannelUpdate this_ptr_conv;
34748         this_ptr_conv.inner = untag_ptr(this_ptr);
34749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34751         this_ptr_conv.is_owned = false;
34752         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34753 }
34754
34755 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
34756         LDKUnsignedChannelUpdate this_ptr_conv;
34757         this_ptr_conv.inner = untag_ptr(this_ptr);
34758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34760         this_ptr_conv.is_owned = false;
34761         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34762         return ret_conv;
34763 }
34764
34765 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
34766         LDKUnsignedChannelUpdate this_ptr_conv;
34767         this_ptr_conv.inner = untag_ptr(this_ptr);
34768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34770         this_ptr_conv.is_owned = false;
34771         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34772 }
34773
34774 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
34775         LDKUnsignedChannelUpdate this_ptr_conv;
34776         this_ptr_conv.inner = untag_ptr(this_ptr);
34777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34779         this_ptr_conv.is_owned = false;
34780         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34781         return ret_conv;
34782 }
34783
34784 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
34785         LDKUnsignedChannelUpdate this_ptr_conv;
34786         this_ptr_conv.inner = untag_ptr(this_ptr);
34787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34789         this_ptr_conv.is_owned = false;
34790         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34791 }
34792
34793 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
34794         LDKUnsignedChannelUpdate this_ptr_conv;
34795         this_ptr_conv.inner = untag_ptr(this_ptr);
34796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34798         this_ptr_conv.is_owned = false;
34799         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34800         return ret_conv;
34801 }
34802
34803 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34804         LDKUnsignedChannelUpdate this_ptr_conv;
34805         this_ptr_conv.inner = untag_ptr(this_ptr);
34806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34808         this_ptr_conv.is_owned = false;
34809         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34810 }
34811
34812 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
34813         LDKUnsignedChannelUpdate this_ptr_conv;
34814         this_ptr_conv.inner = untag_ptr(this_ptr);
34815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34817         this_ptr_conv.is_owned = false;
34818         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34819         return ret_conv;
34820 }
34821
34822 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
34823         LDKUnsignedChannelUpdate this_ptr_conv;
34824         this_ptr_conv.inner = untag_ptr(this_ptr);
34825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34827         this_ptr_conv.is_owned = false;
34828         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34829 }
34830
34831 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
34832         LDKUnsignedChannelUpdate this_ptr_conv;
34833         this_ptr_conv.inner = untag_ptr(this_ptr);
34834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34836         this_ptr_conv.is_owned = false;
34837         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34838         return ret_conv;
34839 }
34840
34841 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
34842         LDKUnsignedChannelUpdate this_ptr_conv;
34843         this_ptr_conv.inner = untag_ptr(this_ptr);
34844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34846         this_ptr_conv.is_owned = false;
34847         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34848 }
34849
34850 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
34851         LDKUnsignedChannelUpdate this_ptr_conv;
34852         this_ptr_conv.inner = untag_ptr(this_ptr);
34853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34855         this_ptr_conv.is_owned = false;
34856         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34857         return ret_conv;
34858 }
34859
34860 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
34861         LDKUnsignedChannelUpdate this_ptr_conv;
34862         this_ptr_conv.inner = untag_ptr(this_ptr);
34863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34865         this_ptr_conv.is_owned = false;
34866         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34867 }
34868
34869 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
34870         LDKUnsignedChannelUpdate this_ptr_conv;
34871         this_ptr_conv.inner = untag_ptr(this_ptr);
34872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34874         this_ptr_conv.is_owned = false;
34875         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34876         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34877         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34878         CVec_u8Z_free(ret_var);
34879         return ret_arr;
34880 }
34881
34882 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
34883         LDKUnsignedChannelUpdate this_ptr_conv;
34884         this_ptr_conv.inner = untag_ptr(this_ptr);
34885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34887         this_ptr_conv.is_owned = false;
34888         LDKCVec_u8Z val_ref;
34889         val_ref.datalen = val->arr_len;
34890         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34891         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34892         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34893 }
34894
34895 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) {
34896         LDKThirtyTwoBytes chain_hash_arg_ref;
34897         CHECK(chain_hash_arg->arr_len == 32);
34898         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34899         LDKCVec_u8Z excess_data_arg_ref;
34900         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
34901         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34902         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
34903         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);
34904         uint64_t ret_ref = 0;
34905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34907         return ret_ref;
34908 }
34909
34910 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34911         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34912         uint64_t ret_ref = 0;
34913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34915         return ret_ref;
34916 }
34917 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
34918         LDKUnsignedChannelUpdate arg_conv;
34919         arg_conv.inner = untag_ptr(arg);
34920         arg_conv.is_owned = ptr_is_owned(arg);
34921         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34922         arg_conv.is_owned = false;
34923         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34924         return ret_conv;
34925 }
34926
34927 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
34928         LDKUnsignedChannelUpdate orig_conv;
34929         orig_conv.inner = untag_ptr(orig);
34930         orig_conv.is_owned = ptr_is_owned(orig);
34931         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34932         orig_conv.is_owned = false;
34933         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34934         uint64_t ret_ref = 0;
34935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34937         return ret_ref;
34938 }
34939
34940 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
34941         LDKUnsignedChannelUpdate a_conv;
34942         a_conv.inner = untag_ptr(a);
34943         a_conv.is_owned = ptr_is_owned(a);
34944         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34945         a_conv.is_owned = false;
34946         LDKUnsignedChannelUpdate b_conv;
34947         b_conv.inner = untag_ptr(b);
34948         b_conv.is_owned = ptr_is_owned(b);
34949         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34950         b_conv.is_owned = false;
34951         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
34952         return ret_conv;
34953 }
34954
34955 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
34956         LDKChannelUpdate this_obj_conv;
34957         this_obj_conv.inner = untag_ptr(this_obj);
34958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34960         ChannelUpdate_free(this_obj_conv);
34961 }
34962
34963 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
34964         LDKChannelUpdate this_ptr_conv;
34965         this_ptr_conv.inner = untag_ptr(this_ptr);
34966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34968         this_ptr_conv.is_owned = false;
34969         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34970         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
34971         return ret_arr;
34972 }
34973
34974 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
34975         LDKChannelUpdate this_ptr_conv;
34976         this_ptr_conv.inner = untag_ptr(this_ptr);
34977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34979         this_ptr_conv.is_owned = false;
34980         LDKSignature val_ref;
34981         CHECK(val->arr_len == 64);
34982         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34983         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34984 }
34985
34986 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
34987         LDKChannelUpdate this_ptr_conv;
34988         this_ptr_conv.inner = untag_ptr(this_ptr);
34989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34991         this_ptr_conv.is_owned = false;
34992         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34993         uint64_t ret_ref = 0;
34994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34996         return ret_ref;
34997 }
34998
34999 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
35000         LDKChannelUpdate this_ptr_conv;
35001         this_ptr_conv.inner = untag_ptr(this_ptr);
35002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35004         this_ptr_conv.is_owned = false;
35005         LDKUnsignedChannelUpdate val_conv;
35006         val_conv.inner = untag_ptr(val);
35007         val_conv.is_owned = ptr_is_owned(val);
35008         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35009         val_conv = UnsignedChannelUpdate_clone(&val_conv);
35010         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
35011 }
35012
35013 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
35014         LDKSignature signature_arg_ref;
35015         CHECK(signature_arg->arr_len == 64);
35016         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
35017         LDKUnsignedChannelUpdate contents_arg_conv;
35018         contents_arg_conv.inner = untag_ptr(contents_arg);
35019         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
35020         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35021         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
35022         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
35023         uint64_t ret_ref = 0;
35024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35026         return ret_ref;
35027 }
35028
35029 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
35030         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
35031         uint64_t ret_ref = 0;
35032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35034         return ret_ref;
35035 }
35036 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
35037         LDKChannelUpdate arg_conv;
35038         arg_conv.inner = untag_ptr(arg);
35039         arg_conv.is_owned = ptr_is_owned(arg);
35040         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35041         arg_conv.is_owned = false;
35042         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
35043         return ret_conv;
35044 }
35045
35046 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
35047         LDKChannelUpdate orig_conv;
35048         orig_conv.inner = untag_ptr(orig);
35049         orig_conv.is_owned = ptr_is_owned(orig);
35050         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35051         orig_conv.is_owned = false;
35052         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
35053         uint64_t ret_ref = 0;
35054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35056         return ret_ref;
35057 }
35058
35059 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
35060         LDKChannelUpdate a_conv;
35061         a_conv.inner = untag_ptr(a);
35062         a_conv.is_owned = ptr_is_owned(a);
35063         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35064         a_conv.is_owned = false;
35065         LDKChannelUpdate b_conv;
35066         b_conv.inner = untag_ptr(b);
35067         b_conv.is_owned = ptr_is_owned(b);
35068         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35069         b_conv.is_owned = false;
35070         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
35071         return ret_conv;
35072 }
35073
35074 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
35075         LDKQueryChannelRange this_obj_conv;
35076         this_obj_conv.inner = untag_ptr(this_obj);
35077         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35079         QueryChannelRange_free(this_obj_conv);
35080 }
35081
35082 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
35083         LDKQueryChannelRange this_ptr_conv;
35084         this_ptr_conv.inner = untag_ptr(this_ptr);
35085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35087         this_ptr_conv.is_owned = false;
35088         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35089         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
35090         return ret_arr;
35091 }
35092
35093 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35094         LDKQueryChannelRange this_ptr_conv;
35095         this_ptr_conv.inner = untag_ptr(this_ptr);
35096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35098         this_ptr_conv.is_owned = false;
35099         LDKThirtyTwoBytes val_ref;
35100         CHECK(val->arr_len == 32);
35101         memcpy(val_ref.data, val->elems, 32); FREE(val);
35102         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35103 }
35104
35105 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
35106         LDKQueryChannelRange this_ptr_conv;
35107         this_ptr_conv.inner = untag_ptr(this_ptr);
35108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35110         this_ptr_conv.is_owned = false;
35111         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
35112         return ret_conv;
35113 }
35114
35115 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35116         LDKQueryChannelRange this_ptr_conv;
35117         this_ptr_conv.inner = untag_ptr(this_ptr);
35118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35120         this_ptr_conv.is_owned = false;
35121         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
35122 }
35123
35124 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35125         LDKQueryChannelRange this_ptr_conv;
35126         this_ptr_conv.inner = untag_ptr(this_ptr);
35127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35129         this_ptr_conv.is_owned = false;
35130         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
35131         return ret_conv;
35132 }
35133
35134 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35135         LDKQueryChannelRange this_ptr_conv;
35136         this_ptr_conv.inner = untag_ptr(this_ptr);
35137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35139         this_ptr_conv.is_owned = false;
35140         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35141 }
35142
35143 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) {
35144         LDKThirtyTwoBytes chain_hash_arg_ref;
35145         CHECK(chain_hash_arg->arr_len == 32);
35146         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35147         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
35148         uint64_t ret_ref = 0;
35149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35151         return ret_ref;
35152 }
35153
35154 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
35155         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
35156         uint64_t ret_ref = 0;
35157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35159         return ret_ref;
35160 }
35161 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
35162         LDKQueryChannelRange arg_conv;
35163         arg_conv.inner = untag_ptr(arg);
35164         arg_conv.is_owned = ptr_is_owned(arg);
35165         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35166         arg_conv.is_owned = false;
35167         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
35168         return ret_conv;
35169 }
35170
35171 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
35172         LDKQueryChannelRange orig_conv;
35173         orig_conv.inner = untag_ptr(orig);
35174         orig_conv.is_owned = ptr_is_owned(orig);
35175         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35176         orig_conv.is_owned = false;
35177         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
35178         uint64_t ret_ref = 0;
35179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35181         return ret_ref;
35182 }
35183
35184 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
35185         LDKQueryChannelRange a_conv;
35186         a_conv.inner = untag_ptr(a);
35187         a_conv.is_owned = ptr_is_owned(a);
35188         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35189         a_conv.is_owned = false;
35190         LDKQueryChannelRange b_conv;
35191         b_conv.inner = untag_ptr(b);
35192         b_conv.is_owned = ptr_is_owned(b);
35193         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35194         b_conv.is_owned = false;
35195         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
35196         return ret_conv;
35197 }
35198
35199 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
35200         LDKReplyChannelRange this_obj_conv;
35201         this_obj_conv.inner = untag_ptr(this_obj);
35202         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35204         ReplyChannelRange_free(this_obj_conv);
35205 }
35206
35207 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
35208         LDKReplyChannelRange this_ptr_conv;
35209         this_ptr_conv.inner = untag_ptr(this_ptr);
35210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35212         this_ptr_conv.is_owned = false;
35213         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35214         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
35215         return ret_arr;
35216 }
35217
35218 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35219         LDKReplyChannelRange this_ptr_conv;
35220         this_ptr_conv.inner = untag_ptr(this_ptr);
35221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35223         this_ptr_conv.is_owned = false;
35224         LDKThirtyTwoBytes val_ref;
35225         CHECK(val->arr_len == 32);
35226         memcpy(val_ref.data, val->elems, 32); FREE(val);
35227         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35228 }
35229
35230 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
35231         LDKReplyChannelRange this_ptr_conv;
35232         this_ptr_conv.inner = untag_ptr(this_ptr);
35233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35235         this_ptr_conv.is_owned = false;
35236         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35237         return ret_conv;
35238 }
35239
35240 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35241         LDKReplyChannelRange this_ptr_conv;
35242         this_ptr_conv.inner = untag_ptr(this_ptr);
35243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35245         this_ptr_conv.is_owned = false;
35246         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35247 }
35248
35249 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35250         LDKReplyChannelRange this_ptr_conv;
35251         this_ptr_conv.inner = untag_ptr(this_ptr);
35252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35254         this_ptr_conv.is_owned = false;
35255         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35256         return ret_conv;
35257 }
35258
35259 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35260         LDKReplyChannelRange this_ptr_conv;
35261         this_ptr_conv.inner = untag_ptr(this_ptr);
35262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35264         this_ptr_conv.is_owned = false;
35265         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35266 }
35267
35268 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
35269         LDKReplyChannelRange this_ptr_conv;
35270         this_ptr_conv.inner = untag_ptr(this_ptr);
35271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35273         this_ptr_conv.is_owned = false;
35274         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35275         return ret_conv;
35276 }
35277
35278 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
35279         LDKReplyChannelRange this_ptr_conv;
35280         this_ptr_conv.inner = untag_ptr(this_ptr);
35281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35283         this_ptr_conv.is_owned = false;
35284         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35285 }
35286
35287 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
35288         LDKReplyChannelRange this_ptr_conv;
35289         this_ptr_conv.inner = untag_ptr(this_ptr);
35290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35292         this_ptr_conv.is_owned = false;
35293         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
35294         int64_tArray ret_arr = NULL;
35295         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35296         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35297         for (size_t i = 0; i < ret_var.datalen; i++) {
35298                 int64_t ret_conv_8_conv = ret_var.data[i];
35299                 ret_arr_ptr[i] = ret_conv_8_conv;
35300         }
35301         
35302         FREE(ret_var.data);
35303         return ret_arr;
35304 }
35305
35306 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35307         LDKReplyChannelRange this_ptr_conv;
35308         this_ptr_conv.inner = untag_ptr(this_ptr);
35309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35311         this_ptr_conv.is_owned = false;
35312         LDKCVec_u64Z val_constr;
35313         val_constr.datalen = val->arr_len;
35314         if (val_constr.datalen > 0)
35315                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35316         else
35317                 val_constr.data = NULL;
35318         int64_t* val_vals = val->elems;
35319         for (size_t i = 0; i < val_constr.datalen; i++) {
35320                 int64_t val_conv_8 = val_vals[i];
35321                 val_constr.data[i] = val_conv_8;
35322         }
35323         FREE(val);
35324         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35325 }
35326
35327 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) {
35328         LDKThirtyTwoBytes chain_hash_arg_ref;
35329         CHECK(chain_hash_arg->arr_len == 32);
35330         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35331         LDKCVec_u64Z short_channel_ids_arg_constr;
35332         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35333         if (short_channel_ids_arg_constr.datalen > 0)
35334                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35335         else
35336                 short_channel_ids_arg_constr.data = NULL;
35337         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35338         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35339                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35340                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35341         }
35342         FREE(short_channel_ids_arg);
35343         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35344         uint64_t ret_ref = 0;
35345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35347         return ret_ref;
35348 }
35349
35350 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35351         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35352         uint64_t ret_ref = 0;
35353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35355         return ret_ref;
35356 }
35357 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
35358         LDKReplyChannelRange arg_conv;
35359         arg_conv.inner = untag_ptr(arg);
35360         arg_conv.is_owned = ptr_is_owned(arg);
35361         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35362         arg_conv.is_owned = false;
35363         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35364         return ret_conv;
35365 }
35366
35367 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
35368         LDKReplyChannelRange orig_conv;
35369         orig_conv.inner = untag_ptr(orig);
35370         orig_conv.is_owned = ptr_is_owned(orig);
35371         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35372         orig_conv.is_owned = false;
35373         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35374         uint64_t ret_ref = 0;
35375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35377         return ret_ref;
35378 }
35379
35380 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
35381         LDKReplyChannelRange a_conv;
35382         a_conv.inner = untag_ptr(a);
35383         a_conv.is_owned = ptr_is_owned(a);
35384         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35385         a_conv.is_owned = false;
35386         LDKReplyChannelRange b_conv;
35387         b_conv.inner = untag_ptr(b);
35388         b_conv.is_owned = ptr_is_owned(b);
35389         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35390         b_conv.is_owned = false;
35391         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
35392         return ret_conv;
35393 }
35394
35395 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
35396         LDKQueryShortChannelIds this_obj_conv;
35397         this_obj_conv.inner = untag_ptr(this_obj);
35398         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35400         QueryShortChannelIds_free(this_obj_conv);
35401 }
35402
35403 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
35404         LDKQueryShortChannelIds this_ptr_conv;
35405         this_ptr_conv.inner = untag_ptr(this_ptr);
35406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35408         this_ptr_conv.is_owned = false;
35409         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35410         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
35411         return ret_arr;
35412 }
35413
35414 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35415         LDKQueryShortChannelIds this_ptr_conv;
35416         this_ptr_conv.inner = untag_ptr(this_ptr);
35417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35419         this_ptr_conv.is_owned = false;
35420         LDKThirtyTwoBytes val_ref;
35421         CHECK(val->arr_len == 32);
35422         memcpy(val_ref.data, val->elems, 32); FREE(val);
35423         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35424 }
35425
35426 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
35427         LDKQueryShortChannelIds this_ptr_conv;
35428         this_ptr_conv.inner = untag_ptr(this_ptr);
35429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35431         this_ptr_conv.is_owned = false;
35432         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
35433         int64_tArray ret_arr = NULL;
35434         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35435         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35436         for (size_t i = 0; i < ret_var.datalen; i++) {
35437                 int64_t ret_conv_8_conv = ret_var.data[i];
35438                 ret_arr_ptr[i] = ret_conv_8_conv;
35439         }
35440         
35441         FREE(ret_var.data);
35442         return ret_arr;
35443 }
35444
35445 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35446         LDKQueryShortChannelIds this_ptr_conv;
35447         this_ptr_conv.inner = untag_ptr(this_ptr);
35448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35450         this_ptr_conv.is_owned = false;
35451         LDKCVec_u64Z val_constr;
35452         val_constr.datalen = val->arr_len;
35453         if (val_constr.datalen > 0)
35454                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35455         else
35456                 val_constr.data = NULL;
35457         int64_t* val_vals = val->elems;
35458         for (size_t i = 0; i < val_constr.datalen; i++) {
35459                 int64_t val_conv_8 = val_vals[i];
35460                 val_constr.data[i] = val_conv_8;
35461         }
35462         FREE(val);
35463         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35464 }
35465
35466 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
35467         LDKThirtyTwoBytes chain_hash_arg_ref;
35468         CHECK(chain_hash_arg->arr_len == 32);
35469         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35470         LDKCVec_u64Z short_channel_ids_arg_constr;
35471         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35472         if (short_channel_ids_arg_constr.datalen > 0)
35473                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35474         else
35475                 short_channel_ids_arg_constr.data = NULL;
35476         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35477         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35478                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35479                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35480         }
35481         FREE(short_channel_ids_arg);
35482         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35483         uint64_t ret_ref = 0;
35484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35486         return ret_ref;
35487 }
35488
35489 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35490         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35491         uint64_t ret_ref = 0;
35492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35494         return ret_ref;
35495 }
35496 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
35497         LDKQueryShortChannelIds arg_conv;
35498         arg_conv.inner = untag_ptr(arg);
35499         arg_conv.is_owned = ptr_is_owned(arg);
35500         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35501         arg_conv.is_owned = false;
35502         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35503         return ret_conv;
35504 }
35505
35506 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
35507         LDKQueryShortChannelIds orig_conv;
35508         orig_conv.inner = untag_ptr(orig);
35509         orig_conv.is_owned = ptr_is_owned(orig);
35510         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35511         orig_conv.is_owned = false;
35512         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35513         uint64_t ret_ref = 0;
35514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35516         return ret_ref;
35517 }
35518
35519 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
35520         LDKQueryShortChannelIds a_conv;
35521         a_conv.inner = untag_ptr(a);
35522         a_conv.is_owned = ptr_is_owned(a);
35523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35524         a_conv.is_owned = false;
35525         LDKQueryShortChannelIds b_conv;
35526         b_conv.inner = untag_ptr(b);
35527         b_conv.is_owned = ptr_is_owned(b);
35528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35529         b_conv.is_owned = false;
35530         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
35531         return ret_conv;
35532 }
35533
35534 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
35535         LDKReplyShortChannelIdsEnd this_obj_conv;
35536         this_obj_conv.inner = untag_ptr(this_obj);
35537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35539         ReplyShortChannelIdsEnd_free(this_obj_conv);
35540 }
35541
35542 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
35543         LDKReplyShortChannelIdsEnd this_ptr_conv;
35544         this_ptr_conv.inner = untag_ptr(this_ptr);
35545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35547         this_ptr_conv.is_owned = false;
35548         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35549         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
35550         return ret_arr;
35551 }
35552
35553 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35554         LDKReplyShortChannelIdsEnd this_ptr_conv;
35555         this_ptr_conv.inner = untag_ptr(this_ptr);
35556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35558         this_ptr_conv.is_owned = false;
35559         LDKThirtyTwoBytes val_ref;
35560         CHECK(val->arr_len == 32);
35561         memcpy(val_ref.data, val->elems, 32); FREE(val);
35562         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35563 }
35564
35565 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
35566         LDKReplyShortChannelIdsEnd this_ptr_conv;
35567         this_ptr_conv.inner = untag_ptr(this_ptr);
35568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35570         this_ptr_conv.is_owned = false;
35571         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35572         return ret_conv;
35573 }
35574
35575 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
35576         LDKReplyShortChannelIdsEnd this_ptr_conv;
35577         this_ptr_conv.inner = untag_ptr(this_ptr);
35578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35580         this_ptr_conv.is_owned = false;
35581         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35582 }
35583
35584 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
35585         LDKThirtyTwoBytes chain_hash_arg_ref;
35586         CHECK(chain_hash_arg->arr_len == 32);
35587         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35588         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35589         uint64_t ret_ref = 0;
35590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35592         return ret_ref;
35593 }
35594
35595 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35596         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35597         uint64_t ret_ref = 0;
35598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35600         return ret_ref;
35601 }
35602 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
35603         LDKReplyShortChannelIdsEnd arg_conv;
35604         arg_conv.inner = untag_ptr(arg);
35605         arg_conv.is_owned = ptr_is_owned(arg);
35606         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35607         arg_conv.is_owned = false;
35608         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35609         return ret_conv;
35610 }
35611
35612 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
35613         LDKReplyShortChannelIdsEnd orig_conv;
35614         orig_conv.inner = untag_ptr(orig);
35615         orig_conv.is_owned = ptr_is_owned(orig);
35616         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35617         orig_conv.is_owned = false;
35618         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35619         uint64_t ret_ref = 0;
35620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35622         return ret_ref;
35623 }
35624
35625 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
35626         LDKReplyShortChannelIdsEnd a_conv;
35627         a_conv.inner = untag_ptr(a);
35628         a_conv.is_owned = ptr_is_owned(a);
35629         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35630         a_conv.is_owned = false;
35631         LDKReplyShortChannelIdsEnd b_conv;
35632         b_conv.inner = untag_ptr(b);
35633         b_conv.is_owned = ptr_is_owned(b);
35634         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35635         b_conv.is_owned = false;
35636         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
35637         return ret_conv;
35638 }
35639
35640 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
35641         LDKGossipTimestampFilter this_obj_conv;
35642         this_obj_conv.inner = untag_ptr(this_obj);
35643         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35645         GossipTimestampFilter_free(this_obj_conv);
35646 }
35647
35648 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
35649         LDKGossipTimestampFilter this_ptr_conv;
35650         this_ptr_conv.inner = untag_ptr(this_ptr);
35651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35653         this_ptr_conv.is_owned = false;
35654         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35655         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
35656         return ret_arr;
35657 }
35658
35659 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35660         LDKGossipTimestampFilter this_ptr_conv;
35661         this_ptr_conv.inner = untag_ptr(this_ptr);
35662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35664         this_ptr_conv.is_owned = false;
35665         LDKThirtyTwoBytes val_ref;
35666         CHECK(val->arr_len == 32);
35667         memcpy(val_ref.data, val->elems, 32); FREE(val);
35668         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35669 }
35670
35671 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
35672         LDKGossipTimestampFilter this_ptr_conv;
35673         this_ptr_conv.inner = untag_ptr(this_ptr);
35674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35676         this_ptr_conv.is_owned = false;
35677         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35678         return ret_conv;
35679 }
35680
35681 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
35682         LDKGossipTimestampFilter this_ptr_conv;
35683         this_ptr_conv.inner = untag_ptr(this_ptr);
35684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35686         this_ptr_conv.is_owned = false;
35687         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35688 }
35689
35690 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
35691         LDKGossipTimestampFilter this_ptr_conv;
35692         this_ptr_conv.inner = untag_ptr(this_ptr);
35693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35695         this_ptr_conv.is_owned = false;
35696         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35697         return ret_conv;
35698 }
35699
35700 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
35701         LDKGossipTimestampFilter this_ptr_conv;
35702         this_ptr_conv.inner = untag_ptr(this_ptr);
35703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35705         this_ptr_conv.is_owned = false;
35706         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35707 }
35708
35709 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) {
35710         LDKThirtyTwoBytes chain_hash_arg_ref;
35711         CHECK(chain_hash_arg->arr_len == 32);
35712         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35713         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35714         uint64_t ret_ref = 0;
35715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35717         return ret_ref;
35718 }
35719
35720 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35721         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35722         uint64_t ret_ref = 0;
35723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35725         return ret_ref;
35726 }
35727 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
35728         LDKGossipTimestampFilter arg_conv;
35729         arg_conv.inner = untag_ptr(arg);
35730         arg_conv.is_owned = ptr_is_owned(arg);
35731         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35732         arg_conv.is_owned = false;
35733         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35734         return ret_conv;
35735 }
35736
35737 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
35738         LDKGossipTimestampFilter orig_conv;
35739         orig_conv.inner = untag_ptr(orig);
35740         orig_conv.is_owned = ptr_is_owned(orig);
35741         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35742         orig_conv.is_owned = false;
35743         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35744         uint64_t ret_ref = 0;
35745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35747         return ret_ref;
35748 }
35749
35750 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
35751         LDKGossipTimestampFilter a_conv;
35752         a_conv.inner = untag_ptr(a);
35753         a_conv.is_owned = ptr_is_owned(a);
35754         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35755         a_conv.is_owned = false;
35756         LDKGossipTimestampFilter b_conv;
35757         b_conv.inner = untag_ptr(b);
35758         b_conv.is_owned = ptr_is_owned(b);
35759         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35760         b_conv.is_owned = false;
35761         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
35762         return ret_conv;
35763 }
35764
35765 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
35766         if (!ptr_is_owned(this_ptr)) return;
35767         void* this_ptr_ptr = untag_ptr(this_ptr);
35768         CHECK_ACCESS(this_ptr_ptr);
35769         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35770         FREE(untag_ptr(this_ptr));
35771         ErrorAction_free(this_ptr_conv);
35772 }
35773
35774 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35775         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35776         *ret_copy = ErrorAction_clone(arg);
35777         uint64_t ret_ref = tag_ptr(ret_copy, true);
35778         return ret_ref;
35779 }
35780 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
35781         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35782         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35783         return ret_conv;
35784 }
35785
35786 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
35787         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35788         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35789         *ret_copy = ErrorAction_clone(orig_conv);
35790         uint64_t ret_ref = tag_ptr(ret_copy, true);
35791         return ret_ref;
35792 }
35793
35794 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
35795         LDKErrorMessage msg_conv;
35796         msg_conv.inner = untag_ptr(msg);
35797         msg_conv.is_owned = ptr_is_owned(msg);
35798         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35799         msg_conv = ErrorMessage_clone(&msg_conv);
35800         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35801         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35802         uint64_t ret_ref = tag_ptr(ret_copy, true);
35803         return ret_ref;
35804 }
35805
35806 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
35807         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35808         *ret_copy = ErrorAction_ignore_error();
35809         uint64_t ret_ref = tag_ptr(ret_copy, true);
35810         return ret_ref;
35811 }
35812
35813 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
35814         LDKLevel a_conv = LDKLevel_from_js(a);
35815         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35816         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35817         uint64_t ret_ref = tag_ptr(ret_copy, true);
35818         return ret_ref;
35819 }
35820
35821 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
35822         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35823         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35824         uint64_t ret_ref = tag_ptr(ret_copy, true);
35825         return ret_ref;
35826 }
35827
35828 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
35829         LDKErrorMessage msg_conv;
35830         msg_conv.inner = untag_ptr(msg);
35831         msg_conv.is_owned = ptr_is_owned(msg);
35832         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35833         msg_conv = ErrorMessage_clone(&msg_conv);
35834         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35835         *ret_copy = ErrorAction_send_error_message(msg_conv);
35836         uint64_t ret_ref = tag_ptr(ret_copy, true);
35837         return ret_ref;
35838 }
35839
35840 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
35841         LDKWarningMessage msg_conv;
35842         msg_conv.inner = untag_ptr(msg);
35843         msg_conv.is_owned = ptr_is_owned(msg);
35844         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35845         msg_conv = WarningMessage_clone(&msg_conv);
35846         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
35847         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35848         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35849         uint64_t ret_ref = tag_ptr(ret_copy, true);
35850         return ret_ref;
35851 }
35852
35853 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
35854         LDKLightningError this_obj_conv;
35855         this_obj_conv.inner = untag_ptr(this_obj);
35856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35858         LightningError_free(this_obj_conv);
35859 }
35860
35861 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
35862         LDKLightningError this_ptr_conv;
35863         this_ptr_conv.inner = untag_ptr(this_ptr);
35864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35866         this_ptr_conv.is_owned = false;
35867         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35868         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35869         Str_free(ret_str);
35870         return ret_conv;
35871 }
35872
35873 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
35874         LDKLightningError this_ptr_conv;
35875         this_ptr_conv.inner = untag_ptr(this_ptr);
35876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35878         this_ptr_conv.is_owned = false;
35879         LDKStr val_conv = str_ref_to_owned_c(val);
35880         LightningError_set_err(&this_ptr_conv, val_conv);
35881 }
35882
35883 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
35884         LDKLightningError this_ptr_conv;
35885         this_ptr_conv.inner = untag_ptr(this_ptr);
35886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35888         this_ptr_conv.is_owned = false;
35889         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35890         *ret_copy = LightningError_get_action(&this_ptr_conv);
35891         uint64_t ret_ref = tag_ptr(ret_copy, true);
35892         return ret_ref;
35893 }
35894
35895 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
35896         LDKLightningError this_ptr_conv;
35897         this_ptr_conv.inner = untag_ptr(this_ptr);
35898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35900         this_ptr_conv.is_owned = false;
35901         void* val_ptr = untag_ptr(val);
35902         CHECK_ACCESS(val_ptr);
35903         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35904         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35905         LightningError_set_action(&this_ptr_conv, val_conv);
35906 }
35907
35908 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
35909         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
35910         void* action_arg_ptr = untag_ptr(action_arg);
35911         CHECK_ACCESS(action_arg_ptr);
35912         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35913         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
35914         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35915         uint64_t ret_ref = 0;
35916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35918         return ret_ref;
35919 }
35920
35921 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35922         LDKLightningError ret_var = LightningError_clone(arg);
35923         uint64_t ret_ref = 0;
35924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35926         return ret_ref;
35927 }
35928 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
35929         LDKLightningError arg_conv;
35930         arg_conv.inner = untag_ptr(arg);
35931         arg_conv.is_owned = ptr_is_owned(arg);
35932         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35933         arg_conv.is_owned = false;
35934         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35935         return ret_conv;
35936 }
35937
35938 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
35939         LDKLightningError orig_conv;
35940         orig_conv.inner = untag_ptr(orig);
35941         orig_conv.is_owned = ptr_is_owned(orig);
35942         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35943         orig_conv.is_owned = false;
35944         LDKLightningError ret_var = LightningError_clone(&orig_conv);
35945         uint64_t ret_ref = 0;
35946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35948         return ret_ref;
35949 }
35950
35951 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
35952         LDKCommitmentUpdate this_obj_conv;
35953         this_obj_conv.inner = untag_ptr(this_obj);
35954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35956         CommitmentUpdate_free(this_obj_conv);
35957 }
35958
35959 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
35960         LDKCommitmentUpdate this_ptr_conv;
35961         this_ptr_conv.inner = untag_ptr(this_ptr);
35962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35964         this_ptr_conv.is_owned = false;
35965         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35966         uint64_tArray ret_arr = NULL;
35967         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35968         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35969         for (size_t p = 0; p < ret_var.datalen; p++) {
35970                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35971                 uint64_t ret_conv_15_ref = 0;
35972                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35973                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
35974                 ret_arr_ptr[p] = ret_conv_15_ref;
35975         }
35976         
35977         FREE(ret_var.data);
35978         return ret_arr;
35979 }
35980
35981 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
35982         LDKCommitmentUpdate this_ptr_conv;
35983         this_ptr_conv.inner = untag_ptr(this_ptr);
35984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35986         this_ptr_conv.is_owned = false;
35987         LDKCVec_UpdateAddHTLCZ val_constr;
35988         val_constr.datalen = val->arr_len;
35989         if (val_constr.datalen > 0)
35990                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35991         else
35992                 val_constr.data = NULL;
35993         uint64_t* val_vals = val->elems;
35994         for (size_t p = 0; p < val_constr.datalen; p++) {
35995                 uint64_t val_conv_15 = val_vals[p];
35996                 LDKUpdateAddHTLC val_conv_15_conv;
35997                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
35998                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
35999                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
36000                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
36001                 val_constr.data[p] = val_conv_15_conv;
36002         }
36003         FREE(val);
36004         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
36005 }
36006
36007 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
36008         LDKCommitmentUpdate this_ptr_conv;
36009         this_ptr_conv.inner = untag_ptr(this_ptr);
36010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36012         this_ptr_conv.is_owned = false;
36013         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
36014         uint64_tArray ret_arr = NULL;
36015         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36016         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36017         for (size_t t = 0; t < ret_var.datalen; t++) {
36018                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
36019                 uint64_t ret_conv_19_ref = 0;
36020                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
36021                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
36022                 ret_arr_ptr[t] = ret_conv_19_ref;
36023         }
36024         
36025         FREE(ret_var.data);
36026         return ret_arr;
36027 }
36028
36029 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
36030         LDKCommitmentUpdate this_ptr_conv;
36031         this_ptr_conv.inner = untag_ptr(this_ptr);
36032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36034         this_ptr_conv.is_owned = false;
36035         LDKCVec_UpdateFulfillHTLCZ val_constr;
36036         val_constr.datalen = val->arr_len;
36037         if (val_constr.datalen > 0)
36038                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36039         else
36040                 val_constr.data = NULL;
36041         uint64_t* val_vals = val->elems;
36042         for (size_t t = 0; t < val_constr.datalen; t++) {
36043                 uint64_t val_conv_19 = val_vals[t];
36044                 LDKUpdateFulfillHTLC val_conv_19_conv;
36045                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
36046                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
36047                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
36048                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
36049                 val_constr.data[t] = val_conv_19_conv;
36050         }
36051         FREE(val);
36052         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
36053 }
36054
36055 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
36056         LDKCommitmentUpdate this_ptr_conv;
36057         this_ptr_conv.inner = untag_ptr(this_ptr);
36058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36060         this_ptr_conv.is_owned = false;
36061         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
36062         uint64_tArray ret_arr = NULL;
36063         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36064         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36065         for (size_t q = 0; q < ret_var.datalen; q++) {
36066                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
36067                 uint64_t ret_conv_16_ref = 0;
36068                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
36069                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
36070                 ret_arr_ptr[q] = ret_conv_16_ref;
36071         }
36072         
36073         FREE(ret_var.data);
36074         return ret_arr;
36075 }
36076
36077 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
36078         LDKCommitmentUpdate this_ptr_conv;
36079         this_ptr_conv.inner = untag_ptr(this_ptr);
36080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36082         this_ptr_conv.is_owned = false;
36083         LDKCVec_UpdateFailHTLCZ val_constr;
36084         val_constr.datalen = val->arr_len;
36085         if (val_constr.datalen > 0)
36086                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36087         else
36088                 val_constr.data = NULL;
36089         uint64_t* val_vals = val->elems;
36090         for (size_t q = 0; q < val_constr.datalen; q++) {
36091                 uint64_t val_conv_16 = val_vals[q];
36092                 LDKUpdateFailHTLC val_conv_16_conv;
36093                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
36094                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
36095                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
36096                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
36097                 val_constr.data[q] = val_conv_16_conv;
36098         }
36099         FREE(val);
36100         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
36101 }
36102
36103 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
36104         LDKCommitmentUpdate this_ptr_conv;
36105         this_ptr_conv.inner = untag_ptr(this_ptr);
36106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36108         this_ptr_conv.is_owned = false;
36109         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
36110         uint64_tArray ret_arr = NULL;
36111         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36112         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36113         for (size_t z = 0; z < ret_var.datalen; z++) {
36114                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
36115                 uint64_t ret_conv_25_ref = 0;
36116                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
36117                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
36118                 ret_arr_ptr[z] = ret_conv_25_ref;
36119         }
36120         
36121         FREE(ret_var.data);
36122         return ret_arr;
36123 }
36124
36125 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) {
36126         LDKCommitmentUpdate this_ptr_conv;
36127         this_ptr_conv.inner = untag_ptr(this_ptr);
36128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36130         this_ptr_conv.is_owned = false;
36131         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
36132         val_constr.datalen = val->arr_len;
36133         if (val_constr.datalen > 0)
36134                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36135         else
36136                 val_constr.data = NULL;
36137         uint64_t* val_vals = val->elems;
36138         for (size_t z = 0; z < val_constr.datalen; z++) {
36139                 uint64_t val_conv_25 = val_vals[z];
36140                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
36141                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
36142                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
36143                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
36144                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
36145                 val_constr.data[z] = val_conv_25_conv;
36146         }
36147         FREE(val);
36148         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
36149 }
36150
36151 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
36152         LDKCommitmentUpdate this_ptr_conv;
36153         this_ptr_conv.inner = untag_ptr(this_ptr);
36154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36156         this_ptr_conv.is_owned = false;
36157         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
36158         uint64_t ret_ref = 0;
36159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36161         return ret_ref;
36162 }
36163
36164 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
36165         LDKCommitmentUpdate this_ptr_conv;
36166         this_ptr_conv.inner = untag_ptr(this_ptr);
36167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36169         this_ptr_conv.is_owned = false;
36170         LDKUpdateFee val_conv;
36171         val_conv.inner = untag_ptr(val);
36172         val_conv.is_owned = ptr_is_owned(val);
36173         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36174         val_conv = UpdateFee_clone(&val_conv);
36175         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
36176 }
36177
36178 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
36179         LDKCommitmentUpdate this_ptr_conv;
36180         this_ptr_conv.inner = untag_ptr(this_ptr);
36181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36183         this_ptr_conv.is_owned = false;
36184         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
36185         uint64_t ret_ref = 0;
36186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36188         return ret_ref;
36189 }
36190
36191 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
36192         LDKCommitmentUpdate this_ptr_conv;
36193         this_ptr_conv.inner = untag_ptr(this_ptr);
36194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36196         this_ptr_conv.is_owned = false;
36197         LDKCommitmentSigned val_conv;
36198         val_conv.inner = untag_ptr(val);
36199         val_conv.is_owned = ptr_is_owned(val);
36200         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36201         val_conv = CommitmentSigned_clone(&val_conv);
36202         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
36203 }
36204
36205 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) {
36206         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
36207         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
36208         if (update_add_htlcs_arg_constr.datalen > 0)
36209                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36210         else
36211                 update_add_htlcs_arg_constr.data = NULL;
36212         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
36213         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
36214                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
36215                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
36216                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
36217                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
36218                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
36219                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
36220                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
36221         }
36222         FREE(update_add_htlcs_arg);
36223         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
36224         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
36225         if (update_fulfill_htlcs_arg_constr.datalen > 0)
36226                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36227         else
36228                 update_fulfill_htlcs_arg_constr.data = NULL;
36229         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
36230         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
36231                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
36232                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
36233                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
36234                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
36235                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
36236                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
36237                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
36238         }
36239         FREE(update_fulfill_htlcs_arg);
36240         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
36241         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
36242         if (update_fail_htlcs_arg_constr.datalen > 0)
36243                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36244         else
36245                 update_fail_htlcs_arg_constr.data = NULL;
36246         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
36247         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
36248                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
36249                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
36250                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
36251                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
36252                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
36253                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
36254                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
36255         }
36256         FREE(update_fail_htlcs_arg);
36257         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
36258         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
36259         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
36260                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36261         else
36262                 update_fail_malformed_htlcs_arg_constr.data = NULL;
36263         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
36264         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
36265                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
36266                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
36267                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
36268                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
36269                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
36270                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
36271                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
36272         }
36273         FREE(update_fail_malformed_htlcs_arg);
36274         LDKUpdateFee update_fee_arg_conv;
36275         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
36276         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
36277         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
36278         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
36279         LDKCommitmentSigned commitment_signed_arg_conv;
36280         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
36281         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
36282         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
36283         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
36284         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);
36285         uint64_t ret_ref = 0;
36286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36288         return ret_ref;
36289 }
36290
36291 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36292         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36293         uint64_t ret_ref = 0;
36294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36296         return ret_ref;
36297 }
36298 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
36299         LDKCommitmentUpdate arg_conv;
36300         arg_conv.inner = untag_ptr(arg);
36301         arg_conv.is_owned = ptr_is_owned(arg);
36302         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36303         arg_conv.is_owned = false;
36304         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36305         return ret_conv;
36306 }
36307
36308 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
36309         LDKCommitmentUpdate orig_conv;
36310         orig_conv.inner = untag_ptr(orig);
36311         orig_conv.is_owned = ptr_is_owned(orig);
36312         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36313         orig_conv.is_owned = false;
36314         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36315         uint64_t ret_ref = 0;
36316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36318         return ret_ref;
36319 }
36320
36321 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
36322         LDKCommitmentUpdate a_conv;
36323         a_conv.inner = untag_ptr(a);
36324         a_conv.is_owned = ptr_is_owned(a);
36325         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36326         a_conv.is_owned = false;
36327         LDKCommitmentUpdate b_conv;
36328         b_conv.inner = untag_ptr(b);
36329         b_conv.is_owned = ptr_is_owned(b);
36330         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36331         b_conv.is_owned = false;
36332         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
36333         return ret_conv;
36334 }
36335
36336 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
36337         if (!ptr_is_owned(this_ptr)) return;
36338         void* this_ptr_ptr = untag_ptr(this_ptr);
36339         CHECK_ACCESS(this_ptr_ptr);
36340         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36341         FREE(untag_ptr(this_ptr));
36342         ChannelMessageHandler_free(this_ptr_conv);
36343 }
36344
36345 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
36346         if (!ptr_is_owned(this_ptr)) return;
36347         void* this_ptr_ptr = untag_ptr(this_ptr);
36348         CHECK_ACCESS(this_ptr_ptr);
36349         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36350         FREE(untag_ptr(this_ptr));
36351         RoutingMessageHandler_free(this_ptr_conv);
36352 }
36353
36354 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
36355         if (!ptr_is_owned(this_ptr)) return;
36356         void* this_ptr_ptr = untag_ptr(this_ptr);
36357         CHECK_ACCESS(this_ptr_ptr);
36358         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
36359         FREE(untag_ptr(this_ptr));
36360         OnionMessageHandler_free(this_ptr_conv);
36361 }
36362
36363 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
36364         LDKAcceptChannel obj_conv;
36365         obj_conv.inner = untag_ptr(obj);
36366         obj_conv.is_owned = ptr_is_owned(obj);
36367         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36368         obj_conv.is_owned = false;
36369         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36370         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36371         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36372         CVec_u8Z_free(ret_var);
36373         return ret_arr;
36374 }
36375
36376 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
36377         LDKu8slice ser_ref;
36378         ser_ref.datalen = ser->arr_len;
36379         ser_ref.data = ser->elems;
36380         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36381         *ret_conv = AcceptChannel_read(ser_ref);
36382         FREE(ser);
36383         return tag_ptr(ret_conv, true);
36384 }
36385
36386 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
36387         LDKAnnouncementSignatures obj_conv;
36388         obj_conv.inner = untag_ptr(obj);
36389         obj_conv.is_owned = ptr_is_owned(obj);
36390         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36391         obj_conv.is_owned = false;
36392         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36393         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36394         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36395         CVec_u8Z_free(ret_var);
36396         return ret_arr;
36397 }
36398
36399 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
36400         LDKu8slice ser_ref;
36401         ser_ref.datalen = ser->arr_len;
36402         ser_ref.data = ser->elems;
36403         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36404         *ret_conv = AnnouncementSignatures_read(ser_ref);
36405         FREE(ser);
36406         return tag_ptr(ret_conv, true);
36407 }
36408
36409 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
36410         LDKChannelReestablish obj_conv;
36411         obj_conv.inner = untag_ptr(obj);
36412         obj_conv.is_owned = ptr_is_owned(obj);
36413         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36414         obj_conv.is_owned = false;
36415         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36416         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36417         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36418         CVec_u8Z_free(ret_var);
36419         return ret_arr;
36420 }
36421
36422 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
36423         LDKu8slice ser_ref;
36424         ser_ref.datalen = ser->arr_len;
36425         ser_ref.data = ser->elems;
36426         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36427         *ret_conv = ChannelReestablish_read(ser_ref);
36428         FREE(ser);
36429         return tag_ptr(ret_conv, true);
36430 }
36431
36432 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
36433         LDKClosingSigned obj_conv;
36434         obj_conv.inner = untag_ptr(obj);
36435         obj_conv.is_owned = ptr_is_owned(obj);
36436         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36437         obj_conv.is_owned = false;
36438         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36439         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36440         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36441         CVec_u8Z_free(ret_var);
36442         return ret_arr;
36443 }
36444
36445 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
36446         LDKu8slice ser_ref;
36447         ser_ref.datalen = ser->arr_len;
36448         ser_ref.data = ser->elems;
36449         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36450         *ret_conv = ClosingSigned_read(ser_ref);
36451         FREE(ser);
36452         return tag_ptr(ret_conv, true);
36453 }
36454
36455 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
36456         LDKClosingSignedFeeRange obj_conv;
36457         obj_conv.inner = untag_ptr(obj);
36458         obj_conv.is_owned = ptr_is_owned(obj);
36459         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36460         obj_conv.is_owned = false;
36461         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36462         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36463         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36464         CVec_u8Z_free(ret_var);
36465         return ret_arr;
36466 }
36467
36468 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
36469         LDKu8slice ser_ref;
36470         ser_ref.datalen = ser->arr_len;
36471         ser_ref.data = ser->elems;
36472         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36473         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36474         FREE(ser);
36475         return tag_ptr(ret_conv, true);
36476 }
36477
36478 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
36479         LDKCommitmentSigned obj_conv;
36480         obj_conv.inner = untag_ptr(obj);
36481         obj_conv.is_owned = ptr_is_owned(obj);
36482         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36483         obj_conv.is_owned = false;
36484         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36485         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36486         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36487         CVec_u8Z_free(ret_var);
36488         return ret_arr;
36489 }
36490
36491 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
36492         LDKu8slice ser_ref;
36493         ser_ref.datalen = ser->arr_len;
36494         ser_ref.data = ser->elems;
36495         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36496         *ret_conv = CommitmentSigned_read(ser_ref);
36497         FREE(ser);
36498         return tag_ptr(ret_conv, true);
36499 }
36500
36501 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
36502         LDKFundingCreated obj_conv;
36503         obj_conv.inner = untag_ptr(obj);
36504         obj_conv.is_owned = ptr_is_owned(obj);
36505         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36506         obj_conv.is_owned = false;
36507         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36508         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36509         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36510         CVec_u8Z_free(ret_var);
36511         return ret_arr;
36512 }
36513
36514 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
36515         LDKu8slice ser_ref;
36516         ser_ref.datalen = ser->arr_len;
36517         ser_ref.data = ser->elems;
36518         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36519         *ret_conv = FundingCreated_read(ser_ref);
36520         FREE(ser);
36521         return tag_ptr(ret_conv, true);
36522 }
36523
36524 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
36525         LDKFundingSigned obj_conv;
36526         obj_conv.inner = untag_ptr(obj);
36527         obj_conv.is_owned = ptr_is_owned(obj);
36528         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36529         obj_conv.is_owned = false;
36530         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36531         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36532         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36533         CVec_u8Z_free(ret_var);
36534         return ret_arr;
36535 }
36536
36537 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
36538         LDKu8slice ser_ref;
36539         ser_ref.datalen = ser->arr_len;
36540         ser_ref.data = ser->elems;
36541         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36542         *ret_conv = FundingSigned_read(ser_ref);
36543         FREE(ser);
36544         return tag_ptr(ret_conv, true);
36545 }
36546
36547 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
36548         LDKChannelReady obj_conv;
36549         obj_conv.inner = untag_ptr(obj);
36550         obj_conv.is_owned = ptr_is_owned(obj);
36551         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36552         obj_conv.is_owned = false;
36553         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36554         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36555         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36556         CVec_u8Z_free(ret_var);
36557         return ret_arr;
36558 }
36559
36560 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
36561         LDKu8slice ser_ref;
36562         ser_ref.datalen = ser->arr_len;
36563         ser_ref.data = ser->elems;
36564         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36565         *ret_conv = ChannelReady_read(ser_ref);
36566         FREE(ser);
36567         return tag_ptr(ret_conv, true);
36568 }
36569
36570 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
36571         LDKInit obj_conv;
36572         obj_conv.inner = untag_ptr(obj);
36573         obj_conv.is_owned = ptr_is_owned(obj);
36574         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36575         obj_conv.is_owned = false;
36576         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36577         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36578         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36579         CVec_u8Z_free(ret_var);
36580         return ret_arr;
36581 }
36582
36583 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
36584         LDKu8slice ser_ref;
36585         ser_ref.datalen = ser->arr_len;
36586         ser_ref.data = ser->elems;
36587         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36588         *ret_conv = Init_read(ser_ref);
36589         FREE(ser);
36590         return tag_ptr(ret_conv, true);
36591 }
36592
36593 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
36594         LDKOpenChannel obj_conv;
36595         obj_conv.inner = untag_ptr(obj);
36596         obj_conv.is_owned = ptr_is_owned(obj);
36597         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36598         obj_conv.is_owned = false;
36599         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36600         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36601         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36602         CVec_u8Z_free(ret_var);
36603         return ret_arr;
36604 }
36605
36606 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
36607         LDKu8slice ser_ref;
36608         ser_ref.datalen = ser->arr_len;
36609         ser_ref.data = ser->elems;
36610         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36611         *ret_conv = OpenChannel_read(ser_ref);
36612         FREE(ser);
36613         return tag_ptr(ret_conv, true);
36614 }
36615
36616 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
36617         LDKRevokeAndACK obj_conv;
36618         obj_conv.inner = untag_ptr(obj);
36619         obj_conv.is_owned = ptr_is_owned(obj);
36620         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36621         obj_conv.is_owned = false;
36622         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36623         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36624         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36625         CVec_u8Z_free(ret_var);
36626         return ret_arr;
36627 }
36628
36629 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
36630         LDKu8slice ser_ref;
36631         ser_ref.datalen = ser->arr_len;
36632         ser_ref.data = ser->elems;
36633         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36634         *ret_conv = RevokeAndACK_read(ser_ref);
36635         FREE(ser);
36636         return tag_ptr(ret_conv, true);
36637 }
36638
36639 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
36640         LDKShutdown obj_conv;
36641         obj_conv.inner = untag_ptr(obj);
36642         obj_conv.is_owned = ptr_is_owned(obj);
36643         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36644         obj_conv.is_owned = false;
36645         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36646         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36647         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36648         CVec_u8Z_free(ret_var);
36649         return ret_arr;
36650 }
36651
36652 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
36653         LDKu8slice ser_ref;
36654         ser_ref.datalen = ser->arr_len;
36655         ser_ref.data = ser->elems;
36656         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36657         *ret_conv = Shutdown_read(ser_ref);
36658         FREE(ser);
36659         return tag_ptr(ret_conv, true);
36660 }
36661
36662 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
36663         LDKUpdateFailHTLC obj_conv;
36664         obj_conv.inner = untag_ptr(obj);
36665         obj_conv.is_owned = ptr_is_owned(obj);
36666         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36667         obj_conv.is_owned = false;
36668         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36669         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36670         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36671         CVec_u8Z_free(ret_var);
36672         return ret_arr;
36673 }
36674
36675 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
36676         LDKu8slice ser_ref;
36677         ser_ref.datalen = ser->arr_len;
36678         ser_ref.data = ser->elems;
36679         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36680         *ret_conv = UpdateFailHTLC_read(ser_ref);
36681         FREE(ser);
36682         return tag_ptr(ret_conv, true);
36683 }
36684
36685 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
36686         LDKUpdateFailMalformedHTLC obj_conv;
36687         obj_conv.inner = untag_ptr(obj);
36688         obj_conv.is_owned = ptr_is_owned(obj);
36689         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36690         obj_conv.is_owned = false;
36691         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36692         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36693         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36694         CVec_u8Z_free(ret_var);
36695         return ret_arr;
36696 }
36697
36698 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
36699         LDKu8slice ser_ref;
36700         ser_ref.datalen = ser->arr_len;
36701         ser_ref.data = ser->elems;
36702         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36703         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36704         FREE(ser);
36705         return tag_ptr(ret_conv, true);
36706 }
36707
36708 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
36709         LDKUpdateFee obj_conv;
36710         obj_conv.inner = untag_ptr(obj);
36711         obj_conv.is_owned = ptr_is_owned(obj);
36712         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36713         obj_conv.is_owned = false;
36714         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36715         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36716         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36717         CVec_u8Z_free(ret_var);
36718         return ret_arr;
36719 }
36720
36721 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
36722         LDKu8slice ser_ref;
36723         ser_ref.datalen = ser->arr_len;
36724         ser_ref.data = ser->elems;
36725         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36726         *ret_conv = UpdateFee_read(ser_ref);
36727         FREE(ser);
36728         return tag_ptr(ret_conv, true);
36729 }
36730
36731 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
36732         LDKUpdateFulfillHTLC obj_conv;
36733         obj_conv.inner = untag_ptr(obj);
36734         obj_conv.is_owned = ptr_is_owned(obj);
36735         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36736         obj_conv.is_owned = false;
36737         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36738         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36739         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36740         CVec_u8Z_free(ret_var);
36741         return ret_arr;
36742 }
36743
36744 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
36745         LDKu8slice ser_ref;
36746         ser_ref.datalen = ser->arr_len;
36747         ser_ref.data = ser->elems;
36748         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36749         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36750         FREE(ser);
36751         return tag_ptr(ret_conv, true);
36752 }
36753
36754 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
36755         LDKUpdateAddHTLC obj_conv;
36756         obj_conv.inner = untag_ptr(obj);
36757         obj_conv.is_owned = ptr_is_owned(obj);
36758         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36759         obj_conv.is_owned = false;
36760         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36761         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36762         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36763         CVec_u8Z_free(ret_var);
36764         return ret_arr;
36765 }
36766
36767 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
36768         LDKu8slice ser_ref;
36769         ser_ref.datalen = ser->arr_len;
36770         ser_ref.data = ser->elems;
36771         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36772         *ret_conv = UpdateAddHTLC_read(ser_ref);
36773         FREE(ser);
36774         return tag_ptr(ret_conv, true);
36775 }
36776
36777 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
36778         LDKu8slice ser_ref;
36779         ser_ref.datalen = ser->arr_len;
36780         ser_ref.data = ser->elems;
36781         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
36782         *ret_conv = OnionMessage_read(ser_ref);
36783         FREE(ser);
36784         return tag_ptr(ret_conv, true);
36785 }
36786
36787 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
36788         LDKOnionMessage obj_conv;
36789         obj_conv.inner = untag_ptr(obj);
36790         obj_conv.is_owned = ptr_is_owned(obj);
36791         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36792         obj_conv.is_owned = false;
36793         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
36794         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36795         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36796         CVec_u8Z_free(ret_var);
36797         return ret_arr;
36798 }
36799
36800 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
36801         LDKPing obj_conv;
36802         obj_conv.inner = untag_ptr(obj);
36803         obj_conv.is_owned = ptr_is_owned(obj);
36804         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36805         obj_conv.is_owned = false;
36806         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36807         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36808         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36809         CVec_u8Z_free(ret_var);
36810         return ret_arr;
36811 }
36812
36813 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
36814         LDKu8slice ser_ref;
36815         ser_ref.datalen = ser->arr_len;
36816         ser_ref.data = ser->elems;
36817         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36818         *ret_conv = Ping_read(ser_ref);
36819         FREE(ser);
36820         return tag_ptr(ret_conv, true);
36821 }
36822
36823 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
36824         LDKPong obj_conv;
36825         obj_conv.inner = untag_ptr(obj);
36826         obj_conv.is_owned = ptr_is_owned(obj);
36827         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36828         obj_conv.is_owned = false;
36829         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36830         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36831         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36832         CVec_u8Z_free(ret_var);
36833         return ret_arr;
36834 }
36835
36836 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
36837         LDKu8slice ser_ref;
36838         ser_ref.datalen = ser->arr_len;
36839         ser_ref.data = ser->elems;
36840         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36841         *ret_conv = Pong_read(ser_ref);
36842         FREE(ser);
36843         return tag_ptr(ret_conv, true);
36844 }
36845
36846 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
36847         LDKUnsignedChannelAnnouncement obj_conv;
36848         obj_conv.inner = untag_ptr(obj);
36849         obj_conv.is_owned = ptr_is_owned(obj);
36850         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36851         obj_conv.is_owned = false;
36852         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36853         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36854         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36855         CVec_u8Z_free(ret_var);
36856         return ret_arr;
36857 }
36858
36859 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
36860         LDKu8slice ser_ref;
36861         ser_ref.datalen = ser->arr_len;
36862         ser_ref.data = ser->elems;
36863         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36864         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36865         FREE(ser);
36866         return tag_ptr(ret_conv, true);
36867 }
36868
36869 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
36870         LDKChannelAnnouncement obj_conv;
36871         obj_conv.inner = untag_ptr(obj);
36872         obj_conv.is_owned = ptr_is_owned(obj);
36873         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36874         obj_conv.is_owned = false;
36875         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36876         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36877         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36878         CVec_u8Z_free(ret_var);
36879         return ret_arr;
36880 }
36881
36882 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
36883         LDKu8slice ser_ref;
36884         ser_ref.datalen = ser->arr_len;
36885         ser_ref.data = ser->elems;
36886         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36887         *ret_conv = ChannelAnnouncement_read(ser_ref);
36888         FREE(ser);
36889         return tag_ptr(ret_conv, true);
36890 }
36891
36892 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
36893         LDKUnsignedChannelUpdate obj_conv;
36894         obj_conv.inner = untag_ptr(obj);
36895         obj_conv.is_owned = ptr_is_owned(obj);
36896         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36897         obj_conv.is_owned = false;
36898         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36899         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36900         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36901         CVec_u8Z_free(ret_var);
36902         return ret_arr;
36903 }
36904
36905 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
36906         LDKu8slice ser_ref;
36907         ser_ref.datalen = ser->arr_len;
36908         ser_ref.data = ser->elems;
36909         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36910         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36911         FREE(ser);
36912         return tag_ptr(ret_conv, true);
36913 }
36914
36915 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
36916         LDKChannelUpdate obj_conv;
36917         obj_conv.inner = untag_ptr(obj);
36918         obj_conv.is_owned = ptr_is_owned(obj);
36919         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36920         obj_conv.is_owned = false;
36921         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36922         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36923         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36924         CVec_u8Z_free(ret_var);
36925         return ret_arr;
36926 }
36927
36928 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
36929         LDKu8slice ser_ref;
36930         ser_ref.datalen = ser->arr_len;
36931         ser_ref.data = ser->elems;
36932         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36933         *ret_conv = ChannelUpdate_read(ser_ref);
36934         FREE(ser);
36935         return tag_ptr(ret_conv, true);
36936 }
36937
36938 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
36939         LDKErrorMessage obj_conv;
36940         obj_conv.inner = untag_ptr(obj);
36941         obj_conv.is_owned = ptr_is_owned(obj);
36942         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36943         obj_conv.is_owned = false;
36944         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36945         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36946         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36947         CVec_u8Z_free(ret_var);
36948         return ret_arr;
36949 }
36950
36951 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
36952         LDKu8slice ser_ref;
36953         ser_ref.datalen = ser->arr_len;
36954         ser_ref.data = ser->elems;
36955         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36956         *ret_conv = ErrorMessage_read(ser_ref);
36957         FREE(ser);
36958         return tag_ptr(ret_conv, true);
36959 }
36960
36961 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
36962         LDKWarningMessage obj_conv;
36963         obj_conv.inner = untag_ptr(obj);
36964         obj_conv.is_owned = ptr_is_owned(obj);
36965         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36966         obj_conv.is_owned = false;
36967         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36968         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36969         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36970         CVec_u8Z_free(ret_var);
36971         return ret_arr;
36972 }
36973
36974 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
36975         LDKu8slice ser_ref;
36976         ser_ref.datalen = ser->arr_len;
36977         ser_ref.data = ser->elems;
36978         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36979         *ret_conv = WarningMessage_read(ser_ref);
36980         FREE(ser);
36981         return tag_ptr(ret_conv, true);
36982 }
36983
36984 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
36985         LDKUnsignedNodeAnnouncement obj_conv;
36986         obj_conv.inner = untag_ptr(obj);
36987         obj_conv.is_owned = ptr_is_owned(obj);
36988         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36989         obj_conv.is_owned = false;
36990         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36991         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36992         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36993         CVec_u8Z_free(ret_var);
36994         return ret_arr;
36995 }
36996
36997 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
36998         LDKu8slice ser_ref;
36999         ser_ref.datalen = ser->arr_len;
37000         ser_ref.data = ser->elems;
37001         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
37002         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
37003         FREE(ser);
37004         return tag_ptr(ret_conv, true);
37005 }
37006
37007 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
37008         LDKNodeAnnouncement obj_conv;
37009         obj_conv.inner = untag_ptr(obj);
37010         obj_conv.is_owned = ptr_is_owned(obj);
37011         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37012         obj_conv.is_owned = false;
37013         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
37014         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37015         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37016         CVec_u8Z_free(ret_var);
37017         return ret_arr;
37018 }
37019
37020 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
37021         LDKu8slice ser_ref;
37022         ser_ref.datalen = ser->arr_len;
37023         ser_ref.data = ser->elems;
37024         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
37025         *ret_conv = NodeAnnouncement_read(ser_ref);
37026         FREE(ser);
37027         return tag_ptr(ret_conv, true);
37028 }
37029
37030 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
37031         LDKu8slice ser_ref;
37032         ser_ref.datalen = ser->arr_len;
37033         ser_ref.data = ser->elems;
37034         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
37035         *ret_conv = QueryShortChannelIds_read(ser_ref);
37036         FREE(ser);
37037         return tag_ptr(ret_conv, true);
37038 }
37039
37040 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
37041         LDKQueryShortChannelIds obj_conv;
37042         obj_conv.inner = untag_ptr(obj);
37043         obj_conv.is_owned = ptr_is_owned(obj);
37044         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37045         obj_conv.is_owned = false;
37046         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
37047         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37048         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37049         CVec_u8Z_free(ret_var);
37050         return ret_arr;
37051 }
37052
37053 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
37054         LDKReplyShortChannelIdsEnd obj_conv;
37055         obj_conv.inner = untag_ptr(obj);
37056         obj_conv.is_owned = ptr_is_owned(obj);
37057         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37058         obj_conv.is_owned = false;
37059         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
37060         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37061         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37062         CVec_u8Z_free(ret_var);
37063         return ret_arr;
37064 }
37065
37066 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
37067         LDKu8slice ser_ref;
37068         ser_ref.datalen = ser->arr_len;
37069         ser_ref.data = ser->elems;
37070         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
37071         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
37072         FREE(ser);
37073         return tag_ptr(ret_conv, true);
37074 }
37075
37076 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
37077         LDKQueryChannelRange this_arg_conv;
37078         this_arg_conv.inner = untag_ptr(this_arg);
37079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37081         this_arg_conv.is_owned = false;
37082         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
37083         return ret_conv;
37084 }
37085
37086 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
37087         LDKQueryChannelRange obj_conv;
37088         obj_conv.inner = untag_ptr(obj);
37089         obj_conv.is_owned = ptr_is_owned(obj);
37090         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37091         obj_conv.is_owned = false;
37092         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
37093         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37094         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37095         CVec_u8Z_free(ret_var);
37096         return ret_arr;
37097 }
37098
37099 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
37100         LDKu8slice ser_ref;
37101         ser_ref.datalen = ser->arr_len;
37102         ser_ref.data = ser->elems;
37103         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
37104         *ret_conv = QueryChannelRange_read(ser_ref);
37105         FREE(ser);
37106         return tag_ptr(ret_conv, true);
37107 }
37108
37109 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
37110         LDKu8slice ser_ref;
37111         ser_ref.datalen = ser->arr_len;
37112         ser_ref.data = ser->elems;
37113         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
37114         *ret_conv = ReplyChannelRange_read(ser_ref);
37115         FREE(ser);
37116         return tag_ptr(ret_conv, true);
37117 }
37118
37119 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
37120         LDKReplyChannelRange obj_conv;
37121         obj_conv.inner = untag_ptr(obj);
37122         obj_conv.is_owned = ptr_is_owned(obj);
37123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37124         obj_conv.is_owned = false;
37125         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
37126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37128         CVec_u8Z_free(ret_var);
37129         return ret_arr;
37130 }
37131
37132 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
37133         LDKGossipTimestampFilter obj_conv;
37134         obj_conv.inner = untag_ptr(obj);
37135         obj_conv.is_owned = ptr_is_owned(obj);
37136         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37137         obj_conv.is_owned = false;
37138         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
37139         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37140         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37141         CVec_u8Z_free(ret_var);
37142         return ret_arr;
37143 }
37144
37145 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
37146         LDKu8slice ser_ref;
37147         ser_ref.datalen = ser->arr_len;
37148         ser_ref.data = ser->elems;
37149         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
37150         *ret_conv = GossipTimestampFilter_read(ser_ref);
37151         FREE(ser);
37152         return tag_ptr(ret_conv, true);
37153 }
37154
37155 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
37156         if (!ptr_is_owned(this_ptr)) return;
37157         void* this_ptr_ptr = untag_ptr(this_ptr);
37158         CHECK_ACCESS(this_ptr_ptr);
37159         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
37160         FREE(untag_ptr(this_ptr));
37161         CustomMessageHandler_free(this_ptr_conv);
37162 }
37163
37164 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
37165         LDKIgnoringMessageHandler this_obj_conv;
37166         this_obj_conv.inner = untag_ptr(this_obj);
37167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37169         IgnoringMessageHandler_free(this_obj_conv);
37170 }
37171
37172 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
37173         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
37174         uint64_t ret_ref = 0;
37175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37177         return ret_ref;
37178 }
37179
37180 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37181         LDKIgnoringMessageHandler this_arg_conv;
37182         this_arg_conv.inner = untag_ptr(this_arg);
37183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37185         this_arg_conv.is_owned = false;
37186         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37187         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37188         return tag_ptr(ret_ret, true);
37189 }
37190
37191 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
37192         LDKIgnoringMessageHandler this_arg_conv;
37193         this_arg_conv.inner = untag_ptr(this_arg);
37194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37196         this_arg_conv.is_owned = false;
37197         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37198         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
37199         return tag_ptr(ret_ret, true);
37200 }
37201
37202 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
37203         LDKIgnoringMessageHandler this_arg_conv;
37204         this_arg_conv.inner = untag_ptr(this_arg);
37205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37207         this_arg_conv.is_owned = false;
37208         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
37209         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
37210         return tag_ptr(ret_ret, true);
37211 }
37212
37213 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
37214         LDKIgnoringMessageHandler this_arg_conv;
37215         this_arg_conv.inner = untag_ptr(this_arg);
37216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37218         this_arg_conv.is_owned = false;
37219         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
37220         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
37221         return tag_ptr(ret_ret, true);
37222 }
37223
37224 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
37225         LDKIgnoringMessageHandler this_arg_conv;
37226         this_arg_conv.inner = untag_ptr(this_arg);
37227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37229         this_arg_conv.is_owned = false;
37230         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
37231         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
37232         return tag_ptr(ret_ret, true);
37233 }
37234
37235 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
37236         LDKIgnoringMessageHandler this_arg_conv;
37237         this_arg_conv.inner = untag_ptr(this_arg);
37238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37240         this_arg_conv.is_owned = false;
37241         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
37242         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
37243         return tag_ptr(ret_ret, true);
37244 }
37245
37246 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
37247         LDKIgnoringMessageHandler this_arg_conv;
37248         this_arg_conv.inner = untag_ptr(this_arg);
37249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37251         this_arg_conv.is_owned = false;
37252         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
37253         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
37254         return tag_ptr(ret_ret, true);
37255 }
37256
37257 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
37258         LDKErroringMessageHandler this_obj_conv;
37259         this_obj_conv.inner = untag_ptr(this_obj);
37260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37262         ErroringMessageHandler_free(this_obj_conv);
37263 }
37264
37265 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
37266         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
37267         uint64_t ret_ref = 0;
37268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37270         return ret_ref;
37271 }
37272
37273 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37274         LDKErroringMessageHandler this_arg_conv;
37275         this_arg_conv.inner = untag_ptr(this_arg);
37276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37278         this_arg_conv.is_owned = false;
37279         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37280         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37281         return tag_ptr(ret_ret, true);
37282 }
37283
37284 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
37285         LDKErroringMessageHandler this_arg_conv;
37286         this_arg_conv.inner = untag_ptr(this_arg);
37287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37289         this_arg_conv.is_owned = false;
37290         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
37291         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
37292         return tag_ptr(ret_ret, true);
37293 }
37294
37295 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
37296         LDKMessageHandler this_obj_conv;
37297         this_obj_conv.inner = untag_ptr(this_obj);
37298         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37300         MessageHandler_free(this_obj_conv);
37301 }
37302
37303 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
37304         LDKMessageHandler this_ptr_conv;
37305         this_ptr_conv.inner = untag_ptr(this_ptr);
37306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37308         this_ptr_conv.is_owned = false;
37309         // WARNING: This object doesn't live past this scope, needs clone!
37310         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
37311         return ret_ret;
37312 }
37313
37314 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
37315         LDKMessageHandler this_ptr_conv;
37316         this_ptr_conv.inner = untag_ptr(this_ptr);
37317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37319         this_ptr_conv.is_owned = false;
37320         void* val_ptr = untag_ptr(val);
37321         CHECK_ACCESS(val_ptr);
37322         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
37323         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
37324                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37325                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
37326         }
37327         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
37328 }
37329
37330 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
37331         LDKMessageHandler this_ptr_conv;
37332         this_ptr_conv.inner = untag_ptr(this_ptr);
37333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37335         this_ptr_conv.is_owned = false;
37336         // WARNING: This object doesn't live past this scope, needs clone!
37337         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
37338         return ret_ret;
37339 }
37340
37341 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
37342         LDKMessageHandler this_ptr_conv;
37343         this_ptr_conv.inner = untag_ptr(this_ptr);
37344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37346         this_ptr_conv.is_owned = false;
37347         void* val_ptr = untag_ptr(val);
37348         CHECK_ACCESS(val_ptr);
37349         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
37350         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37351                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37352                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
37353         }
37354         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
37355 }
37356
37357 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
37358         LDKMessageHandler this_ptr_conv;
37359         this_ptr_conv.inner = untag_ptr(this_ptr);
37360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37362         this_ptr_conv.is_owned = false;
37363         // WARNING: This object doesn't live past this scope, needs clone!
37364         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
37365         return ret_ret;
37366 }
37367
37368 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
37369         LDKMessageHandler this_ptr_conv;
37370         this_ptr_conv.inner = untag_ptr(this_ptr);
37371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37373         this_ptr_conv.is_owned = false;
37374         void* val_ptr = untag_ptr(val);
37375         CHECK_ACCESS(val_ptr);
37376         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
37377         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
37378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37379                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
37380         }
37381         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
37382 }
37383
37384 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) {
37385         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
37386         CHECK_ACCESS(chan_handler_arg_ptr);
37387         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
37388         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
37389                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37390                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
37391         }
37392         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
37393         CHECK_ACCESS(route_handler_arg_ptr);
37394         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
37395         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37396                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37397                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37398         }
37399         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
37400         CHECK_ACCESS(onion_message_handler_arg_ptr);
37401         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
37402         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
37403                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37404                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
37405         }
37406         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
37407         uint64_t ret_ref = 0;
37408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37410         return ret_ref;
37411 }
37412
37413 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37414         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37415         *ret_ret = SocketDescriptor_clone(arg);
37416         return tag_ptr(ret_ret, true);
37417 }
37418 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
37419         void* arg_ptr = untag_ptr(arg);
37420         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37421         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37422         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37423         return ret_conv;
37424 }
37425
37426 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
37427         void* orig_ptr = untag_ptr(orig);
37428         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37429         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37430         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37431         *ret_ret = SocketDescriptor_clone(orig_conv);
37432         return tag_ptr(ret_ret, true);
37433 }
37434
37435 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
37436         if (!ptr_is_owned(this_ptr)) return;
37437         void* this_ptr_ptr = untag_ptr(this_ptr);
37438         CHECK_ACCESS(this_ptr_ptr);
37439         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37440         FREE(untag_ptr(this_ptr));
37441         SocketDescriptor_free(this_ptr_conv);
37442 }
37443
37444 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
37445         LDKPeerHandleError this_obj_conv;
37446         this_obj_conv.inner = untag_ptr(this_obj);
37447         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37449         PeerHandleError_free(this_obj_conv);
37450 }
37451
37452 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
37453         LDKPeerHandleError ret_var = PeerHandleError_new();
37454         uint64_t ret_ref = 0;
37455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37457         return ret_ref;
37458 }
37459
37460 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37461         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37462         uint64_t ret_ref = 0;
37463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37465         return ret_ref;
37466 }
37467 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
37468         LDKPeerHandleError arg_conv;
37469         arg_conv.inner = untag_ptr(arg);
37470         arg_conv.is_owned = ptr_is_owned(arg);
37471         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37472         arg_conv.is_owned = false;
37473         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37474         return ret_conv;
37475 }
37476
37477 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
37478         LDKPeerHandleError orig_conv;
37479         orig_conv.inner = untag_ptr(orig);
37480         orig_conv.is_owned = ptr_is_owned(orig);
37481         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37482         orig_conv.is_owned = false;
37483         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37484         uint64_t ret_ref = 0;
37485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37487         return ret_ref;
37488 }
37489
37490 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
37491         LDKPeerManager this_obj_conv;
37492         this_obj_conv.inner = untag_ptr(this_obj);
37493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37495         PeerManager_free(this_obj_conv);
37496 }
37497
37498 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) {
37499         LDKMessageHandler message_handler_conv;
37500         message_handler_conv.inner = untag_ptr(message_handler);
37501         message_handler_conv.is_owned = ptr_is_owned(message_handler);
37502         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37503         // WARNING: we need a move here but no clone is available for LDKMessageHandler
37504         
37505         uint8_t ephemeral_random_data_arr[32];
37506         CHECK(ephemeral_random_data->arr_len == 32);
37507         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
37508         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37509         void* logger_ptr = untag_ptr(logger);
37510         CHECK_ACCESS(logger_ptr);
37511         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37512         if (logger_conv.free == LDKLogger_JCalls_free) {
37513                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37514                 LDKLogger_JCalls_cloned(&logger_conv);
37515         }
37516         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
37517         CHECK_ACCESS(custom_message_handler_ptr);
37518         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37519         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37520                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37521                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37522         }
37523         void* node_signer_ptr = untag_ptr(node_signer);
37524         CHECK_ACCESS(node_signer_ptr);
37525         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
37526         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
37527                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37528                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
37529         }
37530         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_conv);
37531         uint64_t ret_ref = 0;
37532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37534         return ret_ref;
37535 }
37536
37537 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
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         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37544         uint64_tArray ret_arr = NULL;
37545         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
37546         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
37547         for (size_t o = 0; o < ret_var.datalen; o++) {
37548                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
37549                 *ret_conv_40_conv = ret_var.data[o];
37550                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
37551         }
37552         
37553         FREE(ret_var.data);
37554         return ret_arr;
37555 }
37556
37557 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) {
37558         LDKPeerManager this_arg_conv;
37559         this_arg_conv.inner = untag_ptr(this_arg);
37560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37562         this_arg_conv.is_owned = false;
37563         LDKPublicKey their_node_id_ref;
37564         CHECK(their_node_id->arr_len == 33);
37565         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
37566         void* descriptor_ptr = untag_ptr(descriptor);
37567         CHECK_ACCESS(descriptor_ptr);
37568         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37569         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37570                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37571                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37572         }
37573         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37574         CHECK_ACCESS(remote_network_address_ptr);
37575         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37576         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37577         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37578         return tag_ptr(ret_conv, true);
37579 }
37580
37581 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) {
37582         LDKPeerManager this_arg_conv;
37583         this_arg_conv.inner = untag_ptr(this_arg);
37584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37586         this_arg_conv.is_owned = false;
37587         void* descriptor_ptr = untag_ptr(descriptor);
37588         CHECK_ACCESS(descriptor_ptr);
37589         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37590         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37591                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37592                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37593         }
37594         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37595         CHECK_ACCESS(remote_network_address_ptr);
37596         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37597         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37598         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37599         return tag_ptr(ret_conv, true);
37600 }
37601
37602 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
37603         LDKPeerManager this_arg_conv;
37604         this_arg_conv.inner = untag_ptr(this_arg);
37605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37607         this_arg_conv.is_owned = false;
37608         void* descriptor_ptr = untag_ptr(descriptor);
37609         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37610         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37611         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37612         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37613         return tag_ptr(ret_conv, true);
37614 }
37615
37616 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
37617         LDKPeerManager this_arg_conv;
37618         this_arg_conv.inner = untag_ptr(this_arg);
37619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37621         this_arg_conv.is_owned = false;
37622         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
37623         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
37624         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37625         LDKu8slice data_ref;
37626         data_ref.datalen = data->arr_len;
37627         data_ref.data = data->elems;
37628         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37629         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37630         FREE(data);
37631         return tag_ptr(ret_conv, true);
37632 }
37633
37634 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
37635         LDKPeerManager this_arg_conv;
37636         this_arg_conv.inner = untag_ptr(this_arg);
37637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37639         this_arg_conv.is_owned = false;
37640         PeerManager_process_events(&this_arg_conv);
37641 }
37642
37643 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
37644         LDKPeerManager this_arg_conv;
37645         this_arg_conv.inner = untag_ptr(this_arg);
37646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37648         this_arg_conv.is_owned = false;
37649         void* descriptor_ptr = untag_ptr(descriptor);
37650         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37651         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37652         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37653 }
37654
37655 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
37656         LDKPeerManager this_arg_conv;
37657         this_arg_conv.inner = untag_ptr(this_arg);
37658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37660         this_arg_conv.is_owned = false;
37661         LDKPublicKey node_id_ref;
37662         CHECK(node_id->arr_len == 33);
37663         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
37664         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
37665 }
37666
37667 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
37668         LDKPeerManager this_arg_conv;
37669         this_arg_conv.inner = untag_ptr(this_arg);
37670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37672         this_arg_conv.is_owned = false;
37673         PeerManager_disconnect_all_peers(&this_arg_conv);
37674 }
37675
37676 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
37677         LDKPeerManager this_arg_conv;
37678         this_arg_conv.inner = untag_ptr(this_arg);
37679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37681         this_arg_conv.is_owned = false;
37682         PeerManager_timer_tick_occurred(&this_arg_conv);
37683 }
37684
37685 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) {
37686         LDKPeerManager this_arg_conv;
37687         this_arg_conv.inner = untag_ptr(this_arg);
37688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37690         this_arg_conv.is_owned = false;
37691         LDKThreeBytes rgb_ref;
37692         CHECK(rgb->arr_len == 3);
37693         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
37694         LDKThirtyTwoBytes alias_ref;
37695         CHECK(alias->arr_len == 32);
37696         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
37697         LDKCVec_NetAddressZ addresses_constr;
37698         addresses_constr.datalen = addresses->arr_len;
37699         if (addresses_constr.datalen > 0)
37700                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
37701         else
37702                 addresses_constr.data = NULL;
37703         uint64_t* addresses_vals = addresses->elems;
37704         for (size_t m = 0; m < addresses_constr.datalen; m++) {
37705                 uint64_t addresses_conv_12 = addresses_vals[m];
37706                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
37707                 CHECK_ACCESS(addresses_conv_12_ptr);
37708                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
37709                 addresses_constr.data[m] = addresses_conv_12_conv;
37710         }
37711         FREE(addresses);
37712         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
37713 }
37714
37715 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
37716         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37717         return ret_conv;
37718 }
37719
37720 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
37721         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37722         return ret_conv;
37723 }
37724
37725 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
37726         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
37727         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
37728         return ret_conv;
37729 }
37730
37731 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
37732         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
37733         return ret_conv;
37734 }
37735
37736 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
37737         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
37738         return ret_conv;
37739 }
37740
37741 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
37742         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
37743         return ret_conv;
37744 }
37745
37746 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
37747         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
37748         return ret_conv;
37749 }
37750
37751 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
37752         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
37753         return ret_conv;
37754 }
37755
37756 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
37757         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
37758         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
37759         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
37760         return ret_conv;
37761 }
37762
37763 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
37764         LDKWitness witness_ref;
37765         witness_ref.datalen = witness->arr_len;
37766         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
37767         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
37768         witness_ref.data_is_owned = true;
37769         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37770         *ret_copy = HTLCClaim_from_witness(witness_ref);
37771         uint64_t ret_ref = tag_ptr(ret_copy, true);
37772         return ret_ref;
37773 }
37774
37775 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
37776         uint8_t commitment_seed_arr[32];
37777         CHECK(commitment_seed->arr_len == 32);
37778         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
37779         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
37780         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37781         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
37782         return ret_arr;
37783 }
37784
37785 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) {
37786         LDKCVec_u8Z to_holder_script_ref;
37787         to_holder_script_ref.datalen = to_holder_script->arr_len;
37788         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37789         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37790         LDKCVec_u8Z to_counterparty_script_ref;
37791         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37792         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37793         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37794         LDKOutPoint funding_outpoint_conv;
37795         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37796         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37797         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37798         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37799         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);
37800         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37801         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37802         Transaction_free(ret_var);
37803         return ret_arr;
37804 }
37805
37806 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
37807         LDKCounterpartyCommitmentSecrets this_obj_conv;
37808         this_obj_conv.inner = untag_ptr(this_obj);
37809         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37811         CounterpartyCommitmentSecrets_free(this_obj_conv);
37812 }
37813
37814 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37815         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37816         uint64_t ret_ref = 0;
37817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37819         return ret_ref;
37820 }
37821 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
37822         LDKCounterpartyCommitmentSecrets arg_conv;
37823         arg_conv.inner = untag_ptr(arg);
37824         arg_conv.is_owned = ptr_is_owned(arg);
37825         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37826         arg_conv.is_owned = false;
37827         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37828         return ret_conv;
37829 }
37830
37831 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
37832         LDKCounterpartyCommitmentSecrets orig_conv;
37833         orig_conv.inner = untag_ptr(orig);
37834         orig_conv.is_owned = ptr_is_owned(orig);
37835         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37836         orig_conv.is_owned = false;
37837         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37838         uint64_t ret_ref = 0;
37839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37841         return ret_ref;
37842 }
37843
37844 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
37845         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37846         uint64_t ret_ref = 0;
37847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37849         return ret_ref;
37850 }
37851
37852 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
37853         LDKCounterpartyCommitmentSecrets this_arg_conv;
37854         this_arg_conv.inner = untag_ptr(this_arg);
37855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37857         this_arg_conv.is_owned = false;
37858         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37859         return ret_conv;
37860 }
37861
37862 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
37863         LDKCounterpartyCommitmentSecrets this_arg_conv;
37864         this_arg_conv.inner = untag_ptr(this_arg);
37865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37867         this_arg_conv.is_owned = false;
37868         LDKThirtyTwoBytes secret_ref;
37869         CHECK(secret->arr_len == 32);
37870         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
37871         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37872         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37873         return tag_ptr(ret_conv, true);
37874 }
37875
37876 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
37877         LDKCounterpartyCommitmentSecrets this_arg_conv;
37878         this_arg_conv.inner = untag_ptr(this_arg);
37879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37881         this_arg_conv.is_owned = false;
37882         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37883         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
37884         return ret_arr;
37885 }
37886
37887 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
37888         LDKCounterpartyCommitmentSecrets obj_conv;
37889         obj_conv.inner = untag_ptr(obj);
37890         obj_conv.is_owned = ptr_is_owned(obj);
37891         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37892         obj_conv.is_owned = false;
37893         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37894         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37895         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37896         CVec_u8Z_free(ret_var);
37897         return ret_arr;
37898 }
37899
37900 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
37901         LDKu8slice ser_ref;
37902         ser_ref.datalen = ser->arr_len;
37903         ser_ref.data = ser->elems;
37904         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37905         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37906         FREE(ser);
37907         return tag_ptr(ret_conv, true);
37908 }
37909
37910 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
37911         LDKPublicKey per_commitment_point_ref;
37912         CHECK(per_commitment_point->arr_len == 33);
37913         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37914         uint8_t base_secret_arr[32];
37915         CHECK(base_secret->arr_len == 32);
37916         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
37917         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
37918         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37919         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
37920         return ret_arr;
37921 }
37922
37923 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
37924         LDKPublicKey per_commitment_point_ref;
37925         CHECK(per_commitment_point->arr_len == 33);
37926         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37927         LDKPublicKey base_point_ref;
37928         CHECK(base_point->arr_len == 33);
37929         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
37930         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37931         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
37932         return ret_arr;
37933 }
37934
37935 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) {
37936         uint8_t per_commitment_secret_arr[32];
37937         CHECK(per_commitment_secret->arr_len == 32);
37938         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
37939         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37940         uint8_t countersignatory_revocation_base_secret_arr[32];
37941         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
37942         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
37943         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37944         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37945         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
37946         return ret_arr;
37947 }
37948
37949 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) {
37950         LDKPublicKey per_commitment_point_ref;
37951         CHECK(per_commitment_point->arr_len == 33);
37952         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37953         LDKPublicKey countersignatory_revocation_base_point_ref;
37954         CHECK(countersignatory_revocation_base_point->arr_len == 33);
37955         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
37956         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37957         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
37958         return ret_arr;
37959 }
37960
37961 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
37962         LDKTxCreationKeys this_obj_conv;
37963         this_obj_conv.inner = untag_ptr(this_obj);
37964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37966         TxCreationKeys_free(this_obj_conv);
37967 }
37968
37969 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
37970         LDKTxCreationKeys this_ptr_conv;
37971         this_ptr_conv.inner = untag_ptr(this_ptr);
37972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37974         this_ptr_conv.is_owned = false;
37975         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37976         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37977         return ret_arr;
37978 }
37979
37980 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
37981         LDKTxCreationKeys this_ptr_conv;
37982         this_ptr_conv.inner = untag_ptr(this_ptr);
37983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37985         this_ptr_conv.is_owned = false;
37986         LDKPublicKey val_ref;
37987         CHECK(val->arr_len == 33);
37988         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37989         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37990 }
37991
37992 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
37993         LDKTxCreationKeys this_ptr_conv;
37994         this_ptr_conv.inner = untag_ptr(this_ptr);
37995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37997         this_ptr_conv.is_owned = false;
37998         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37999         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
38000         return ret_arr;
38001 }
38002
38003 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
38004         LDKTxCreationKeys this_ptr_conv;
38005         this_ptr_conv.inner = untag_ptr(this_ptr);
38006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38008         this_ptr_conv.is_owned = false;
38009         LDKPublicKey val_ref;
38010         CHECK(val->arr_len == 33);
38011         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38012         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
38013 }
38014
38015 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
38016         LDKTxCreationKeys this_ptr_conv;
38017         this_ptr_conv.inner = untag_ptr(this_ptr);
38018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38020         this_ptr_conv.is_owned = false;
38021         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38022         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
38023         return ret_arr;
38024 }
38025
38026 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
38027         LDKTxCreationKeys this_ptr_conv;
38028         this_ptr_conv.inner = untag_ptr(this_ptr);
38029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38031         this_ptr_conv.is_owned = false;
38032         LDKPublicKey val_ref;
38033         CHECK(val->arr_len == 33);
38034         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38035         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
38036 }
38037
38038 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
38039         LDKTxCreationKeys this_ptr_conv;
38040         this_ptr_conv.inner = untag_ptr(this_ptr);
38041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38043         this_ptr_conv.is_owned = false;
38044         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38045         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
38046         return ret_arr;
38047 }
38048
38049 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
38050         LDKTxCreationKeys this_ptr_conv;
38051         this_ptr_conv.inner = untag_ptr(this_ptr);
38052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38054         this_ptr_conv.is_owned = false;
38055         LDKPublicKey val_ref;
38056         CHECK(val->arr_len == 33);
38057         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38058         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
38059 }
38060
38061 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
38062         LDKTxCreationKeys this_ptr_conv;
38063         this_ptr_conv.inner = untag_ptr(this_ptr);
38064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38066         this_ptr_conv.is_owned = false;
38067         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38068         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
38069         return ret_arr;
38070 }
38071
38072 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) {
38073         LDKTxCreationKeys this_ptr_conv;
38074         this_ptr_conv.inner = untag_ptr(this_ptr);
38075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38077         this_ptr_conv.is_owned = false;
38078         LDKPublicKey val_ref;
38079         CHECK(val->arr_len == 33);
38080         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38081         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
38082 }
38083
38084 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) {
38085         LDKPublicKey per_commitment_point_arg_ref;
38086         CHECK(per_commitment_point_arg->arr_len == 33);
38087         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
38088         LDKPublicKey revocation_key_arg_ref;
38089         CHECK(revocation_key_arg->arr_len == 33);
38090         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
38091         LDKPublicKey broadcaster_htlc_key_arg_ref;
38092         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
38093         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
38094         LDKPublicKey countersignatory_htlc_key_arg_ref;
38095         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
38096         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
38097         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
38098         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
38099         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
38100         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);
38101         uint64_t ret_ref = 0;
38102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38104         return ret_ref;
38105 }
38106
38107 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
38108         LDKTxCreationKeys a_conv;
38109         a_conv.inner = untag_ptr(a);
38110         a_conv.is_owned = ptr_is_owned(a);
38111         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38112         a_conv.is_owned = false;
38113         LDKTxCreationKeys b_conv;
38114         b_conv.inner = untag_ptr(b);
38115         b_conv.is_owned = ptr_is_owned(b);
38116         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38117         b_conv.is_owned = false;
38118         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
38119         return ret_conv;
38120 }
38121
38122 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
38123         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
38124         uint64_t ret_ref = 0;
38125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38127         return ret_ref;
38128 }
38129 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
38130         LDKTxCreationKeys arg_conv;
38131         arg_conv.inner = untag_ptr(arg);
38132         arg_conv.is_owned = ptr_is_owned(arg);
38133         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38134         arg_conv.is_owned = false;
38135         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
38136         return ret_conv;
38137 }
38138
38139 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
38140         LDKTxCreationKeys orig_conv;
38141         orig_conv.inner = untag_ptr(orig);
38142         orig_conv.is_owned = ptr_is_owned(orig);
38143         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38144         orig_conv.is_owned = false;
38145         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
38146         uint64_t ret_ref = 0;
38147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38149         return ret_ref;
38150 }
38151
38152 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
38153         LDKTxCreationKeys obj_conv;
38154         obj_conv.inner = untag_ptr(obj);
38155         obj_conv.is_owned = ptr_is_owned(obj);
38156         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38157         obj_conv.is_owned = false;
38158         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
38159         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38160         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38161         CVec_u8Z_free(ret_var);
38162         return ret_arr;
38163 }
38164
38165 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
38166         LDKu8slice ser_ref;
38167         ser_ref.datalen = ser->arr_len;
38168         ser_ref.data = ser->elems;
38169         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
38170         *ret_conv = TxCreationKeys_read(ser_ref);
38171         FREE(ser);
38172         return tag_ptr(ret_conv, true);
38173 }
38174
38175 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
38176         LDKChannelPublicKeys this_obj_conv;
38177         this_obj_conv.inner = untag_ptr(this_obj);
38178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38180         ChannelPublicKeys_free(this_obj_conv);
38181 }
38182
38183 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
38184         LDKChannelPublicKeys this_ptr_conv;
38185         this_ptr_conv.inner = untag_ptr(this_ptr);
38186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38188         this_ptr_conv.is_owned = false;
38189         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38190         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38191         return ret_arr;
38192 }
38193
38194 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38195         LDKChannelPublicKeys this_ptr_conv;
38196         this_ptr_conv.inner = untag_ptr(this_ptr);
38197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38199         this_ptr_conv.is_owned = false;
38200         LDKPublicKey val_ref;
38201         CHECK(val->arr_len == 33);
38202         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38203         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
38204 }
38205
38206 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
38207         LDKChannelPublicKeys this_ptr_conv;
38208         this_ptr_conv.inner = untag_ptr(this_ptr);
38209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38211         this_ptr_conv.is_owned = false;
38212         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38213         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38214         return ret_arr;
38215 }
38216
38217 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38218         LDKChannelPublicKeys this_ptr_conv;
38219         this_ptr_conv.inner = untag_ptr(this_ptr);
38220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38222         this_ptr_conv.is_owned = false;
38223         LDKPublicKey val_ref;
38224         CHECK(val->arr_len == 33);
38225         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38226         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
38227 }
38228
38229 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
38230         LDKChannelPublicKeys this_ptr_conv;
38231         this_ptr_conv.inner = untag_ptr(this_ptr);
38232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38234         this_ptr_conv.is_owned = false;
38235         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38236         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
38237         return ret_arr;
38238 }
38239
38240 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38241         LDKChannelPublicKeys this_ptr_conv;
38242         this_ptr_conv.inner = untag_ptr(this_ptr);
38243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38245         this_ptr_conv.is_owned = false;
38246         LDKPublicKey val_ref;
38247         CHECK(val->arr_len == 33);
38248         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38249         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
38250 }
38251
38252 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
38253         LDKChannelPublicKeys this_ptr_conv;
38254         this_ptr_conv.inner = untag_ptr(this_ptr);
38255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38257         this_ptr_conv.is_owned = false;
38258         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38259         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38260         return ret_arr;
38261 }
38262
38263 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38264         LDKChannelPublicKeys this_ptr_conv;
38265         this_ptr_conv.inner = untag_ptr(this_ptr);
38266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38268         this_ptr_conv.is_owned = false;
38269         LDKPublicKey val_ref;
38270         CHECK(val->arr_len == 33);
38271         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38272         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38273 }
38274
38275 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
38276         LDKChannelPublicKeys this_ptr_conv;
38277         this_ptr_conv.inner = untag_ptr(this_ptr);
38278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38280         this_ptr_conv.is_owned = false;
38281         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38282         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38283         return ret_arr;
38284 }
38285
38286 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38287         LDKChannelPublicKeys this_ptr_conv;
38288         this_ptr_conv.inner = untag_ptr(this_ptr);
38289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38291         this_ptr_conv.is_owned = false;
38292         LDKPublicKey val_ref;
38293         CHECK(val->arr_len == 33);
38294         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38295         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
38296 }
38297
38298 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) {
38299         LDKPublicKey funding_pubkey_arg_ref;
38300         CHECK(funding_pubkey_arg->arr_len == 33);
38301         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38302         LDKPublicKey revocation_basepoint_arg_ref;
38303         CHECK(revocation_basepoint_arg->arr_len == 33);
38304         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38305         LDKPublicKey payment_point_arg_ref;
38306         CHECK(payment_point_arg->arr_len == 33);
38307         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38308         LDKPublicKey delayed_payment_basepoint_arg_ref;
38309         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38310         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38311         LDKPublicKey htlc_basepoint_arg_ref;
38312         CHECK(htlc_basepoint_arg->arr_len == 33);
38313         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38314         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);
38315         uint64_t ret_ref = 0;
38316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38318         return ret_ref;
38319 }
38320
38321 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
38322         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
38323         uint64_t ret_ref = 0;
38324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38326         return ret_ref;
38327 }
38328 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
38329         LDKChannelPublicKeys arg_conv;
38330         arg_conv.inner = untag_ptr(arg);
38331         arg_conv.is_owned = ptr_is_owned(arg);
38332         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38333         arg_conv.is_owned = false;
38334         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
38335         return ret_conv;
38336 }
38337
38338 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
38339         LDKChannelPublicKeys orig_conv;
38340         orig_conv.inner = untag_ptr(orig);
38341         orig_conv.is_owned = ptr_is_owned(orig);
38342         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38343         orig_conv.is_owned = false;
38344         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
38345         uint64_t ret_ref = 0;
38346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38348         return ret_ref;
38349 }
38350
38351 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
38352         LDKChannelPublicKeys a_conv;
38353         a_conv.inner = untag_ptr(a);
38354         a_conv.is_owned = ptr_is_owned(a);
38355         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38356         a_conv.is_owned = false;
38357         LDKChannelPublicKeys b_conv;
38358         b_conv.inner = untag_ptr(b);
38359         b_conv.is_owned = ptr_is_owned(b);
38360         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38361         b_conv.is_owned = false;
38362         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
38363         return ret_conv;
38364 }
38365
38366 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
38367         LDKChannelPublicKeys obj_conv;
38368         obj_conv.inner = untag_ptr(obj);
38369         obj_conv.is_owned = ptr_is_owned(obj);
38370         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38371         obj_conv.is_owned = false;
38372         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
38373         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38374         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38375         CVec_u8Z_free(ret_var);
38376         return ret_arr;
38377 }
38378
38379 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
38380         LDKu8slice ser_ref;
38381         ser_ref.datalen = ser->arr_len;
38382         ser_ref.data = ser->elems;
38383         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
38384         *ret_conv = ChannelPublicKeys_read(ser_ref);
38385         FREE(ser);
38386         return tag_ptr(ret_conv, true);
38387 }
38388
38389 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) {
38390         LDKPublicKey per_commitment_point_ref;
38391         CHECK(per_commitment_point->arr_len == 33);
38392         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38393         LDKPublicKey broadcaster_delayed_payment_base_ref;
38394         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
38395         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
38396         LDKPublicKey broadcaster_htlc_base_ref;
38397         CHECK(broadcaster_htlc_base->arr_len == 33);
38398         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
38399         LDKPublicKey countersignatory_revocation_base_ref;
38400         CHECK(countersignatory_revocation_base->arr_len == 33);
38401         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
38402         LDKPublicKey countersignatory_htlc_base_ref;
38403         CHECK(countersignatory_htlc_base->arr_len == 33);
38404         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
38405         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);
38406         uint64_t ret_ref = 0;
38407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38409         return ret_ref;
38410 }
38411
38412 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) {
38413         LDKPublicKey per_commitment_point_ref;
38414         CHECK(per_commitment_point->arr_len == 33);
38415         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38416         LDKChannelPublicKeys broadcaster_keys_conv;
38417         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
38418         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
38419         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38420         broadcaster_keys_conv.is_owned = false;
38421         LDKChannelPublicKeys countersignatory_keys_conv;
38422         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
38423         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
38424         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38425         countersignatory_keys_conv.is_owned = false;
38426         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
38427         uint64_t ret_ref = 0;
38428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38430         return ret_ref;
38431 }
38432
38433 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) {
38434         LDKPublicKey revocation_key_ref;
38435         CHECK(revocation_key->arr_len == 33);
38436         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38437         LDKPublicKey broadcaster_delayed_payment_key_ref;
38438         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38439         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38440         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
38441         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38442         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38443         CVec_u8Z_free(ret_var);
38444         return ret_arr;
38445 }
38446
38447 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
38448         LDKHTLCOutputInCommitment this_obj_conv;
38449         this_obj_conv.inner = untag_ptr(this_obj);
38450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38452         HTLCOutputInCommitment_free(this_obj_conv);
38453 }
38454
38455 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
38456         LDKHTLCOutputInCommitment this_ptr_conv;
38457         this_ptr_conv.inner = untag_ptr(this_ptr);
38458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38460         this_ptr_conv.is_owned = false;
38461         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
38462         return ret_conv;
38463 }
38464
38465 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
38466         LDKHTLCOutputInCommitment this_ptr_conv;
38467         this_ptr_conv.inner = untag_ptr(this_ptr);
38468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38470         this_ptr_conv.is_owned = false;
38471         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
38472 }
38473
38474 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
38475         LDKHTLCOutputInCommitment this_ptr_conv;
38476         this_ptr_conv.inner = untag_ptr(this_ptr);
38477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38479         this_ptr_conv.is_owned = false;
38480         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
38481         return ret_conv;
38482 }
38483
38484 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
38485         LDKHTLCOutputInCommitment this_ptr_conv;
38486         this_ptr_conv.inner = untag_ptr(this_ptr);
38487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38489         this_ptr_conv.is_owned = false;
38490         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
38491 }
38492
38493 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
38494         LDKHTLCOutputInCommitment this_ptr_conv;
38495         this_ptr_conv.inner = untag_ptr(this_ptr);
38496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38498         this_ptr_conv.is_owned = false;
38499         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
38500         return ret_conv;
38501 }
38502
38503 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t 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         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38510 }
38511
38512 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
38513         LDKHTLCOutputInCommitment this_ptr_conv;
38514         this_ptr_conv.inner = untag_ptr(this_ptr);
38515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38517         this_ptr_conv.is_owned = false;
38518         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38519         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
38520         return ret_arr;
38521 }
38522
38523 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
38524         LDKHTLCOutputInCommitment this_ptr_conv;
38525         this_ptr_conv.inner = untag_ptr(this_ptr);
38526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38528         this_ptr_conv.is_owned = false;
38529         LDKThirtyTwoBytes val_ref;
38530         CHECK(val->arr_len == 32);
38531         memcpy(val_ref.data, val->elems, 32); FREE(val);
38532         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38533 }
38534
38535 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
38536         LDKHTLCOutputInCommitment this_ptr_conv;
38537         this_ptr_conv.inner = untag_ptr(this_ptr);
38538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38540         this_ptr_conv.is_owned = false;
38541         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38542         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38543         uint64_t ret_ref = tag_ptr(ret_copy, true);
38544         return ret_ref;
38545 }
38546
38547 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
38548         LDKHTLCOutputInCommitment this_ptr_conv;
38549         this_ptr_conv.inner = untag_ptr(this_ptr);
38550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38552         this_ptr_conv.is_owned = false;
38553         void* val_ptr = untag_ptr(val);
38554         CHECK_ACCESS(val_ptr);
38555         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38556         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38557         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38558 }
38559
38560 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) {
38561         LDKThirtyTwoBytes payment_hash_arg_ref;
38562         CHECK(payment_hash_arg->arr_len == 32);
38563         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
38564         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
38565         CHECK_ACCESS(transaction_output_index_arg_ptr);
38566         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38567         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
38568         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38569         uint64_t ret_ref = 0;
38570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38572         return ret_ref;
38573 }
38574
38575 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38576         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38577         uint64_t ret_ref = 0;
38578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38580         return ret_ref;
38581 }
38582 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
38583         LDKHTLCOutputInCommitment arg_conv;
38584         arg_conv.inner = untag_ptr(arg);
38585         arg_conv.is_owned = ptr_is_owned(arg);
38586         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38587         arg_conv.is_owned = false;
38588         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38589         return ret_conv;
38590 }
38591
38592 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
38593         LDKHTLCOutputInCommitment orig_conv;
38594         orig_conv.inner = untag_ptr(orig);
38595         orig_conv.is_owned = ptr_is_owned(orig);
38596         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38597         orig_conv.is_owned = false;
38598         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38599         uint64_t ret_ref = 0;
38600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38602         return ret_ref;
38603 }
38604
38605 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
38606         LDKHTLCOutputInCommitment a_conv;
38607         a_conv.inner = untag_ptr(a);
38608         a_conv.is_owned = ptr_is_owned(a);
38609         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38610         a_conv.is_owned = false;
38611         LDKHTLCOutputInCommitment b_conv;
38612         b_conv.inner = untag_ptr(b);
38613         b_conv.is_owned = ptr_is_owned(b);
38614         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38615         b_conv.is_owned = false;
38616         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
38617         return ret_conv;
38618 }
38619
38620 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
38621         LDKHTLCOutputInCommitment obj_conv;
38622         obj_conv.inner = untag_ptr(obj);
38623         obj_conv.is_owned = ptr_is_owned(obj);
38624         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38625         obj_conv.is_owned = false;
38626         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38627         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38628         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38629         CVec_u8Z_free(ret_var);
38630         return ret_arr;
38631 }
38632
38633 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
38634         LDKu8slice ser_ref;
38635         ser_ref.datalen = ser->arr_len;
38636         ser_ref.data = ser->elems;
38637         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38638         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38639         FREE(ser);
38640         return tag_ptr(ret_conv, true);
38641 }
38642
38643 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
38644         LDKHTLCOutputInCommitment htlc_conv;
38645         htlc_conv.inner = untag_ptr(htlc);
38646         htlc_conv.is_owned = ptr_is_owned(htlc);
38647         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38648         htlc_conv.is_owned = false;
38649         LDKTxCreationKeys keys_conv;
38650         keys_conv.inner = untag_ptr(keys);
38651         keys_conv.is_owned = ptr_is_owned(keys);
38652         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38653         keys_conv.is_owned = false;
38654         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38655         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38656         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38657         CVec_u8Z_free(ret_var);
38658         return ret_arr;
38659 }
38660
38661 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
38662         LDKPublicKey broadcaster_ref;
38663         CHECK(broadcaster->arr_len == 33);
38664         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
38665         LDKPublicKey countersignatory_ref;
38666         CHECK(countersignatory->arr_len == 33);
38667         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
38668         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38669         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38670         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38671         CVec_u8Z_free(ret_var);
38672         return ret_arr;
38673 }
38674
38675 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) {
38676         uint8_t commitment_txid_arr[32];
38677         CHECK(commitment_txid->arr_len == 32);
38678         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
38679         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
38680         LDKHTLCOutputInCommitment htlc_conv;
38681         htlc_conv.inner = untag_ptr(htlc);
38682         htlc_conv.is_owned = ptr_is_owned(htlc);
38683         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38684         htlc_conv.is_owned = false;
38685         LDKPublicKey broadcaster_delayed_payment_key_ref;
38686         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38687         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38688         LDKPublicKey revocation_key_ref;
38689         CHECK(revocation_key->arr_len == 33);
38690         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38691         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);
38692         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38693         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38694         Transaction_free(ret_var);
38695         return ret_arr;
38696 }
38697
38698 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) {
38699         LDKSignature local_sig_ref;
38700         CHECK(local_sig->arr_len == 64);
38701         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
38702         LDKSignature remote_sig_ref;
38703         CHECK(remote_sig->arr_len == 64);
38704         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
38705         LDKThirtyTwoBytes preimage_ref;
38706         CHECK(preimage->arr_len == 32);
38707         memcpy(preimage_ref.data, preimage->elems, 32); FREE(preimage);
38708         LDKu8slice redeem_script_ref;
38709         redeem_script_ref.datalen = redeem_script->arr_len;
38710         redeem_script_ref.data = redeem_script->elems;
38711         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors);
38712         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38713         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38714         Witness_free(ret_var);
38715         FREE(redeem_script);
38716         return ret_arr;
38717 }
38718
38719 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
38720         LDKPublicKey payment_point_ref;
38721         CHECK(payment_point->arr_len == 33);
38722         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
38723         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
38724         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38725         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38726         CVec_u8Z_free(ret_var);
38727         return ret_arr;
38728 }
38729
38730 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
38731         LDKPublicKey funding_pubkey_ref;
38732         CHECK(funding_pubkey->arr_len == 33);
38733         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
38734         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38735         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38736         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38737         CVec_u8Z_free(ret_var);
38738         return ret_arr;
38739 }
38740
38741 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
38742         LDKPublicKey funding_key_ref;
38743         CHECK(funding_key->arr_len == 33);
38744         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
38745         LDKSignature funding_sig_ref;
38746         CHECK(funding_sig->arr_len == 64);
38747         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
38748         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
38749         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38750         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38751         Witness_free(ret_var);
38752         return ret_arr;
38753 }
38754
38755 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
38756         LDKChannelTransactionParameters this_obj_conv;
38757         this_obj_conv.inner = untag_ptr(this_obj);
38758         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38760         ChannelTransactionParameters_free(this_obj_conv);
38761 }
38762
38763 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
38764         LDKChannelTransactionParameters this_ptr_conv;
38765         this_ptr_conv.inner = untag_ptr(this_ptr);
38766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38768         this_ptr_conv.is_owned = false;
38769         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38770         uint64_t ret_ref = 0;
38771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38773         return ret_ref;
38774 }
38775
38776 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
38777         LDKChannelTransactionParameters this_ptr_conv;
38778         this_ptr_conv.inner = untag_ptr(this_ptr);
38779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38781         this_ptr_conv.is_owned = false;
38782         LDKChannelPublicKeys val_conv;
38783         val_conv.inner = untag_ptr(val);
38784         val_conv.is_owned = ptr_is_owned(val);
38785         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38786         val_conv = ChannelPublicKeys_clone(&val_conv);
38787         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38788 }
38789
38790 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
38791         LDKChannelTransactionParameters this_ptr_conv;
38792         this_ptr_conv.inner = untag_ptr(this_ptr);
38793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38795         this_ptr_conv.is_owned = false;
38796         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38797         return ret_conv;
38798 }
38799
38800 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) {
38801         LDKChannelTransactionParameters this_ptr_conv;
38802         this_ptr_conv.inner = untag_ptr(this_ptr);
38803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38805         this_ptr_conv.is_owned = false;
38806         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38807 }
38808
38809 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
38810         LDKChannelTransactionParameters this_ptr_conv;
38811         this_ptr_conv.inner = untag_ptr(this_ptr);
38812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38814         this_ptr_conv.is_owned = false;
38815         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38816         return ret_conv;
38817 }
38818
38819 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
38820         LDKChannelTransactionParameters this_ptr_conv;
38821         this_ptr_conv.inner = untag_ptr(this_ptr);
38822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38824         this_ptr_conv.is_owned = false;
38825         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38826 }
38827
38828 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
38829         LDKChannelTransactionParameters this_ptr_conv;
38830         this_ptr_conv.inner = untag_ptr(this_ptr);
38831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38833         this_ptr_conv.is_owned = false;
38834         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38835         uint64_t ret_ref = 0;
38836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38838         return ret_ref;
38839 }
38840
38841 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
38842         LDKChannelTransactionParameters this_ptr_conv;
38843         this_ptr_conv.inner = untag_ptr(this_ptr);
38844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38846         this_ptr_conv.is_owned = false;
38847         LDKCounterpartyChannelTransactionParameters val_conv;
38848         val_conv.inner = untag_ptr(val);
38849         val_conv.is_owned = ptr_is_owned(val);
38850         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38851         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38852         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38853 }
38854
38855 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
38856         LDKChannelTransactionParameters this_ptr_conv;
38857         this_ptr_conv.inner = untag_ptr(this_ptr);
38858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38860         this_ptr_conv.is_owned = false;
38861         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38862         uint64_t ret_ref = 0;
38863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38865         return ret_ref;
38866 }
38867
38868 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
38869         LDKChannelTransactionParameters this_ptr_conv;
38870         this_ptr_conv.inner = untag_ptr(this_ptr);
38871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38873         this_ptr_conv.is_owned = false;
38874         LDKOutPoint val_conv;
38875         val_conv.inner = untag_ptr(val);
38876         val_conv.is_owned = ptr_is_owned(val);
38877         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38878         val_conv = OutPoint_clone(&val_conv);
38879         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38880 }
38881
38882 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_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_anchors(&this_ptr_conv));
38889         return ret_conv;
38890 }
38891
38892 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_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_anchors(&this_ptr_conv, val_conv);
38900 }
38901
38902 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) {
38903         LDKChannelTransactionParameters this_ptr_conv;
38904         this_ptr_conv.inner = untag_ptr(this_ptr);
38905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38907         this_ptr_conv.is_owned = false;
38908         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_non_zero_fee_anchors(&this_ptr_conv));
38909         return ret_conv;
38910 }
38911
38912 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) {
38913         LDKChannelTransactionParameters this_ptr_conv;
38914         this_ptr_conv.inner = untag_ptr(this_ptr);
38915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38917         this_ptr_conv.is_owned = false;
38918         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38919         ChannelTransactionParameters_set_opt_non_zero_fee_anchors(&this_ptr_conv, val_conv);
38920 }
38921
38922 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) {
38923         LDKChannelPublicKeys holder_pubkeys_arg_conv;
38924         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
38925         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
38926         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38927         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38928         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38929         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
38930         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
38931         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38932         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38933         LDKOutPoint funding_outpoint_arg_conv;
38934         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
38935         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
38936         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38937         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38938         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
38939         LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_non_zero_fee_anchors_arg);
38940         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);
38941         uint64_t ret_ref = 0;
38942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38944         return ret_ref;
38945 }
38946
38947 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38948         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38949         uint64_t ret_ref = 0;
38950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38952         return ret_ref;
38953 }
38954 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
38955         LDKChannelTransactionParameters arg_conv;
38956         arg_conv.inner = untag_ptr(arg);
38957         arg_conv.is_owned = ptr_is_owned(arg);
38958         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38959         arg_conv.is_owned = false;
38960         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38961         return ret_conv;
38962 }
38963
38964 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
38965         LDKChannelTransactionParameters orig_conv;
38966         orig_conv.inner = untag_ptr(orig);
38967         orig_conv.is_owned = ptr_is_owned(orig);
38968         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38969         orig_conv.is_owned = false;
38970         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38971         uint64_t ret_ref = 0;
38972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38974         return ret_ref;
38975 }
38976
38977 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
38978         LDKChannelTransactionParameters a_conv;
38979         a_conv.inner = untag_ptr(a);
38980         a_conv.is_owned = ptr_is_owned(a);
38981         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38982         a_conv.is_owned = false;
38983         LDKChannelTransactionParameters b_conv;
38984         b_conv.inner = untag_ptr(b);
38985         b_conv.is_owned = ptr_is_owned(b);
38986         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38987         b_conv.is_owned = false;
38988         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
38989         return ret_conv;
38990 }
38991
38992 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
38993         LDKCounterpartyChannelTransactionParameters this_obj_conv;
38994         this_obj_conv.inner = untag_ptr(this_obj);
38995         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38997         CounterpartyChannelTransactionParameters_free(this_obj_conv);
38998 }
38999
39000 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
39001         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39002         this_ptr_conv.inner = untag_ptr(this_ptr);
39003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39005         this_ptr_conv.is_owned = false;
39006         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
39007         uint64_t ret_ref = 0;
39008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39010         return ret_ref;
39011 }
39012
39013 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
39014         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39015         this_ptr_conv.inner = untag_ptr(this_ptr);
39016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39018         this_ptr_conv.is_owned = false;
39019         LDKChannelPublicKeys val_conv;
39020         val_conv.inner = untag_ptr(val);
39021         val_conv.is_owned = ptr_is_owned(val);
39022         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39023         val_conv = ChannelPublicKeys_clone(&val_conv);
39024         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
39025 }
39026
39027 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
39028         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39029         this_ptr_conv.inner = untag_ptr(this_ptr);
39030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39032         this_ptr_conv.is_owned = false;
39033         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
39034         return ret_conv;
39035 }
39036
39037 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
39038         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39039         this_ptr_conv.inner = untag_ptr(this_ptr);
39040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39042         this_ptr_conv.is_owned = false;
39043         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
39044 }
39045
39046 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
39047         LDKChannelPublicKeys pubkeys_arg_conv;
39048         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
39049         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
39051         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
39052         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
39053         uint64_t ret_ref = 0;
39054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39056         return ret_ref;
39057 }
39058
39059 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
39060         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
39061         uint64_t ret_ref = 0;
39062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39064         return ret_ref;
39065 }
39066 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
39067         LDKCounterpartyChannelTransactionParameters arg_conv;
39068         arg_conv.inner = untag_ptr(arg);
39069         arg_conv.is_owned = ptr_is_owned(arg);
39070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39071         arg_conv.is_owned = false;
39072         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
39073         return ret_conv;
39074 }
39075
39076 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
39077         LDKCounterpartyChannelTransactionParameters orig_conv;
39078         orig_conv.inner = untag_ptr(orig);
39079         orig_conv.is_owned = ptr_is_owned(orig);
39080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39081         orig_conv.is_owned = false;
39082         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
39083         uint64_t ret_ref = 0;
39084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39086         return ret_ref;
39087 }
39088
39089 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
39090         LDKCounterpartyChannelTransactionParameters a_conv;
39091         a_conv.inner = untag_ptr(a);
39092         a_conv.is_owned = ptr_is_owned(a);
39093         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39094         a_conv.is_owned = false;
39095         LDKCounterpartyChannelTransactionParameters b_conv;
39096         b_conv.inner = untag_ptr(b);
39097         b_conv.is_owned = ptr_is_owned(b);
39098         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39099         b_conv.is_owned = false;
39100         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
39101         return ret_conv;
39102 }
39103
39104 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
39105         LDKChannelTransactionParameters this_arg_conv;
39106         this_arg_conv.inner = untag_ptr(this_arg);
39107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39109         this_arg_conv.is_owned = false;
39110         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
39111         return ret_conv;
39112 }
39113
39114 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
39115         LDKChannelTransactionParameters this_arg_conv;
39116         this_arg_conv.inner = untag_ptr(this_arg);
39117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39119         this_arg_conv.is_owned = false;
39120         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
39121         uint64_t ret_ref = 0;
39122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39124         return ret_ref;
39125 }
39126
39127 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
39128         LDKChannelTransactionParameters this_arg_conv;
39129         this_arg_conv.inner = untag_ptr(this_arg);
39130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39132         this_arg_conv.is_owned = false;
39133         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
39134         uint64_t ret_ref = 0;
39135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39137         return ret_ref;
39138 }
39139
39140 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
39141         LDKCounterpartyChannelTransactionParameters obj_conv;
39142         obj_conv.inner = untag_ptr(obj);
39143         obj_conv.is_owned = ptr_is_owned(obj);
39144         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39145         obj_conv.is_owned = false;
39146         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
39147         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39148         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39149         CVec_u8Z_free(ret_var);
39150         return ret_arr;
39151 }
39152
39153 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
39154         LDKu8slice ser_ref;
39155         ser_ref.datalen = ser->arr_len;
39156         ser_ref.data = ser->elems;
39157         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
39158         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
39159         FREE(ser);
39160         return tag_ptr(ret_conv, true);
39161 }
39162
39163 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
39164         LDKChannelTransactionParameters obj_conv;
39165         obj_conv.inner = untag_ptr(obj);
39166         obj_conv.is_owned = ptr_is_owned(obj);
39167         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39168         obj_conv.is_owned = false;
39169         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
39170         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39171         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39172         CVec_u8Z_free(ret_var);
39173         return ret_arr;
39174 }
39175
39176 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
39177         LDKu8slice ser_ref;
39178         ser_ref.datalen = ser->arr_len;
39179         ser_ref.data = ser->elems;
39180         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
39181         *ret_conv = ChannelTransactionParameters_read(ser_ref);
39182         FREE(ser);
39183         return tag_ptr(ret_conv, true);
39184 }
39185
39186 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
39187         LDKDirectedChannelTransactionParameters this_obj_conv;
39188         this_obj_conv.inner = untag_ptr(this_obj);
39189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39191         DirectedChannelTransactionParameters_free(this_obj_conv);
39192 }
39193
39194 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
39195         LDKDirectedChannelTransactionParameters this_arg_conv;
39196         this_arg_conv.inner = untag_ptr(this_arg);
39197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39199         this_arg_conv.is_owned = false;
39200         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
39201         uint64_t ret_ref = 0;
39202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39204         return ret_ref;
39205 }
39206
39207 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
39208         LDKDirectedChannelTransactionParameters this_arg_conv;
39209         this_arg_conv.inner = untag_ptr(this_arg);
39210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39212         this_arg_conv.is_owned = false;
39213         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
39214         uint64_t ret_ref = 0;
39215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39217         return ret_ref;
39218 }
39219
39220 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(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         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
39227         return ret_conv;
39228 }
39229
39230 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
39231         LDKDirectedChannelTransactionParameters this_arg_conv;
39232         this_arg_conv.inner = untag_ptr(this_arg);
39233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39235         this_arg_conv.is_owned = false;
39236         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
39237         return ret_conv;
39238 }
39239
39240 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
39241         LDKDirectedChannelTransactionParameters this_arg_conv;
39242         this_arg_conv.inner = untag_ptr(this_arg);
39243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39245         this_arg_conv.is_owned = false;
39246         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
39247         uint64_t ret_ref = 0;
39248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39250         return ret_ref;
39251 }
39252
39253 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
39254         LDKDirectedChannelTransactionParameters this_arg_conv;
39255         this_arg_conv.inner = untag_ptr(this_arg);
39256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39258         this_arg_conv.is_owned = false;
39259         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
39260         return ret_conv;
39261 }
39262
39263 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
39264         LDKHolderCommitmentTransaction this_obj_conv;
39265         this_obj_conv.inner = untag_ptr(this_obj);
39266         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39268         HolderCommitmentTransaction_free(this_obj_conv);
39269 }
39270
39271 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
39272         LDKHolderCommitmentTransaction this_ptr_conv;
39273         this_ptr_conv.inner = untag_ptr(this_ptr);
39274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39276         this_ptr_conv.is_owned = false;
39277         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39278         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
39279         return ret_arr;
39280 }
39281
39282 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
39283         LDKHolderCommitmentTransaction this_ptr_conv;
39284         this_ptr_conv.inner = untag_ptr(this_ptr);
39285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39287         this_ptr_conv.is_owned = false;
39288         LDKSignature val_ref;
39289         CHECK(val->arr_len == 64);
39290         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39291         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
39292 }
39293
39294 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
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 ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
39301         ptrArray ret_arr = NULL;
39302         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39303         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39304         for (size_t m = 0; m < ret_var.datalen; m++) {
39305                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
39306                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
39307                 ret_arr_ptr[m] = ret_conv_12_arr;
39308         }
39309         
39310         FREE(ret_var.data);
39311         return ret_arr;
39312 }
39313
39314 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
39315         LDKHolderCommitmentTransaction this_ptr_conv;
39316         this_ptr_conv.inner = untag_ptr(this_ptr);
39317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39319         this_ptr_conv.is_owned = false;
39320         LDKCVec_SignatureZ val_constr;
39321         val_constr.datalen = val->arr_len;
39322         if (val_constr.datalen > 0)
39323                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39324         else
39325                 val_constr.data = NULL;
39326         int8_tArray* val_vals = (void*) val->elems;
39327         for (size_t m = 0; m < val_constr.datalen; m++) {
39328                 int8_tArray val_conv_12 = val_vals[m];
39329                 LDKSignature val_conv_12_ref;
39330                 CHECK(val_conv_12->arr_len == 64);
39331                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
39332                 val_constr.data[m] = val_conv_12_ref;
39333         }
39334         FREE(val);
39335         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
39336 }
39337
39338 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
39339         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
39340         uint64_t ret_ref = 0;
39341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39343         return ret_ref;
39344 }
39345 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
39346         LDKHolderCommitmentTransaction arg_conv;
39347         arg_conv.inner = untag_ptr(arg);
39348         arg_conv.is_owned = ptr_is_owned(arg);
39349         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39350         arg_conv.is_owned = false;
39351         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
39352         return ret_conv;
39353 }
39354
39355 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
39356         LDKHolderCommitmentTransaction orig_conv;
39357         orig_conv.inner = untag_ptr(orig);
39358         orig_conv.is_owned = ptr_is_owned(orig);
39359         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39360         orig_conv.is_owned = false;
39361         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
39362         uint64_t ret_ref = 0;
39363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39365         return ret_ref;
39366 }
39367
39368 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
39369         LDKHolderCommitmentTransaction obj_conv;
39370         obj_conv.inner = untag_ptr(obj);
39371         obj_conv.is_owned = ptr_is_owned(obj);
39372         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39373         obj_conv.is_owned = false;
39374         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
39375         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39376         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39377         CVec_u8Z_free(ret_var);
39378         return ret_arr;
39379 }
39380
39381 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
39382         LDKu8slice ser_ref;
39383         ser_ref.datalen = ser->arr_len;
39384         ser_ref.data = ser->elems;
39385         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
39386         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
39387         FREE(ser);
39388         return tag_ptr(ret_conv, true);
39389 }
39390
39391 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) {
39392         LDKCommitmentTransaction commitment_tx_conv;
39393         commitment_tx_conv.inner = untag_ptr(commitment_tx);
39394         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
39395         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
39396         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
39397         LDKSignature counterparty_sig_ref;
39398         CHECK(counterparty_sig->arr_len == 64);
39399         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
39400         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
39401         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
39402         if (counterparty_htlc_sigs_constr.datalen > 0)
39403                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39404         else
39405                 counterparty_htlc_sigs_constr.data = NULL;
39406         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
39407         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
39408                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
39409                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
39410                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
39411                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
39412                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
39413         }
39414         FREE(counterparty_htlc_sigs);
39415         LDKPublicKey holder_funding_key_ref;
39416         CHECK(holder_funding_key->arr_len == 33);
39417         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
39418         LDKPublicKey counterparty_funding_key_ref;
39419         CHECK(counterparty_funding_key->arr_len == 33);
39420         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
39421         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
39422         uint64_t ret_ref = 0;
39423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39425         return ret_ref;
39426 }
39427
39428 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
39429         LDKBuiltCommitmentTransaction this_obj_conv;
39430         this_obj_conv.inner = untag_ptr(this_obj);
39431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39433         BuiltCommitmentTransaction_free(this_obj_conv);
39434 }
39435
39436 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
39437         LDKBuiltCommitmentTransaction this_ptr_conv;
39438         this_ptr_conv.inner = untag_ptr(this_ptr);
39439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39441         this_ptr_conv.is_owned = false;
39442         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
39443         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39444         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39445         Transaction_free(ret_var);
39446         return ret_arr;
39447 }
39448
39449 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
39450         LDKBuiltCommitmentTransaction this_ptr_conv;
39451         this_ptr_conv.inner = untag_ptr(this_ptr);
39452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39454         this_ptr_conv.is_owned = false;
39455         LDKTransaction val_ref;
39456         val_ref.datalen = val->arr_len;
39457         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
39458         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39459         val_ref.data_is_owned = true;
39460         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
39461 }
39462
39463 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
39464         LDKBuiltCommitmentTransaction this_ptr_conv;
39465         this_ptr_conv.inner = untag_ptr(this_ptr);
39466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39468         this_ptr_conv.is_owned = false;
39469         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39470         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
39471         return ret_arr;
39472 }
39473
39474 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
39475         LDKBuiltCommitmentTransaction this_ptr_conv;
39476         this_ptr_conv.inner = untag_ptr(this_ptr);
39477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39479         this_ptr_conv.is_owned = false;
39480         LDKThirtyTwoBytes val_ref;
39481         CHECK(val->arr_len == 32);
39482         memcpy(val_ref.data, val->elems, 32); FREE(val);
39483         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
39484 }
39485
39486 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
39487         LDKTransaction transaction_arg_ref;
39488         transaction_arg_ref.datalen = transaction_arg->arr_len;
39489         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
39490         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
39491         transaction_arg_ref.data_is_owned = true;
39492         LDKThirtyTwoBytes txid_arg_ref;
39493         CHECK(txid_arg->arr_len == 32);
39494         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
39495         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
39496         uint64_t ret_ref = 0;
39497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39499         return ret_ref;
39500 }
39501
39502 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
39503         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
39504         uint64_t ret_ref = 0;
39505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39507         return ret_ref;
39508 }
39509 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
39510         LDKBuiltCommitmentTransaction arg_conv;
39511         arg_conv.inner = untag_ptr(arg);
39512         arg_conv.is_owned = ptr_is_owned(arg);
39513         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39514         arg_conv.is_owned = false;
39515         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
39516         return ret_conv;
39517 }
39518
39519 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
39520         LDKBuiltCommitmentTransaction orig_conv;
39521         orig_conv.inner = untag_ptr(orig);
39522         orig_conv.is_owned = ptr_is_owned(orig);
39523         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39524         orig_conv.is_owned = false;
39525         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
39526         uint64_t ret_ref = 0;
39527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39529         return ret_ref;
39530 }
39531
39532 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
39533         LDKBuiltCommitmentTransaction obj_conv;
39534         obj_conv.inner = untag_ptr(obj);
39535         obj_conv.is_owned = ptr_is_owned(obj);
39536         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39537         obj_conv.is_owned = false;
39538         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
39539         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39540         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39541         CVec_u8Z_free(ret_var);
39542         return ret_arr;
39543 }
39544
39545 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
39546         LDKu8slice ser_ref;
39547         ser_ref.datalen = ser->arr_len;
39548         ser_ref.data = ser->elems;
39549         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
39550         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
39551         FREE(ser);
39552         return tag_ptr(ret_conv, true);
39553 }
39554
39555 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) {
39556         LDKBuiltCommitmentTransaction this_arg_conv;
39557         this_arg_conv.inner = untag_ptr(this_arg);
39558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39560         this_arg_conv.is_owned = false;
39561         LDKu8slice funding_redeemscript_ref;
39562         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39563         funding_redeemscript_ref.data = funding_redeemscript->elems;
39564         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39565         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39566         FREE(funding_redeemscript);
39567         return ret_arr;
39568 }
39569
39570 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) {
39571         LDKBuiltCommitmentTransaction this_arg_conv;
39572         this_arg_conv.inner = untag_ptr(this_arg);
39573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39575         this_arg_conv.is_owned = false;
39576         uint8_t funding_key_arr[32];
39577         CHECK(funding_key->arr_len == 32);
39578         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39579         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39580         LDKu8slice funding_redeemscript_ref;
39581         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39582         funding_redeemscript_ref.data = funding_redeemscript->elems;
39583         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39584         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39585         FREE(funding_redeemscript);
39586         return ret_arr;
39587 }
39588
39589 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) {
39590         LDKBuiltCommitmentTransaction this_arg_conv;
39591         this_arg_conv.inner = untag_ptr(this_arg);
39592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39594         this_arg_conv.is_owned = false;
39595         uint8_t funding_key_arr[32];
39596         CHECK(funding_key->arr_len == 32);
39597         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39598         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39599         LDKu8slice funding_redeemscript_ref;
39600         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39601         funding_redeemscript_ref.data = funding_redeemscript->elems;
39602         void* entropy_source_ptr = untag_ptr(entropy_source);
39603         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
39604         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
39605         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39606         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);
39607         FREE(funding_redeemscript);
39608         return ret_arr;
39609 }
39610
39611 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
39612         LDKClosingTransaction this_obj_conv;
39613         this_obj_conv.inner = untag_ptr(this_obj);
39614         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39616         ClosingTransaction_free(this_obj_conv);
39617 }
39618
39619 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
39620         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
39621         uint64_t ret_ref = 0;
39622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39624         return ret_ref;
39625 }
39626 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
39627         LDKClosingTransaction arg_conv;
39628         arg_conv.inner = untag_ptr(arg);
39629         arg_conv.is_owned = ptr_is_owned(arg);
39630         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39631         arg_conv.is_owned = false;
39632         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
39633         return ret_conv;
39634 }
39635
39636 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
39637         LDKClosingTransaction orig_conv;
39638         orig_conv.inner = untag_ptr(orig);
39639         orig_conv.is_owned = ptr_is_owned(orig);
39640         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39641         orig_conv.is_owned = false;
39642         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
39643         uint64_t ret_ref = 0;
39644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39646         return ret_ref;
39647 }
39648
39649 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
39650         LDKClosingTransaction o_conv;
39651         o_conv.inner = untag_ptr(o);
39652         o_conv.is_owned = ptr_is_owned(o);
39653         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39654         o_conv.is_owned = false;
39655         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39656         return ret_conv;
39657 }
39658
39659 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
39660         LDKClosingTransaction a_conv;
39661         a_conv.inner = untag_ptr(a);
39662         a_conv.is_owned = ptr_is_owned(a);
39663         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39664         a_conv.is_owned = false;
39665         LDKClosingTransaction b_conv;
39666         b_conv.inner = untag_ptr(b);
39667         b_conv.is_owned = ptr_is_owned(b);
39668         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39669         b_conv.is_owned = false;
39670         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
39671         return ret_conv;
39672 }
39673
39674 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) {
39675         LDKCVec_u8Z to_holder_script_ref;
39676         to_holder_script_ref.datalen = to_holder_script->arr_len;
39677         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39678         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
39679         LDKCVec_u8Z to_counterparty_script_ref;
39680         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
39681         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39682         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
39683         LDKOutPoint funding_outpoint_conv;
39684         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39685         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39686         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39687         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39688         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39689         uint64_t ret_ref = 0;
39690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39692         return ret_ref;
39693 }
39694
39695 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
39696         LDKClosingTransaction this_arg_conv;
39697         this_arg_conv.inner = untag_ptr(this_arg);
39698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39700         this_arg_conv.is_owned = false;
39701         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39702         uint64_t ret_ref = 0;
39703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39705         return ret_ref;
39706 }
39707
39708 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
39709         LDKClosingTransaction this_arg_conv;
39710         this_arg_conv.inner = untag_ptr(this_arg);
39711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39713         this_arg_conv.is_owned = false;
39714         LDKOutPoint funding_outpoint_conv;
39715         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39716         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39717         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39718         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39719         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39720         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39721         return tag_ptr(ret_conv, true);
39722 }
39723
39724 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(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         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39731         return ret_conv;
39732 }
39733
39734 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
39735         LDKClosingTransaction this_arg_conv;
39736         this_arg_conv.inner = untag_ptr(this_arg);
39737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39739         this_arg_conv.is_owned = false;
39740         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39741         return ret_conv;
39742 }
39743
39744 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
39745         LDKClosingTransaction this_arg_conv;
39746         this_arg_conv.inner = untag_ptr(this_arg);
39747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39749         this_arg_conv.is_owned = false;
39750         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39751         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39752         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39753         return ret_arr;
39754 }
39755
39756 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
39757         LDKClosingTransaction 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         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&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         return ret_arr;
39766 }
39767
39768 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
39769         LDKTrustedClosingTransaction this_obj_conv;
39770         this_obj_conv.inner = untag_ptr(this_obj);
39771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39773         TrustedClosingTransaction_free(this_obj_conv);
39774 }
39775
39776 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
39777         LDKTrustedClosingTransaction this_arg_conv;
39778         this_arg_conv.inner = untag_ptr(this_arg);
39779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39781         this_arg_conv.is_owned = false;
39782         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39783         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39784         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39785         Transaction_free(ret_var);
39786         return ret_arr;
39787 }
39788
39789 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) {
39790         LDKTrustedClosingTransaction this_arg_conv;
39791         this_arg_conv.inner = untag_ptr(this_arg);
39792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39794         this_arg_conv.is_owned = false;
39795         LDKu8slice funding_redeemscript_ref;
39796         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39797         funding_redeemscript_ref.data = funding_redeemscript->elems;
39798         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39799         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39800         FREE(funding_redeemscript);
39801         return ret_arr;
39802 }
39803
39804 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) {
39805         LDKTrustedClosingTransaction this_arg_conv;
39806         this_arg_conv.inner = untag_ptr(this_arg);
39807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39809         this_arg_conv.is_owned = false;
39810         uint8_t funding_key_arr[32];
39811         CHECK(funding_key->arr_len == 32);
39812         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39813         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39814         LDKu8slice funding_redeemscript_ref;
39815         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39816         funding_redeemscript_ref.data = funding_redeemscript->elems;
39817         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39818         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39819         FREE(funding_redeemscript);
39820         return ret_arr;
39821 }
39822
39823 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
39824         LDKCommitmentTransaction this_obj_conv;
39825         this_obj_conv.inner = untag_ptr(this_obj);
39826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39828         CommitmentTransaction_free(this_obj_conv);
39829 }
39830
39831 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39832         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39833         uint64_t ret_ref = 0;
39834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39836         return ret_ref;
39837 }
39838 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
39839         LDKCommitmentTransaction arg_conv;
39840         arg_conv.inner = untag_ptr(arg);
39841         arg_conv.is_owned = ptr_is_owned(arg);
39842         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39843         arg_conv.is_owned = false;
39844         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39845         return ret_conv;
39846 }
39847
39848 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
39849         LDKCommitmentTransaction orig_conv;
39850         orig_conv.inner = untag_ptr(orig);
39851         orig_conv.is_owned = ptr_is_owned(orig);
39852         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39853         orig_conv.is_owned = false;
39854         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39855         uint64_t ret_ref = 0;
39856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39858         return ret_ref;
39859 }
39860
39861 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
39862         LDKCommitmentTransaction obj_conv;
39863         obj_conv.inner = untag_ptr(obj);
39864         obj_conv.is_owned = ptr_is_owned(obj);
39865         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39866         obj_conv.is_owned = false;
39867         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39868         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39869         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39870         CVec_u8Z_free(ret_var);
39871         return ret_arr;
39872 }
39873
39874 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
39875         LDKu8slice ser_ref;
39876         ser_ref.datalen = ser->arr_len;
39877         ser_ref.data = ser->elems;
39878         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39879         *ret_conv = CommitmentTransaction_read(ser_ref);
39880         FREE(ser);
39881         return tag_ptr(ret_conv, true);
39882 }
39883
39884 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(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_commitment_number(&this_arg_conv);
39891         return ret_conv;
39892 }
39893
39894 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(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         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39901         return ret_conv;
39902 }
39903
39904 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(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         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39911         return ret_conv;
39912 }
39913
39914 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
39915         LDKCommitmentTransaction this_arg_conv;
39916         this_arg_conv.inner = untag_ptr(this_arg);
39917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39919         this_arg_conv.is_owned = false;
39920         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39921         return ret_conv;
39922 }
39923
39924 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
39925         LDKCommitmentTransaction this_arg_conv;
39926         this_arg_conv.inner = untag_ptr(this_arg);
39927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39929         this_arg_conv.is_owned = false;
39930         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39931         uint64_t ret_ref = 0;
39932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39934         return ret_ref;
39935 }
39936
39937 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) {
39938         LDKCommitmentTransaction this_arg_conv;
39939         this_arg_conv.inner = untag_ptr(this_arg);
39940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39942         this_arg_conv.is_owned = false;
39943         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39944         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39945         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39946         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39947         channel_parameters_conv.is_owned = false;
39948         LDKChannelPublicKeys broadcaster_keys_conv;
39949         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39950         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39951         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39952         broadcaster_keys_conv.is_owned = false;
39953         LDKChannelPublicKeys countersignatory_keys_conv;
39954         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39955         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39956         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39957         countersignatory_keys_conv.is_owned = false;
39958         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39959         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39960         return tag_ptr(ret_conv, true);
39961 }
39962
39963 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
39964         LDKTrustedCommitmentTransaction this_obj_conv;
39965         this_obj_conv.inner = untag_ptr(this_obj);
39966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39968         TrustedCommitmentTransaction_free(this_obj_conv);
39969 }
39970
39971 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
39972         LDKTrustedCommitmentTransaction this_arg_conv;
39973         this_arg_conv.inner = untag_ptr(this_arg);
39974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39976         this_arg_conv.is_owned = false;
39977         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39978         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
39979         return ret_arr;
39980 }
39981
39982 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
39983         LDKTrustedCommitmentTransaction this_arg_conv;
39984         this_arg_conv.inner = untag_ptr(this_arg);
39985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39987         this_arg_conv.is_owned = false;
39988         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39989         uint64_t ret_ref = 0;
39990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39992         return ret_ref;
39993 }
39994
39995 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
39996         LDKTrustedCommitmentTransaction this_arg_conv;
39997         this_arg_conv.inner = untag_ptr(this_arg);
39998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40000         this_arg_conv.is_owned = false;
40001         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
40002         uint64_t ret_ref = 0;
40003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40005         return ret_ref;
40006 }
40007
40008 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
40009         LDKTrustedCommitmentTransaction this_arg_conv;
40010         this_arg_conv.inner = untag_ptr(this_arg);
40011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40013         this_arg_conv.is_owned = false;
40014         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
40015         return ret_conv;
40016 }
40017
40018 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) {
40019         LDKTrustedCommitmentTransaction this_arg_conv;
40020         this_arg_conv.inner = untag_ptr(this_arg);
40021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40023         this_arg_conv.is_owned = false;
40024         uint8_t htlc_base_key_arr[32];
40025         CHECK(htlc_base_key->arr_len == 32);
40026         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
40027         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
40028         LDKDirectedChannelTransactionParameters channel_parameters_conv;
40029         channel_parameters_conv.inner = untag_ptr(channel_parameters);
40030         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
40031         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40032         channel_parameters_conv.is_owned = false;
40033         void* entropy_source_ptr = untag_ptr(entropy_source);
40034         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
40035         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
40036         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
40037         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
40038         return tag_ptr(ret_conv, true);
40039 }
40040
40041 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) {
40042         LDKPublicKey broadcaster_payment_basepoint_ref;
40043         CHECK(broadcaster_payment_basepoint->arr_len == 33);
40044         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
40045         LDKPublicKey countersignatory_payment_basepoint_ref;
40046         CHECK(countersignatory_payment_basepoint->arr_len == 33);
40047         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
40048         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
40049         return ret_conv;
40050 }
40051
40052 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
40053         LDKInitFeatures a_conv;
40054         a_conv.inner = untag_ptr(a);
40055         a_conv.is_owned = ptr_is_owned(a);
40056         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40057         a_conv.is_owned = false;
40058         LDKInitFeatures b_conv;
40059         b_conv.inner = untag_ptr(b);
40060         b_conv.is_owned = ptr_is_owned(b);
40061         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40062         b_conv.is_owned = false;
40063         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
40064         return ret_conv;
40065 }
40066
40067 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
40068         LDKNodeFeatures a_conv;
40069         a_conv.inner = untag_ptr(a);
40070         a_conv.is_owned = ptr_is_owned(a);
40071         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40072         a_conv.is_owned = false;
40073         LDKNodeFeatures b_conv;
40074         b_conv.inner = untag_ptr(b);
40075         b_conv.is_owned = ptr_is_owned(b);
40076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40077         b_conv.is_owned = false;
40078         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
40079         return ret_conv;
40080 }
40081
40082 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
40083         LDKChannelFeatures a_conv;
40084         a_conv.inner = untag_ptr(a);
40085         a_conv.is_owned = ptr_is_owned(a);
40086         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40087         a_conv.is_owned = false;
40088         LDKChannelFeatures b_conv;
40089         b_conv.inner = untag_ptr(b);
40090         b_conv.is_owned = ptr_is_owned(b);
40091         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40092         b_conv.is_owned = false;
40093         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
40094         return ret_conv;
40095 }
40096
40097 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40098         LDKInvoiceFeatures a_conv;
40099         a_conv.inner = untag_ptr(a);
40100         a_conv.is_owned = ptr_is_owned(a);
40101         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40102         a_conv.is_owned = false;
40103         LDKInvoiceFeatures b_conv;
40104         b_conv.inner = untag_ptr(b);
40105         b_conv.is_owned = ptr_is_owned(b);
40106         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40107         b_conv.is_owned = false;
40108         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
40109         return ret_conv;
40110 }
40111
40112 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
40113         LDKOfferFeatures a_conv;
40114         a_conv.inner = untag_ptr(a);
40115         a_conv.is_owned = ptr_is_owned(a);
40116         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40117         a_conv.is_owned = false;
40118         LDKOfferFeatures b_conv;
40119         b_conv.inner = untag_ptr(b);
40120         b_conv.is_owned = ptr_is_owned(b);
40121         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40122         b_conv.is_owned = false;
40123         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
40124         return ret_conv;
40125 }
40126
40127 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
40128         LDKInvoiceRequestFeatures a_conv;
40129         a_conv.inner = untag_ptr(a);
40130         a_conv.is_owned = ptr_is_owned(a);
40131         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40132         a_conv.is_owned = false;
40133         LDKInvoiceRequestFeatures b_conv;
40134         b_conv.inner = untag_ptr(b);
40135         b_conv.is_owned = ptr_is_owned(b);
40136         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40137         b_conv.is_owned = false;
40138         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
40139         return ret_conv;
40140 }
40141
40142 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40143         LDKBolt12InvoiceFeatures a_conv;
40144         a_conv.inner = untag_ptr(a);
40145         a_conv.is_owned = ptr_is_owned(a);
40146         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40147         a_conv.is_owned = false;
40148         LDKBolt12InvoiceFeatures b_conv;
40149         b_conv.inner = untag_ptr(b);
40150         b_conv.is_owned = ptr_is_owned(b);
40151         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40152         b_conv.is_owned = false;
40153         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
40154         return ret_conv;
40155 }
40156
40157 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
40158         LDKBlindedHopFeatures a_conv;
40159         a_conv.inner = untag_ptr(a);
40160         a_conv.is_owned = ptr_is_owned(a);
40161         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40162         a_conv.is_owned = false;
40163         LDKBlindedHopFeatures b_conv;
40164         b_conv.inner = untag_ptr(b);
40165         b_conv.is_owned = ptr_is_owned(b);
40166         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40167         b_conv.is_owned = false;
40168         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
40169         return ret_conv;
40170 }
40171
40172 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
40173         LDKChannelTypeFeatures a_conv;
40174         a_conv.inner = untag_ptr(a);
40175         a_conv.is_owned = ptr_is_owned(a);
40176         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40177         a_conv.is_owned = false;
40178         LDKChannelTypeFeatures b_conv;
40179         b_conv.inner = untag_ptr(b);
40180         b_conv.is_owned = ptr_is_owned(b);
40181         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40182         b_conv.is_owned = false;
40183         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
40184         return ret_conv;
40185 }
40186
40187 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
40188         LDKInitFeatures ret_var = InitFeatures_clone(arg);
40189         uint64_t ret_ref = 0;
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40192         return ret_ref;
40193 }
40194 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
40195         LDKInitFeatures arg_conv;
40196         arg_conv.inner = untag_ptr(arg);
40197         arg_conv.is_owned = ptr_is_owned(arg);
40198         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40199         arg_conv.is_owned = false;
40200         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
40201         return ret_conv;
40202 }
40203
40204 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
40205         LDKInitFeatures orig_conv;
40206         orig_conv.inner = untag_ptr(orig);
40207         orig_conv.is_owned = ptr_is_owned(orig);
40208         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40209         orig_conv.is_owned = false;
40210         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
40211         uint64_t ret_ref = 0;
40212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40214         return ret_ref;
40215 }
40216
40217 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
40218         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
40219         uint64_t ret_ref = 0;
40220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40222         return ret_ref;
40223 }
40224 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
40225         LDKNodeFeatures arg_conv;
40226         arg_conv.inner = untag_ptr(arg);
40227         arg_conv.is_owned = ptr_is_owned(arg);
40228         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40229         arg_conv.is_owned = false;
40230         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
40231         return ret_conv;
40232 }
40233
40234 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
40235         LDKNodeFeatures orig_conv;
40236         orig_conv.inner = untag_ptr(orig);
40237         orig_conv.is_owned = ptr_is_owned(orig);
40238         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40239         orig_conv.is_owned = false;
40240         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
40241         uint64_t ret_ref = 0;
40242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40244         return ret_ref;
40245 }
40246
40247 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
40248         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
40249         uint64_t ret_ref = 0;
40250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40252         return ret_ref;
40253 }
40254 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
40255         LDKChannelFeatures arg_conv;
40256         arg_conv.inner = untag_ptr(arg);
40257         arg_conv.is_owned = ptr_is_owned(arg);
40258         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40259         arg_conv.is_owned = false;
40260         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
40261         return ret_conv;
40262 }
40263
40264 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
40265         LDKChannelFeatures orig_conv;
40266         orig_conv.inner = untag_ptr(orig);
40267         orig_conv.is_owned = ptr_is_owned(orig);
40268         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40269         orig_conv.is_owned = false;
40270         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
40271         uint64_t ret_ref = 0;
40272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40274         return ret_ref;
40275 }
40276
40277 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
40278         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
40279         uint64_t ret_ref = 0;
40280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40282         return ret_ref;
40283 }
40284 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
40285         LDKInvoiceFeatures arg_conv;
40286         arg_conv.inner = untag_ptr(arg);
40287         arg_conv.is_owned = ptr_is_owned(arg);
40288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40289         arg_conv.is_owned = false;
40290         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
40291         return ret_conv;
40292 }
40293
40294 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
40295         LDKInvoiceFeatures orig_conv;
40296         orig_conv.inner = untag_ptr(orig);
40297         orig_conv.is_owned = ptr_is_owned(orig);
40298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40299         orig_conv.is_owned = false;
40300         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
40301         uint64_t ret_ref = 0;
40302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40304         return ret_ref;
40305 }
40306
40307 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
40308         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
40309         uint64_t ret_ref = 0;
40310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40312         return ret_ref;
40313 }
40314 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
40315         LDKOfferFeatures arg_conv;
40316         arg_conv.inner = untag_ptr(arg);
40317         arg_conv.is_owned = ptr_is_owned(arg);
40318         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40319         arg_conv.is_owned = false;
40320         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
40321         return ret_conv;
40322 }
40323
40324 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
40325         LDKOfferFeatures orig_conv;
40326         orig_conv.inner = untag_ptr(orig);
40327         orig_conv.is_owned = ptr_is_owned(orig);
40328         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40329         orig_conv.is_owned = false;
40330         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
40331         uint64_t ret_ref = 0;
40332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40334         return ret_ref;
40335 }
40336
40337 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
40338         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
40339         uint64_t ret_ref = 0;
40340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40342         return ret_ref;
40343 }
40344 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
40345         LDKInvoiceRequestFeatures arg_conv;
40346         arg_conv.inner = untag_ptr(arg);
40347         arg_conv.is_owned = ptr_is_owned(arg);
40348         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40349         arg_conv.is_owned = false;
40350         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
40351         return ret_conv;
40352 }
40353
40354 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
40355         LDKInvoiceRequestFeatures orig_conv;
40356         orig_conv.inner = untag_ptr(orig);
40357         orig_conv.is_owned = ptr_is_owned(orig);
40358         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40359         orig_conv.is_owned = false;
40360         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
40361         uint64_t ret_ref = 0;
40362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40364         return ret_ref;
40365 }
40366
40367 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
40368         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
40369         uint64_t ret_ref = 0;
40370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40372         return ret_ref;
40373 }
40374 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
40375         LDKBolt12InvoiceFeatures arg_conv;
40376         arg_conv.inner = untag_ptr(arg);
40377         arg_conv.is_owned = ptr_is_owned(arg);
40378         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40379         arg_conv.is_owned = false;
40380         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
40381         return ret_conv;
40382 }
40383
40384 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
40385         LDKBolt12InvoiceFeatures orig_conv;
40386         orig_conv.inner = untag_ptr(orig);
40387         orig_conv.is_owned = ptr_is_owned(orig);
40388         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40389         orig_conv.is_owned = false;
40390         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
40391         uint64_t ret_ref = 0;
40392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40394         return ret_ref;
40395 }
40396
40397 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
40398         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
40399         uint64_t ret_ref = 0;
40400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40402         return ret_ref;
40403 }
40404 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
40405         LDKBlindedHopFeatures arg_conv;
40406         arg_conv.inner = untag_ptr(arg);
40407         arg_conv.is_owned = ptr_is_owned(arg);
40408         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40409         arg_conv.is_owned = false;
40410         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
40411         return ret_conv;
40412 }
40413
40414 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
40415         LDKBlindedHopFeatures orig_conv;
40416         orig_conv.inner = untag_ptr(orig);
40417         orig_conv.is_owned = ptr_is_owned(orig);
40418         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40419         orig_conv.is_owned = false;
40420         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
40421         uint64_t ret_ref = 0;
40422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40424         return ret_ref;
40425 }
40426
40427 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
40428         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
40429         uint64_t ret_ref = 0;
40430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40432         return ret_ref;
40433 }
40434 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
40435         LDKChannelTypeFeatures arg_conv;
40436         arg_conv.inner = untag_ptr(arg);
40437         arg_conv.is_owned = ptr_is_owned(arg);
40438         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40439         arg_conv.is_owned = false;
40440         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
40441         return ret_conv;
40442 }
40443
40444 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
40445         LDKChannelTypeFeatures orig_conv;
40446         orig_conv.inner = untag_ptr(orig);
40447         orig_conv.is_owned = ptr_is_owned(orig);
40448         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40449         orig_conv.is_owned = false;
40450         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
40451         uint64_t ret_ref = 0;
40452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40454         return ret_ref;
40455 }
40456
40457 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
40458         LDKInitFeatures this_obj_conv;
40459         this_obj_conv.inner = untag_ptr(this_obj);
40460         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40462         InitFeatures_free(this_obj_conv);
40463 }
40464
40465 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
40466         LDKNodeFeatures this_obj_conv;
40467         this_obj_conv.inner = untag_ptr(this_obj);
40468         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40470         NodeFeatures_free(this_obj_conv);
40471 }
40472
40473 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
40474         LDKChannelFeatures this_obj_conv;
40475         this_obj_conv.inner = untag_ptr(this_obj);
40476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40478         ChannelFeatures_free(this_obj_conv);
40479 }
40480
40481 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
40482         LDKInvoiceFeatures this_obj_conv;
40483         this_obj_conv.inner = untag_ptr(this_obj);
40484         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40486         InvoiceFeatures_free(this_obj_conv);
40487 }
40488
40489 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
40490         LDKOfferFeatures this_obj_conv;
40491         this_obj_conv.inner = untag_ptr(this_obj);
40492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40494         OfferFeatures_free(this_obj_conv);
40495 }
40496
40497 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
40498         LDKInvoiceRequestFeatures this_obj_conv;
40499         this_obj_conv.inner = untag_ptr(this_obj);
40500         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40502         InvoiceRequestFeatures_free(this_obj_conv);
40503 }
40504
40505 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
40506         LDKBolt12InvoiceFeatures this_obj_conv;
40507         this_obj_conv.inner = untag_ptr(this_obj);
40508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40510         Bolt12InvoiceFeatures_free(this_obj_conv);
40511 }
40512
40513 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
40514         LDKBlindedHopFeatures this_obj_conv;
40515         this_obj_conv.inner = untag_ptr(this_obj);
40516         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40518         BlindedHopFeatures_free(this_obj_conv);
40519 }
40520
40521 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
40522         LDKChannelTypeFeatures this_obj_conv;
40523         this_obj_conv.inner = untag_ptr(this_obj);
40524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40526         ChannelTypeFeatures_free(this_obj_conv);
40527 }
40528
40529 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
40530         LDKInitFeatures ret_var = InitFeatures_empty();
40531         uint64_t ret_ref = 0;
40532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40534         return ret_ref;
40535 }
40536
40537 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
40538         LDKInitFeatures this_arg_conv;
40539         this_arg_conv.inner = untag_ptr(this_arg);
40540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40542         this_arg_conv.is_owned = false;
40543         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
40544         return ret_conv;
40545 }
40546
40547 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
40548         LDKNodeFeatures ret_var = NodeFeatures_empty();
40549         uint64_t ret_ref = 0;
40550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40552         return ret_ref;
40553 }
40554
40555 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
40556         LDKNodeFeatures this_arg_conv;
40557         this_arg_conv.inner = untag_ptr(this_arg);
40558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40560         this_arg_conv.is_owned = false;
40561         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
40562         return ret_conv;
40563 }
40564
40565 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
40566         LDKChannelFeatures ret_var = ChannelFeatures_empty();
40567         uint64_t ret_ref = 0;
40568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40570         return ret_ref;
40571 }
40572
40573 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
40574         LDKChannelFeatures this_arg_conv;
40575         this_arg_conv.inner = untag_ptr(this_arg);
40576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40578         this_arg_conv.is_owned = false;
40579         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
40580         return ret_conv;
40581 }
40582
40583 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
40584         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
40585         uint64_t ret_ref = 0;
40586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40588         return ret_ref;
40589 }
40590
40591 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40592         LDKInvoiceFeatures this_arg_conv;
40593         this_arg_conv.inner = untag_ptr(this_arg);
40594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40596         this_arg_conv.is_owned = false;
40597         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40598         return ret_conv;
40599 }
40600
40601 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
40602         LDKOfferFeatures ret_var = OfferFeatures_empty();
40603         uint64_t ret_ref = 0;
40604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40606         return ret_ref;
40607 }
40608
40609 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
40610         LDKOfferFeatures this_arg_conv;
40611         this_arg_conv.inner = untag_ptr(this_arg);
40612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40614         this_arg_conv.is_owned = false;
40615         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
40616         return ret_conv;
40617 }
40618
40619 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
40620         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
40621         uint64_t ret_ref = 0;
40622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40624         return ret_ref;
40625 }
40626
40627 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
40628         LDKInvoiceRequestFeatures this_arg_conv;
40629         this_arg_conv.inner = untag_ptr(this_arg);
40630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40632         this_arg_conv.is_owned = false;
40633         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
40634         return ret_conv;
40635 }
40636
40637 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
40638         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
40639         uint64_t ret_ref = 0;
40640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40642         return ret_ref;
40643 }
40644
40645 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40646         LDKBolt12InvoiceFeatures this_arg_conv;
40647         this_arg_conv.inner = untag_ptr(this_arg);
40648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40650         this_arg_conv.is_owned = false;
40651         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40652         return ret_conv;
40653 }
40654
40655 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
40656         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
40657         uint64_t ret_ref = 0;
40658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40660         return ret_ref;
40661 }
40662
40663 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
40664         LDKBlindedHopFeatures this_arg_conv;
40665         this_arg_conv.inner = untag_ptr(this_arg);
40666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40668         this_arg_conv.is_owned = false;
40669         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
40670         return ret_conv;
40671 }
40672
40673 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
40674         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
40675         uint64_t ret_ref = 0;
40676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40678         return ret_ref;
40679 }
40680
40681 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
40682         LDKChannelTypeFeatures this_arg_conv;
40683         this_arg_conv.inner = untag_ptr(this_arg);
40684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40686         this_arg_conv.is_owned = false;
40687         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
40688         return ret_conv;
40689 }
40690
40691 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
40692         LDKInitFeatures obj_conv;
40693         obj_conv.inner = untag_ptr(obj);
40694         obj_conv.is_owned = ptr_is_owned(obj);
40695         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40696         obj_conv.is_owned = false;
40697         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
40698         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40699         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40700         CVec_u8Z_free(ret_var);
40701         return ret_arr;
40702 }
40703
40704 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
40705         LDKu8slice ser_ref;
40706         ser_ref.datalen = ser->arr_len;
40707         ser_ref.data = ser->elems;
40708         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
40709         *ret_conv = InitFeatures_read(ser_ref);
40710         FREE(ser);
40711         return tag_ptr(ret_conv, true);
40712 }
40713
40714 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
40715         LDKChannelFeatures obj_conv;
40716         obj_conv.inner = untag_ptr(obj);
40717         obj_conv.is_owned = ptr_is_owned(obj);
40718         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40719         obj_conv.is_owned = false;
40720         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
40721         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40722         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40723         CVec_u8Z_free(ret_var);
40724         return ret_arr;
40725 }
40726
40727 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
40728         LDKu8slice ser_ref;
40729         ser_ref.datalen = ser->arr_len;
40730         ser_ref.data = ser->elems;
40731         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
40732         *ret_conv = ChannelFeatures_read(ser_ref);
40733         FREE(ser);
40734         return tag_ptr(ret_conv, true);
40735 }
40736
40737 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
40738         LDKNodeFeatures obj_conv;
40739         obj_conv.inner = untag_ptr(obj);
40740         obj_conv.is_owned = ptr_is_owned(obj);
40741         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40742         obj_conv.is_owned = false;
40743         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
40744         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40745         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40746         CVec_u8Z_free(ret_var);
40747         return ret_arr;
40748 }
40749
40750 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
40751         LDKu8slice ser_ref;
40752         ser_ref.datalen = ser->arr_len;
40753         ser_ref.data = ser->elems;
40754         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
40755         *ret_conv = NodeFeatures_read(ser_ref);
40756         FREE(ser);
40757         return tag_ptr(ret_conv, true);
40758 }
40759
40760 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
40761         LDKInvoiceFeatures obj_conv;
40762         obj_conv.inner = untag_ptr(obj);
40763         obj_conv.is_owned = ptr_is_owned(obj);
40764         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40765         obj_conv.is_owned = false;
40766         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
40767         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40768         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40769         CVec_u8Z_free(ret_var);
40770         return ret_arr;
40771 }
40772
40773 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
40774         LDKu8slice ser_ref;
40775         ser_ref.datalen = ser->arr_len;
40776         ser_ref.data = ser->elems;
40777         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
40778         *ret_conv = InvoiceFeatures_read(ser_ref);
40779         FREE(ser);
40780         return tag_ptr(ret_conv, true);
40781 }
40782
40783 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
40784         LDKBlindedHopFeatures obj_conv;
40785         obj_conv.inner = untag_ptr(obj);
40786         obj_conv.is_owned = ptr_is_owned(obj);
40787         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40788         obj_conv.is_owned = false;
40789         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
40790         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40791         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40792         CVec_u8Z_free(ret_var);
40793         return ret_arr;
40794 }
40795
40796 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
40797         LDKu8slice ser_ref;
40798         ser_ref.datalen = ser->arr_len;
40799         ser_ref.data = ser->elems;
40800         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
40801         *ret_conv = BlindedHopFeatures_read(ser_ref);
40802         FREE(ser);
40803         return tag_ptr(ret_conv, true);
40804 }
40805
40806 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
40807         LDKChannelTypeFeatures obj_conv;
40808         obj_conv.inner = untag_ptr(obj);
40809         obj_conv.is_owned = ptr_is_owned(obj);
40810         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40811         obj_conv.is_owned = false;
40812         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
40813         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40814         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40815         CVec_u8Z_free(ret_var);
40816         return ret_arr;
40817 }
40818
40819 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
40820         LDKu8slice ser_ref;
40821         ser_ref.datalen = ser->arr_len;
40822         ser_ref.data = ser->elems;
40823         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
40824         *ret_conv = ChannelTypeFeatures_read(ser_ref);
40825         FREE(ser);
40826         return tag_ptr(ret_conv, true);
40827 }
40828
40829 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40830         LDKInitFeatures this_arg_conv;
40831         this_arg_conv.inner = untag_ptr(this_arg);
40832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40834         this_arg_conv.is_owned = false;
40835         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
40836 }
40837
40838 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40839         LDKInitFeatures this_arg_conv;
40840         this_arg_conv.inner = untag_ptr(this_arg);
40841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40843         this_arg_conv.is_owned = false;
40844         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
40845 }
40846
40847 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
40848         LDKInitFeatures this_arg_conv;
40849         this_arg_conv.inner = untag_ptr(this_arg);
40850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40852         this_arg_conv.is_owned = false;
40853         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
40854         return ret_conv;
40855 }
40856
40857 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40858         LDKNodeFeatures this_arg_conv;
40859         this_arg_conv.inner = untag_ptr(this_arg);
40860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40862         this_arg_conv.is_owned = false;
40863         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
40864 }
40865
40866 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40867         LDKNodeFeatures this_arg_conv;
40868         this_arg_conv.inner = untag_ptr(this_arg);
40869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40871         this_arg_conv.is_owned = false;
40872         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
40873 }
40874
40875 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_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_supports_data_loss_protect(&this_arg_conv);
40882         return ret_conv;
40883 }
40884
40885 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(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         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
40892         return ret_conv;
40893 }
40894
40895 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
40896         LDKNodeFeatures this_arg_conv;
40897         this_arg_conv.inner = untag_ptr(this_arg);
40898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40900         this_arg_conv.is_owned = false;
40901         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
40902         return ret_conv;
40903 }
40904
40905 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
40906         LDKInitFeatures this_arg_conv;
40907         this_arg_conv.inner = untag_ptr(this_arg);
40908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40910         this_arg_conv.is_owned = false;
40911         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40912 }
40913
40914 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
40915         LDKInitFeatures this_arg_conv;
40916         this_arg_conv.inner = untag_ptr(this_arg);
40917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40919         this_arg_conv.is_owned = false;
40920         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40921 }
40922
40923 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
40924         LDKInitFeatures this_arg_conv;
40925         this_arg_conv.inner = untag_ptr(this_arg);
40926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40928         this_arg_conv.is_owned = false;
40929         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40930         return ret_conv;
40931 }
40932
40933 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40934         LDKInitFeatures this_arg_conv;
40935         this_arg_conv.inner = untag_ptr(this_arg);
40936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40938         this_arg_conv.is_owned = false;
40939         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40940 }
40941
40942 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40943         LDKInitFeatures this_arg_conv;
40944         this_arg_conv.inner = untag_ptr(this_arg);
40945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40947         this_arg_conv.is_owned = false;
40948         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40949 }
40950
40951 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40952         LDKInitFeatures this_arg_conv;
40953         this_arg_conv.inner = untag_ptr(this_arg);
40954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40956         this_arg_conv.is_owned = false;
40957         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40958         return ret_conv;
40959 }
40960
40961 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40962         LDKNodeFeatures this_arg_conv;
40963         this_arg_conv.inner = untag_ptr(this_arg);
40964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40966         this_arg_conv.is_owned = false;
40967         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40968 }
40969
40970 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40971         LDKNodeFeatures this_arg_conv;
40972         this_arg_conv.inner = untag_ptr(this_arg);
40973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40975         this_arg_conv.is_owned = false;
40976         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40977 }
40978
40979 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_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_supports_upfront_shutdown_script(&this_arg_conv);
40986         return ret_conv;
40987 }
40988
40989 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(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         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40996         return ret_conv;
40997 }
40998
40999 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
41000         LDKNodeFeatures this_arg_conv;
41001         this_arg_conv.inner = untag_ptr(this_arg);
41002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41004         this_arg_conv.is_owned = false;
41005         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41006         return ret_conv;
41007 }
41008
41009 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41010         LDKInitFeatures this_arg_conv;
41011         this_arg_conv.inner = untag_ptr(this_arg);
41012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41014         this_arg_conv.is_owned = false;
41015         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
41016 }
41017
41018 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
41019         LDKInitFeatures this_arg_conv;
41020         this_arg_conv.inner = untag_ptr(this_arg);
41021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41023         this_arg_conv.is_owned = false;
41024         InitFeatures_set_gossip_queries_required(&this_arg_conv);
41025 }
41026
41027 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
41028         LDKInitFeatures this_arg_conv;
41029         this_arg_conv.inner = untag_ptr(this_arg);
41030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41032         this_arg_conv.is_owned = false;
41033         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
41034         return ret_conv;
41035 }
41036
41037 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41038         LDKNodeFeatures this_arg_conv;
41039         this_arg_conv.inner = untag_ptr(this_arg);
41040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41042         this_arg_conv.is_owned = false;
41043         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
41044 }
41045
41046 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
41047         LDKNodeFeatures this_arg_conv;
41048         this_arg_conv.inner = untag_ptr(this_arg);
41049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41051         this_arg_conv.is_owned = false;
41052         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
41053 }
41054
41055 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_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_supports_gossip_queries(&this_arg_conv);
41062         return ret_conv;
41063 }
41064
41065 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(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         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
41072         return ret_conv;
41073 }
41074
41075 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
41076         LDKNodeFeatures this_arg_conv;
41077         this_arg_conv.inner = untag_ptr(this_arg);
41078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41080         this_arg_conv.is_owned = false;
41081         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
41082         return ret_conv;
41083 }
41084
41085 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41086         LDKInitFeatures this_arg_conv;
41087         this_arg_conv.inner = untag_ptr(this_arg);
41088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41090         this_arg_conv.is_owned = false;
41091         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
41092 }
41093
41094 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41095         LDKInitFeatures this_arg_conv;
41096         this_arg_conv.inner = untag_ptr(this_arg);
41097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41099         this_arg_conv.is_owned = false;
41100         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
41101 }
41102
41103 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
41104         LDKInitFeatures this_arg_conv;
41105         this_arg_conv.inner = untag_ptr(this_arg);
41106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41108         this_arg_conv.is_owned = false;
41109         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
41110         return ret_conv;
41111 }
41112
41113 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41114         LDKNodeFeatures this_arg_conv;
41115         this_arg_conv.inner = untag_ptr(this_arg);
41116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41118         this_arg_conv.is_owned = false;
41119         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
41120 }
41121
41122 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41123         LDKNodeFeatures this_arg_conv;
41124         this_arg_conv.inner = untag_ptr(this_arg);
41125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41127         this_arg_conv.is_owned = false;
41128         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
41129 }
41130
41131 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
41132         LDKNodeFeatures this_arg_conv;
41133         this_arg_conv.inner = untag_ptr(this_arg);
41134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41136         this_arg_conv.is_owned = false;
41137         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
41138         return ret_conv;
41139 }
41140
41141 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41142         LDKInvoiceFeatures this_arg_conv;
41143         this_arg_conv.inner = untag_ptr(this_arg);
41144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41146         this_arg_conv.is_owned = false;
41147         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
41148 }
41149
41150 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41151         LDKInvoiceFeatures this_arg_conv;
41152         this_arg_conv.inner = untag_ptr(this_arg);
41153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41155         this_arg_conv.is_owned = false;
41156         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
41157 }
41158
41159 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
41160         LDKInvoiceFeatures 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 = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
41166         return ret_conv;
41167 }
41168
41169 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
41170         LDKInitFeatures 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 = InitFeatures_requires_variable_length_onion(&this_arg_conv);
41176         return ret_conv;
41177 }
41178
41179 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
41180         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
41186         return ret_conv;
41187 }
41188
41189 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
41190         LDKInvoiceFeatures this_arg_conv;
41191         this_arg_conv.inner = untag_ptr(this_arg);
41192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41194         this_arg_conv.is_owned = false;
41195         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
41196         return ret_conv;
41197 }
41198
41199 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41200         LDKInitFeatures this_arg_conv;
41201         this_arg_conv.inner = untag_ptr(this_arg);
41202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41204         this_arg_conv.is_owned = false;
41205         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
41206 }
41207
41208 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
41209         LDKInitFeatures this_arg_conv;
41210         this_arg_conv.inner = untag_ptr(this_arg);
41211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41213         this_arg_conv.is_owned = false;
41214         InitFeatures_set_static_remote_key_required(&this_arg_conv);
41215 }
41216
41217 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
41218         LDKInitFeatures this_arg_conv;
41219         this_arg_conv.inner = untag_ptr(this_arg);
41220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41222         this_arg_conv.is_owned = false;
41223         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
41224         return ret_conv;
41225 }
41226
41227 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41228         LDKNodeFeatures this_arg_conv;
41229         this_arg_conv.inner = untag_ptr(this_arg);
41230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41232         this_arg_conv.is_owned = false;
41233         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
41234 }
41235
41236 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41237         LDKNodeFeatures this_arg_conv;
41238         this_arg_conv.inner = untag_ptr(this_arg);
41239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41241         this_arg_conv.is_owned = false;
41242         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
41243 }
41244
41245 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
41246         LDKNodeFeatures this_arg_conv;
41247         this_arg_conv.inner = untag_ptr(this_arg);
41248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41250         this_arg_conv.is_owned = false;
41251         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
41252         return ret_conv;
41253 }
41254
41255 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41256         LDKChannelTypeFeatures this_arg_conv;
41257         this_arg_conv.inner = untag_ptr(this_arg);
41258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41260         this_arg_conv.is_owned = false;
41261         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
41262 }
41263
41264 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41265         LDKChannelTypeFeatures this_arg_conv;
41266         this_arg_conv.inner = untag_ptr(this_arg);
41267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41269         this_arg_conv.is_owned = false;
41270         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
41271 }
41272
41273 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
41274         LDKChannelTypeFeatures 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 = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
41280         return ret_conv;
41281 }
41282
41283 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
41284         LDKInitFeatures 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 = InitFeatures_requires_static_remote_key(&this_arg_conv);
41290         return ret_conv;
41291 }
41292
41293 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
41294         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
41300         return ret_conv;
41301 }
41302
41303 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
41304         LDKChannelTypeFeatures this_arg_conv;
41305         this_arg_conv.inner = untag_ptr(this_arg);
41306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41308         this_arg_conv.is_owned = false;
41309         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
41310         return ret_conv;
41311 }
41312
41313 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
41314         LDKInitFeatures this_arg_conv;
41315         this_arg_conv.inner = untag_ptr(this_arg);
41316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41318         this_arg_conv.is_owned = false;
41319         InitFeatures_set_payment_secret_optional(&this_arg_conv);
41320 }
41321
41322 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
41323         LDKInitFeatures this_arg_conv;
41324         this_arg_conv.inner = untag_ptr(this_arg);
41325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41327         this_arg_conv.is_owned = false;
41328         InitFeatures_set_payment_secret_required(&this_arg_conv);
41329 }
41330
41331 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
41332         LDKInitFeatures this_arg_conv;
41333         this_arg_conv.inner = untag_ptr(this_arg);
41334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41336         this_arg_conv.is_owned = false;
41337         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
41338         return ret_conv;
41339 }
41340
41341 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
41342         LDKNodeFeatures this_arg_conv;
41343         this_arg_conv.inner = untag_ptr(this_arg);
41344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41346         this_arg_conv.is_owned = false;
41347         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
41348 }
41349
41350 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
41351         LDKNodeFeatures this_arg_conv;
41352         this_arg_conv.inner = untag_ptr(this_arg);
41353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41355         this_arg_conv.is_owned = false;
41356         NodeFeatures_set_payment_secret_required(&this_arg_conv);
41357 }
41358
41359 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
41360         LDKNodeFeatures this_arg_conv;
41361         this_arg_conv.inner = untag_ptr(this_arg);
41362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41364         this_arg_conv.is_owned = false;
41365         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
41366         return ret_conv;
41367 }
41368
41369 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
41370         LDKInvoiceFeatures this_arg_conv;
41371         this_arg_conv.inner = untag_ptr(this_arg);
41372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41374         this_arg_conv.is_owned = false;
41375         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
41376 }
41377
41378 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
41379         LDKInvoiceFeatures this_arg_conv;
41380         this_arg_conv.inner = untag_ptr(this_arg);
41381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41383         this_arg_conv.is_owned = false;
41384         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
41385 }
41386
41387 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
41388         LDKInvoiceFeatures 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 = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
41394         return ret_conv;
41395 }
41396
41397 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
41398         LDKInitFeatures 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 = InitFeatures_requires_payment_secret(&this_arg_conv);
41404         return ret_conv;
41405 }
41406
41407 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
41408         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
41414         return ret_conv;
41415 }
41416
41417 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
41418         LDKInvoiceFeatures this_arg_conv;
41419         this_arg_conv.inner = untag_ptr(this_arg);
41420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41422         this_arg_conv.is_owned = false;
41423         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
41424         return ret_conv;
41425 }
41426
41427 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41428         LDKInitFeatures this_arg_conv;
41429         this_arg_conv.inner = untag_ptr(this_arg);
41430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41432         this_arg_conv.is_owned = false;
41433         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
41434 }
41435
41436 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
41437         LDKInitFeatures this_arg_conv;
41438         this_arg_conv.inner = untag_ptr(this_arg);
41439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41441         this_arg_conv.is_owned = false;
41442         InitFeatures_set_basic_mpp_required(&this_arg_conv);
41443 }
41444
41445 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
41446         LDKInitFeatures this_arg_conv;
41447         this_arg_conv.inner = untag_ptr(this_arg);
41448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41450         this_arg_conv.is_owned = false;
41451         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
41452         return ret_conv;
41453 }
41454
41455 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41456         LDKNodeFeatures this_arg_conv;
41457         this_arg_conv.inner = untag_ptr(this_arg);
41458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41460         this_arg_conv.is_owned = false;
41461         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
41462 }
41463
41464 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
41465         LDKNodeFeatures this_arg_conv;
41466         this_arg_conv.inner = untag_ptr(this_arg);
41467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41469         this_arg_conv.is_owned = false;
41470         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
41471 }
41472
41473 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
41474         LDKNodeFeatures this_arg_conv;
41475         this_arg_conv.inner = untag_ptr(this_arg);
41476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41478         this_arg_conv.is_owned = false;
41479         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
41480         return ret_conv;
41481 }
41482
41483 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41484         LDKInvoiceFeatures this_arg_conv;
41485         this_arg_conv.inner = untag_ptr(this_arg);
41486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41488         this_arg_conv.is_owned = false;
41489         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41490 }
41491
41492 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41493         LDKInvoiceFeatures this_arg_conv;
41494         this_arg_conv.inner = untag_ptr(this_arg);
41495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41497         this_arg_conv.is_owned = false;
41498         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41499 }
41500
41501 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41502         LDKInvoiceFeatures this_arg_conv;
41503         this_arg_conv.inner = untag_ptr(this_arg);
41504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41506         this_arg_conv.is_owned = false;
41507         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41508         return ret_conv;
41509 }
41510
41511 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41512         LDKBolt12InvoiceFeatures this_arg_conv;
41513         this_arg_conv.inner = untag_ptr(this_arg);
41514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41516         this_arg_conv.is_owned = false;
41517         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41518 }
41519
41520 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41521         LDKBolt12InvoiceFeatures this_arg_conv;
41522         this_arg_conv.inner = untag_ptr(this_arg);
41523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41525         this_arg_conv.is_owned = false;
41526         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41527 }
41528
41529 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41530         LDKBolt12InvoiceFeatures 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 = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41536         return ret_conv;
41537 }
41538
41539 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
41540         LDKInitFeatures 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 = InitFeatures_requires_basic_mpp(&this_arg_conv);
41546         return ret_conv;
41547 }
41548
41549 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
41550         LDKNodeFeatures 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 = NodeFeatures_requires_basic_mpp(&this_arg_conv);
41556         return ret_conv;
41557 }
41558
41559 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41560         LDKInvoiceFeatures 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         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41566         return ret_conv;
41567 }
41568
41569 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41570         LDKBolt12InvoiceFeatures this_arg_conv;
41571         this_arg_conv.inner = untag_ptr(this_arg);
41572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41574         this_arg_conv.is_owned = false;
41575         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41576         return ret_conv;
41577 }
41578
41579 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
41580         LDKInitFeatures this_arg_conv;
41581         this_arg_conv.inner = untag_ptr(this_arg);
41582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41584         this_arg_conv.is_owned = false;
41585         InitFeatures_set_wumbo_optional(&this_arg_conv);
41586 }
41587
41588 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
41589         LDKInitFeatures this_arg_conv;
41590         this_arg_conv.inner = untag_ptr(this_arg);
41591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41593         this_arg_conv.is_owned = false;
41594         InitFeatures_set_wumbo_required(&this_arg_conv);
41595 }
41596
41597 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
41598         LDKInitFeatures this_arg_conv;
41599         this_arg_conv.inner = untag_ptr(this_arg);
41600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41602         this_arg_conv.is_owned = false;
41603         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
41604         return ret_conv;
41605 }
41606
41607 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
41608         LDKNodeFeatures this_arg_conv;
41609         this_arg_conv.inner = untag_ptr(this_arg);
41610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41612         this_arg_conv.is_owned = false;
41613         NodeFeatures_set_wumbo_optional(&this_arg_conv);
41614 }
41615
41616 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
41617         LDKNodeFeatures this_arg_conv;
41618         this_arg_conv.inner = untag_ptr(this_arg);
41619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41621         this_arg_conv.is_owned = false;
41622         NodeFeatures_set_wumbo_required(&this_arg_conv);
41623 }
41624
41625 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_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_supports_wumbo(&this_arg_conv);
41632         return ret_conv;
41633 }
41634
41635 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(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         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
41642         return ret_conv;
41643 }
41644
41645 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
41646         LDKNodeFeatures this_arg_conv;
41647         this_arg_conv.inner = untag_ptr(this_arg);
41648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41650         this_arg_conv.is_owned = false;
41651         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
41652         return ret_conv;
41653 }
41654
41655 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) {
41656         LDKInitFeatures this_arg_conv;
41657         this_arg_conv.inner = untag_ptr(this_arg);
41658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41660         this_arg_conv.is_owned = false;
41661         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41662 }
41663
41664 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) {
41665         LDKInitFeatures this_arg_conv;
41666         this_arg_conv.inner = untag_ptr(this_arg);
41667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41669         this_arg_conv.is_owned = false;
41670         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41671 }
41672
41673 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41674         LDKInitFeatures this_arg_conv;
41675         this_arg_conv.inner = untag_ptr(this_arg);
41676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41678         this_arg_conv.is_owned = false;
41679         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41680         return ret_conv;
41681 }
41682
41683 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) {
41684         LDKNodeFeatures this_arg_conv;
41685         this_arg_conv.inner = untag_ptr(this_arg);
41686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41688         this_arg_conv.is_owned = false;
41689         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41690 }
41691
41692 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) {
41693         LDKNodeFeatures this_arg_conv;
41694         this_arg_conv.inner = untag_ptr(this_arg);
41695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41697         this_arg_conv.is_owned = false;
41698         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41699 }
41700
41701 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41702         LDKNodeFeatures this_arg_conv;
41703         this_arg_conv.inner = untag_ptr(this_arg);
41704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41706         this_arg_conv.is_owned = false;
41707         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41708         return ret_conv;
41709 }
41710
41711 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) {
41712         LDKChannelTypeFeatures this_arg_conv;
41713         this_arg_conv.inner = untag_ptr(this_arg);
41714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41716         this_arg_conv.is_owned = false;
41717         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41718 }
41719
41720 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) {
41721         LDKChannelTypeFeatures this_arg_conv;
41722         this_arg_conv.inner = untag_ptr(this_arg);
41723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41725         this_arg_conv.is_owned = false;
41726         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41727 }
41728
41729 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41730         LDKChannelTypeFeatures 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 = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41736         return ret_conv;
41737 }
41738
41739 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41740         LDKInitFeatures 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 = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41746         return ret_conv;
41747 }
41748
41749 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41750         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41756         return ret_conv;
41757 }
41758
41759 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41760         LDKChannelTypeFeatures this_arg_conv;
41761         this_arg_conv.inner = untag_ptr(this_arg);
41762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41764         this_arg_conv.is_owned = false;
41765         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41766         return ret_conv;
41767 }
41768
41769 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41770         LDKInitFeatures this_arg_conv;
41771         this_arg_conv.inner = untag_ptr(this_arg);
41772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41774         this_arg_conv.is_owned = false;
41775         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41776 }
41777
41778 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41779         LDKInitFeatures this_arg_conv;
41780         this_arg_conv.inner = untag_ptr(this_arg);
41781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41783         this_arg_conv.is_owned = false;
41784         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41785 }
41786
41787 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41788         LDKInitFeatures this_arg_conv;
41789         this_arg_conv.inner = untag_ptr(this_arg);
41790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41792         this_arg_conv.is_owned = false;
41793         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41794         return ret_conv;
41795 }
41796
41797 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41798         LDKNodeFeatures this_arg_conv;
41799         this_arg_conv.inner = untag_ptr(this_arg);
41800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41802         this_arg_conv.is_owned = false;
41803         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41804 }
41805
41806 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41807         LDKNodeFeatures this_arg_conv;
41808         this_arg_conv.inner = untag_ptr(this_arg);
41809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41811         this_arg_conv.is_owned = false;
41812         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41813 }
41814
41815 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_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_supports_shutdown_anysegwit(&this_arg_conv);
41822         return ret_conv;
41823 }
41824
41825 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(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         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41832         return ret_conv;
41833 }
41834
41835 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41836         LDKNodeFeatures this_arg_conv;
41837         this_arg_conv.inner = untag_ptr(this_arg);
41838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41840         this_arg_conv.is_owned = false;
41841         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41842         return ret_conv;
41843 }
41844
41845 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
41846         LDKInitFeatures this_arg_conv;
41847         this_arg_conv.inner = untag_ptr(this_arg);
41848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41850         this_arg_conv.is_owned = false;
41851         InitFeatures_set_onion_messages_optional(&this_arg_conv);
41852 }
41853
41854 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
41855         LDKInitFeatures this_arg_conv;
41856         this_arg_conv.inner = untag_ptr(this_arg);
41857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41859         this_arg_conv.is_owned = false;
41860         InitFeatures_set_onion_messages_required(&this_arg_conv);
41861 }
41862
41863 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
41864         LDKInitFeatures this_arg_conv;
41865         this_arg_conv.inner = untag_ptr(this_arg);
41866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41868         this_arg_conv.is_owned = false;
41869         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
41870         return ret_conv;
41871 }
41872
41873 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
41874         LDKNodeFeatures this_arg_conv;
41875         this_arg_conv.inner = untag_ptr(this_arg);
41876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41878         this_arg_conv.is_owned = false;
41879         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
41880 }
41881
41882 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
41883         LDKNodeFeatures this_arg_conv;
41884         this_arg_conv.inner = untag_ptr(this_arg);
41885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41887         this_arg_conv.is_owned = false;
41888         NodeFeatures_set_onion_messages_required(&this_arg_conv);
41889 }
41890
41891 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_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_supports_onion_messages(&this_arg_conv);
41898         return ret_conv;
41899 }
41900
41901 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(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         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
41908         return ret_conv;
41909 }
41910
41911 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
41912         LDKNodeFeatures this_arg_conv;
41913         this_arg_conv.inner = untag_ptr(this_arg);
41914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41916         this_arg_conv.is_owned = false;
41917         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
41918         return ret_conv;
41919 }
41920
41921 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
41922         LDKInitFeatures this_arg_conv;
41923         this_arg_conv.inner = untag_ptr(this_arg);
41924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41926         this_arg_conv.is_owned = false;
41927         InitFeatures_set_channel_type_optional(&this_arg_conv);
41928 }
41929
41930 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
41931         LDKInitFeatures this_arg_conv;
41932         this_arg_conv.inner = untag_ptr(this_arg);
41933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41935         this_arg_conv.is_owned = false;
41936         InitFeatures_set_channel_type_required(&this_arg_conv);
41937 }
41938
41939 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
41940         LDKInitFeatures this_arg_conv;
41941         this_arg_conv.inner = untag_ptr(this_arg);
41942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41944         this_arg_conv.is_owned = false;
41945         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
41946         return ret_conv;
41947 }
41948
41949 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
41950         LDKNodeFeatures this_arg_conv;
41951         this_arg_conv.inner = untag_ptr(this_arg);
41952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41954         this_arg_conv.is_owned = false;
41955         NodeFeatures_set_channel_type_optional(&this_arg_conv);
41956 }
41957
41958 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
41959         LDKNodeFeatures this_arg_conv;
41960         this_arg_conv.inner = untag_ptr(this_arg);
41961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41963         this_arg_conv.is_owned = false;
41964         NodeFeatures_set_channel_type_required(&this_arg_conv);
41965 }
41966
41967 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_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_supports_channel_type(&this_arg_conv);
41974         return ret_conv;
41975 }
41976
41977 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(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         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
41984         return ret_conv;
41985 }
41986
41987 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
41988         LDKNodeFeatures this_arg_conv;
41989         this_arg_conv.inner = untag_ptr(this_arg);
41990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41992         this_arg_conv.is_owned = false;
41993         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
41994         return ret_conv;
41995 }
41996
41997 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
41998         LDKInitFeatures this_arg_conv;
41999         this_arg_conv.inner = untag_ptr(this_arg);
42000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42002         this_arg_conv.is_owned = false;
42003         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
42004 }
42005
42006 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
42007         LDKInitFeatures this_arg_conv;
42008         this_arg_conv.inner = untag_ptr(this_arg);
42009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42011         this_arg_conv.is_owned = false;
42012         InitFeatures_set_scid_privacy_required(&this_arg_conv);
42013 }
42014
42015 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
42016         LDKInitFeatures this_arg_conv;
42017         this_arg_conv.inner = untag_ptr(this_arg);
42018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42020         this_arg_conv.is_owned = false;
42021         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
42022         return ret_conv;
42023 }
42024
42025 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42026         LDKNodeFeatures this_arg_conv;
42027         this_arg_conv.inner = untag_ptr(this_arg);
42028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42030         this_arg_conv.is_owned = false;
42031         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
42032 }
42033
42034 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42035         LDKNodeFeatures this_arg_conv;
42036         this_arg_conv.inner = untag_ptr(this_arg);
42037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42039         this_arg_conv.is_owned = false;
42040         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
42041 }
42042
42043 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
42044         LDKNodeFeatures this_arg_conv;
42045         this_arg_conv.inner = untag_ptr(this_arg);
42046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42048         this_arg_conv.is_owned = false;
42049         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
42050         return ret_conv;
42051 }
42052
42053 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42054         LDKChannelTypeFeatures this_arg_conv;
42055         this_arg_conv.inner = untag_ptr(this_arg);
42056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42058         this_arg_conv.is_owned = false;
42059         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
42060 }
42061
42062 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42063         LDKChannelTypeFeatures this_arg_conv;
42064         this_arg_conv.inner = untag_ptr(this_arg);
42065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42067         this_arg_conv.is_owned = false;
42068         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
42069 }
42070
42071 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
42072         LDKChannelTypeFeatures 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 = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
42078         return ret_conv;
42079 }
42080
42081 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
42082         LDKInitFeatures 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 = InitFeatures_requires_scid_privacy(&this_arg_conv);
42088         return ret_conv;
42089 }
42090
42091 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
42092         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
42098         return ret_conv;
42099 }
42100
42101 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
42102         LDKChannelTypeFeatures this_arg_conv;
42103         this_arg_conv.inner = untag_ptr(this_arg);
42104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42106         this_arg_conv.is_owned = false;
42107         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
42108         return ret_conv;
42109 }
42110
42111 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_metadata_optional"))) TS_InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
42112         LDKInvoiceFeatures this_arg_conv;
42113         this_arg_conv.inner = untag_ptr(this_arg);
42114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42116         this_arg_conv.is_owned = false;
42117         InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
42118 }
42119
42120 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_metadata_required"))) TS_InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
42121         LDKInvoiceFeatures this_arg_conv;
42122         this_arg_conv.inner = untag_ptr(this_arg);
42123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42125         this_arg_conv.is_owned = false;
42126         InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
42127 }
42128
42129 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_metadata"))) TS_InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
42130         LDKInvoiceFeatures 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         jboolean ret_conv = InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
42136         return ret_conv;
42137 }
42138
42139 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_metadata"))) TS_InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
42140         LDKInvoiceFeatures this_arg_conv;
42141         this_arg_conv.inner = untag_ptr(this_arg);
42142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42144         this_arg_conv.is_owned = false;
42145         jboolean ret_conv = InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
42146         return ret_conv;
42147 }
42148
42149 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
42150         LDKInitFeatures this_arg_conv;
42151         this_arg_conv.inner = untag_ptr(this_arg);
42152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42154         this_arg_conv.is_owned = false;
42155         InitFeatures_set_zero_conf_optional(&this_arg_conv);
42156 }
42157
42158 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
42159         LDKInitFeatures this_arg_conv;
42160         this_arg_conv.inner = untag_ptr(this_arg);
42161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42163         this_arg_conv.is_owned = false;
42164         InitFeatures_set_zero_conf_required(&this_arg_conv);
42165 }
42166
42167 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
42168         LDKInitFeatures this_arg_conv;
42169         this_arg_conv.inner = untag_ptr(this_arg);
42170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42172         this_arg_conv.is_owned = false;
42173         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
42174         return ret_conv;
42175 }
42176
42177 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42178         LDKNodeFeatures this_arg_conv;
42179         this_arg_conv.inner = untag_ptr(this_arg);
42180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42182         this_arg_conv.is_owned = false;
42183         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
42184 }
42185
42186 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
42187         LDKNodeFeatures this_arg_conv;
42188         this_arg_conv.inner = untag_ptr(this_arg);
42189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42191         this_arg_conv.is_owned = false;
42192         NodeFeatures_set_zero_conf_required(&this_arg_conv);
42193 }
42194
42195 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
42196         LDKNodeFeatures this_arg_conv;
42197         this_arg_conv.inner = untag_ptr(this_arg);
42198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42200         this_arg_conv.is_owned = false;
42201         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
42202         return ret_conv;
42203 }
42204
42205 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42206         LDKChannelTypeFeatures this_arg_conv;
42207         this_arg_conv.inner = untag_ptr(this_arg);
42208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42210         this_arg_conv.is_owned = false;
42211         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
42212 }
42213
42214 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
42215         LDKChannelTypeFeatures this_arg_conv;
42216         this_arg_conv.inner = untag_ptr(this_arg);
42217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42219         this_arg_conv.is_owned = false;
42220         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
42221 }
42222
42223 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
42224         LDKChannelTypeFeatures 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 = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
42230         return ret_conv;
42231 }
42232
42233 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
42234         LDKInitFeatures 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 = InitFeatures_requires_zero_conf(&this_arg_conv);
42240         return ret_conv;
42241 }
42242
42243 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(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         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
42250         return ret_conv;
42251 }
42252
42253 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
42254         LDKChannelTypeFeatures this_arg_conv;
42255         this_arg_conv.inner = untag_ptr(this_arg);
42256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42258         this_arg_conv.is_owned = false;
42259         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
42260         return ret_conv;
42261 }
42262
42263 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
42264         LDKNodeFeatures this_arg_conv;
42265         this_arg_conv.inner = untag_ptr(this_arg);
42266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42268         this_arg_conv.is_owned = false;
42269         NodeFeatures_set_keysend_optional(&this_arg_conv);
42270 }
42271
42272 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
42273         LDKNodeFeatures this_arg_conv;
42274         this_arg_conv.inner = untag_ptr(this_arg);
42275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42277         this_arg_conv.is_owned = false;
42278         NodeFeatures_set_keysend_required(&this_arg_conv);
42279 }
42280
42281 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
42282         LDKNodeFeatures this_arg_conv;
42283         this_arg_conv.inner = untag_ptr(this_arg);
42284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42286         this_arg_conv.is_owned = false;
42287         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
42288         return ret_conv;
42289 }
42290
42291 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
42292         LDKNodeFeatures this_arg_conv;
42293         this_arg_conv.inner = untag_ptr(this_arg);
42294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42296         this_arg_conv.is_owned = false;
42297         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
42298         return ret_conv;
42299 }
42300
42301 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
42302         LDKShutdownScript this_obj_conv;
42303         this_obj_conv.inner = untag_ptr(this_obj);
42304         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42306         ShutdownScript_free(this_obj_conv);
42307 }
42308
42309 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
42310         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
42311         uint64_t ret_ref = 0;
42312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42314         return ret_ref;
42315 }
42316 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
42317         LDKShutdownScript arg_conv;
42318         arg_conv.inner = untag_ptr(arg);
42319         arg_conv.is_owned = ptr_is_owned(arg);
42320         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42321         arg_conv.is_owned = false;
42322         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
42323         return ret_conv;
42324 }
42325
42326 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
42327         LDKShutdownScript orig_conv;
42328         orig_conv.inner = untag_ptr(orig);
42329         orig_conv.is_owned = ptr_is_owned(orig);
42330         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42331         orig_conv.is_owned = false;
42332         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
42333         uint64_t ret_ref = 0;
42334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42336         return ret_ref;
42337 }
42338
42339 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
42340         LDKShutdownScript a_conv;
42341         a_conv.inner = untag_ptr(a);
42342         a_conv.is_owned = ptr_is_owned(a);
42343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42344         a_conv.is_owned = false;
42345         LDKShutdownScript b_conv;
42346         b_conv.inner = untag_ptr(b);
42347         b_conv.is_owned = ptr_is_owned(b);
42348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42349         b_conv.is_owned = false;
42350         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
42351         return ret_conv;
42352 }
42353
42354 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
42355         LDKInvalidShutdownScript this_obj_conv;
42356         this_obj_conv.inner = untag_ptr(this_obj);
42357         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42359         InvalidShutdownScript_free(this_obj_conv);
42360 }
42361
42362 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
42363         LDKInvalidShutdownScript this_ptr_conv;
42364         this_ptr_conv.inner = untag_ptr(this_ptr);
42365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42367         this_ptr_conv.is_owned = false;
42368         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
42369         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42370         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42371         return ret_arr;
42372 }
42373
42374 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
42375         LDKInvalidShutdownScript this_ptr_conv;
42376         this_ptr_conv.inner = untag_ptr(this_ptr);
42377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42379         this_ptr_conv.is_owned = false;
42380         LDKCVec_u8Z val_ref;
42381         val_ref.datalen = val->arr_len;
42382         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42383         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
42384         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
42385 }
42386
42387 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
42388         LDKCVec_u8Z script_arg_ref;
42389         script_arg_ref.datalen = script_arg->arr_len;
42390         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42391         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
42392         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
42393         uint64_t ret_ref = 0;
42394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42396         return ret_ref;
42397 }
42398
42399 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
42400         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
42401         uint64_t ret_ref = 0;
42402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42404         return ret_ref;
42405 }
42406 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
42407         LDKInvalidShutdownScript arg_conv;
42408         arg_conv.inner = untag_ptr(arg);
42409         arg_conv.is_owned = ptr_is_owned(arg);
42410         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42411         arg_conv.is_owned = false;
42412         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
42413         return ret_conv;
42414 }
42415
42416 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
42417         LDKInvalidShutdownScript orig_conv;
42418         orig_conv.inner = untag_ptr(orig);
42419         orig_conv.is_owned = ptr_is_owned(orig);
42420         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42421         orig_conv.is_owned = false;
42422         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
42423         uint64_t ret_ref = 0;
42424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42426         return ret_ref;
42427 }
42428
42429 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
42430         LDKShutdownScript obj_conv;
42431         obj_conv.inner = untag_ptr(obj);
42432         obj_conv.is_owned = ptr_is_owned(obj);
42433         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42434         obj_conv.is_owned = false;
42435         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
42436         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42437         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42438         CVec_u8Z_free(ret_var);
42439         return ret_arr;
42440 }
42441
42442 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
42443         LDKu8slice ser_ref;
42444         ser_ref.datalen = ser->arr_len;
42445         ser_ref.data = ser->elems;
42446         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
42447         *ret_conv = ShutdownScript_read(ser_ref);
42448         FREE(ser);
42449         return tag_ptr(ret_conv, true);
42450 }
42451
42452 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
42453         uint8_t pubkey_hash_arr[20];
42454         CHECK(pubkey_hash->arr_len == 20);
42455         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
42456         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
42457         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
42458         uint64_t ret_ref = 0;
42459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42461         return ret_ref;
42462 }
42463
42464 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
42465         uint8_t script_hash_arr[32];
42466         CHECK(script_hash->arr_len == 32);
42467         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
42468         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
42469         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
42470         uint64_t ret_ref = 0;
42471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42473         return ret_ref;
42474 }
42475
42476 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
42477         
42478         LDKu8slice program_ref;
42479         program_ref.datalen = program->arr_len;
42480         program_ref.data = program->elems;
42481         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
42482         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
42483         FREE(program);
42484         return tag_ptr(ret_conv, true);
42485 }
42486
42487 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
42488         LDKShutdownScript this_arg_conv;
42489         this_arg_conv.inner = untag_ptr(this_arg);
42490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42492         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
42493         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
42494         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42495         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42496         CVec_u8Z_free(ret_var);
42497         return ret_arr;
42498 }
42499
42500 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
42501         LDKShutdownScript this_arg_conv;
42502         this_arg_conv.inner = untag_ptr(this_arg);
42503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42505         this_arg_conv.is_owned = false;
42506         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42507         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
42508         return ret_arr;
42509 }
42510
42511 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
42512         LDKShutdownScript this_arg_conv;
42513         this_arg_conv.inner = untag_ptr(this_arg);
42514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42516         this_arg_conv.is_owned = false;
42517         LDKInitFeatures features_conv;
42518         features_conv.inner = untag_ptr(features);
42519         features_conv.is_owned = ptr_is_owned(features);
42520         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42521         features_conv.is_owned = false;
42522         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
42523         return ret_conv;
42524 }
42525
42526 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
42527         if (!ptr_is_owned(this_ptr)) return;
42528         void* this_ptr_ptr = untag_ptr(this_ptr);
42529         CHECK_ACCESS(this_ptr_ptr);
42530         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
42531         FREE(untag_ptr(this_ptr));
42532         Retry_free(this_ptr_conv);
42533 }
42534
42535 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
42536         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42537         *ret_copy = Retry_clone(arg);
42538         uint64_t ret_ref = tag_ptr(ret_copy, true);
42539         return ret_ref;
42540 }
42541 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
42542         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
42543         int64_t ret_conv = Retry_clone_ptr(arg_conv);
42544         return ret_conv;
42545 }
42546
42547 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
42548         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
42549         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42550         *ret_copy = Retry_clone(orig_conv);
42551         uint64_t ret_ref = tag_ptr(ret_copy, true);
42552         return ret_ref;
42553 }
42554
42555 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
42556         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42557         *ret_copy = Retry_attempts(a);
42558         uint64_t ret_ref = tag_ptr(ret_copy, true);
42559         return ret_ref;
42560 }
42561
42562 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
42563         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
42564         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
42565         jboolean ret_conv = Retry_eq(a_conv, b_conv);
42566         return ret_conv;
42567 }
42568
42569 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
42570         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
42571         int64_t ret_conv = Retry_hash(o_conv);
42572         return ret_conv;
42573 }
42574
42575 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
42576         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
42577         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
42578         return ret_conv;
42579 }
42580
42581 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
42582         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
42583         return ret_conv;
42584 }
42585
42586 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
42587         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
42588         return ret_conv;
42589 }
42590
42591 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
42592         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
42593         return ret_conv;
42594 }
42595
42596 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
42597         if (!ptr_is_owned(this_ptr)) return;
42598         void* this_ptr_ptr = untag_ptr(this_ptr);
42599         CHECK_ACCESS(this_ptr_ptr);
42600         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
42601         FREE(untag_ptr(this_ptr));
42602         PaymentSendFailure_free(this_ptr_conv);
42603 }
42604
42605 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
42606         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42607         *ret_copy = PaymentSendFailure_clone(arg);
42608         uint64_t ret_ref = tag_ptr(ret_copy, true);
42609         return ret_ref;
42610 }
42611 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
42612         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
42613         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
42614         return ret_conv;
42615 }
42616
42617 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
42618         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
42619         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42620         *ret_copy = PaymentSendFailure_clone(orig_conv);
42621         uint64_t ret_ref = tag_ptr(ret_copy, true);
42622         return ret_ref;
42623 }
42624
42625 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
42626         void* a_ptr = untag_ptr(a);
42627         CHECK_ACCESS(a_ptr);
42628         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
42629         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
42630         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42631         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
42632         uint64_t ret_ref = tag_ptr(ret_copy, true);
42633         return ret_ref;
42634 }
42635
42636 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
42637         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
42638         a_constr.datalen = a->arr_len;
42639         if (a_constr.datalen > 0)
42640                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42641         else
42642                 a_constr.data = NULL;
42643         uint64_t* a_vals = a->elems;
42644         for (size_t w = 0; w < a_constr.datalen; w++) {
42645                 uint64_t a_conv_22 = a_vals[w];
42646                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
42647                 CHECK_ACCESS(a_conv_22_ptr);
42648                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
42649                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
42650                 a_constr.data[w] = a_conv_22_conv;
42651         }
42652         FREE(a);
42653         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42654         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
42655         uint64_t ret_ref = tag_ptr(ret_copy, true);
42656         return ret_ref;
42657 }
42658
42659 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
42660         LDKCVec_APIErrorZ a_constr;
42661         a_constr.datalen = a->arr_len;
42662         if (a_constr.datalen > 0)
42663                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
42664         else
42665                 a_constr.data = NULL;
42666         uint64_t* a_vals = a->elems;
42667         for (size_t k = 0; k < a_constr.datalen; k++) {
42668                 uint64_t a_conv_10 = a_vals[k];
42669                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
42670                 CHECK_ACCESS(a_conv_10_ptr);
42671                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
42672                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
42673                 a_constr.data[k] = a_conv_10_conv;
42674         }
42675         FREE(a);
42676         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42677         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
42678         uint64_t ret_ref = tag_ptr(ret_copy, true);
42679         return ret_ref;
42680 }
42681
42682 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
42683         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42684         *ret_copy = PaymentSendFailure_duplicate_payment();
42685         uint64_t ret_ref = tag_ptr(ret_copy, true);
42686         return ret_ref;
42687 }
42688
42689 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) {
42690         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
42691         results_constr.datalen = results->arr_len;
42692         if (results_constr.datalen > 0)
42693                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42694         else
42695                 results_constr.data = NULL;
42696         uint64_t* results_vals = results->elems;
42697         for (size_t w = 0; w < results_constr.datalen; w++) {
42698                 uint64_t results_conv_22 = results_vals[w];
42699                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
42700                 CHECK_ACCESS(results_conv_22_ptr);
42701                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
42702                 results_constr.data[w] = results_conv_22_conv;
42703         }
42704         FREE(results);
42705         LDKRouteParameters failed_paths_retry_conv;
42706         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
42707         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
42708         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
42709         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
42710         LDKThirtyTwoBytes payment_id_ref;
42711         CHECK(payment_id->arr_len == 32);
42712         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42713         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42714         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
42715         uint64_t ret_ref = tag_ptr(ret_copy, true);
42716         return ret_ref;
42717 }
42718
42719 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
42720         LDKRecipientOnionFields this_obj_conv;
42721         this_obj_conv.inner = untag_ptr(this_obj);
42722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42724         RecipientOnionFields_free(this_obj_conv);
42725 }
42726
42727 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
42728         LDKRecipientOnionFields this_ptr_conv;
42729         this_ptr_conv.inner = untag_ptr(this_ptr);
42730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42732         this_ptr_conv.is_owned = false;
42733         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42734         memcpy(ret_arr->elems, RecipientOnionFields_get_payment_secret(&this_ptr_conv).data, 32);
42735         return ret_arr;
42736 }
42737
42738 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
42739         LDKRecipientOnionFields this_ptr_conv;
42740         this_ptr_conv.inner = untag_ptr(this_ptr);
42741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42743         this_ptr_conv.is_owned = false;
42744         LDKThirtyTwoBytes val_ref;
42745         CHECK(val->arr_len == 32);
42746         memcpy(val_ref.data, val->elems, 32); FREE(val);
42747         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_ref);
42748 }
42749
42750 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
42751         LDKRecipientOnionFields this_ptr_conv;
42752         this_ptr_conv.inner = untag_ptr(this_ptr);
42753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42755         this_ptr_conv.is_owned = false;
42756         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42757         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
42758         uint64_t ret_ref = tag_ptr(ret_copy, true);
42759         return ret_ref;
42760 }
42761
42762 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
42763         LDKRecipientOnionFields this_ptr_conv;
42764         this_ptr_conv.inner = untag_ptr(this_ptr);
42765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42767         this_ptr_conv.is_owned = false;
42768         void* val_ptr = untag_ptr(val);
42769         CHECK_ACCESS(val_ptr);
42770         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42771         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42772         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
42773 }
42774
42775 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_new"))) TS_RecipientOnionFields_new(int8_tArray payment_secret_arg, uint64_t payment_metadata_arg) {
42776         LDKThirtyTwoBytes payment_secret_arg_ref;
42777         CHECK(payment_secret_arg->arr_len == 32);
42778         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
42779         void* payment_metadata_arg_ptr = untag_ptr(payment_metadata_arg);
42780         CHECK_ACCESS(payment_metadata_arg_ptr);
42781         LDKCOption_CVec_u8ZZ payment_metadata_arg_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_arg_ptr);
42782         payment_metadata_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata_arg));
42783         LDKRecipientOnionFields ret_var = RecipientOnionFields_new(payment_secret_arg_ref, payment_metadata_arg_conv);
42784         uint64_t ret_ref = 0;
42785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42787         return ret_ref;
42788 }
42789
42790 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
42791         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
42792         uint64_t ret_ref = 0;
42793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42795         return ret_ref;
42796 }
42797 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
42798         LDKRecipientOnionFields arg_conv;
42799         arg_conv.inner = untag_ptr(arg);
42800         arg_conv.is_owned = ptr_is_owned(arg);
42801         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42802         arg_conv.is_owned = false;
42803         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
42804         return ret_conv;
42805 }
42806
42807 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
42808         LDKRecipientOnionFields orig_conv;
42809         orig_conv.inner = untag_ptr(orig);
42810         orig_conv.is_owned = ptr_is_owned(orig);
42811         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42812         orig_conv.is_owned = false;
42813         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
42814         uint64_t ret_ref = 0;
42815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42817         return ret_ref;
42818 }
42819
42820 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
42821         LDKRecipientOnionFields a_conv;
42822         a_conv.inner = untag_ptr(a);
42823         a_conv.is_owned = ptr_is_owned(a);
42824         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42825         a_conv.is_owned = false;
42826         LDKRecipientOnionFields b_conv;
42827         b_conv.inner = untag_ptr(b);
42828         b_conv.is_owned = ptr_is_owned(b);
42829         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42830         b_conv.is_owned = false;
42831         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
42832         return ret_conv;
42833 }
42834
42835 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
42836         LDKRecipientOnionFields obj_conv;
42837         obj_conv.inner = untag_ptr(obj);
42838         obj_conv.is_owned = ptr_is_owned(obj);
42839         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42840         obj_conv.is_owned = false;
42841         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
42842         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42843         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42844         CVec_u8Z_free(ret_var);
42845         return ret_arr;
42846 }
42847
42848 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
42849         LDKu8slice ser_ref;
42850         ser_ref.datalen = ser->arr_len;
42851         ser_ref.data = ser->elems;
42852         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
42853         *ret_conv = RecipientOnionFields_read(ser_ref);
42854         FREE(ser);
42855         return tag_ptr(ret_conv, true);
42856 }
42857
42858 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
42859         LDKThirtyTwoBytes payment_secret_ref;
42860         CHECK(payment_secret->arr_len == 32);
42861         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
42862         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
42863         uint64_t ret_ref = 0;
42864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42866         return ret_ref;
42867 }
42868
42869 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
42870         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
42871         uint64_t ret_ref = 0;
42872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42874         return ret_ref;
42875 }
42876
42877 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
42878         if (!ptr_is_owned(this_ptr)) return;
42879         void* this_ptr_ptr = untag_ptr(this_ptr);
42880         CHECK_ACCESS(this_ptr_ptr);
42881         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
42882         FREE(untag_ptr(this_ptr));
42883         CustomMessageReader_free(this_ptr_conv);
42884 }
42885
42886 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
42887         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42888         *ret_ret = Type_clone(arg);
42889         return tag_ptr(ret_ret, true);
42890 }
42891 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
42892         void* arg_ptr = untag_ptr(arg);
42893         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
42894         LDKType* arg_conv = (LDKType*)arg_ptr;
42895         int64_t ret_conv = Type_clone_ptr(arg_conv);
42896         return ret_conv;
42897 }
42898
42899 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
42900         void* orig_ptr = untag_ptr(orig);
42901         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
42902         LDKType* orig_conv = (LDKType*)orig_ptr;
42903         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42904         *ret_ret = Type_clone(orig_conv);
42905         return tag_ptr(ret_ret, true);
42906 }
42907
42908 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
42909         if (!ptr_is_owned(this_ptr)) return;
42910         void* this_ptr_ptr = untag_ptr(this_ptr);
42911         CHECK_ACCESS(this_ptr_ptr);
42912         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
42913         FREE(untag_ptr(this_ptr));
42914         Type_free(this_ptr_conv);
42915 }
42916
42917 void  __attribute__((export_name("TS_UnsignedInvoice_free"))) TS_UnsignedInvoice_free(uint64_t this_obj) {
42918         LDKUnsignedInvoice this_obj_conv;
42919         this_obj_conv.inner = untag_ptr(this_obj);
42920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42922         UnsignedInvoice_free(this_obj_conv);
42923 }
42924
42925 int8_tArray  __attribute__((export_name("TS_UnsignedInvoice_signing_pubkey"))) TS_UnsignedInvoice_signing_pubkey(uint64_t this_arg) {
42926         LDKUnsignedInvoice this_arg_conv;
42927         this_arg_conv.inner = untag_ptr(this_arg);
42928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42930         this_arg_conv.is_owned = false;
42931         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42932         memcpy(ret_arr->elems, UnsignedInvoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
42933         return ret_arr;
42934 }
42935
42936 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
42937         LDKBlindedPayInfo this_obj_conv;
42938         this_obj_conv.inner = untag_ptr(this_obj);
42939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42941         BlindedPayInfo_free(this_obj_conv);
42942 }
42943
42944 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
42945         LDKBlindedPayInfo this_ptr_conv;
42946         this_ptr_conv.inner = untag_ptr(this_ptr);
42947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42949         this_ptr_conv.is_owned = false;
42950         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
42951         return ret_conv;
42952 }
42953
42954 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
42955         LDKBlindedPayInfo this_ptr_conv;
42956         this_ptr_conv.inner = untag_ptr(this_ptr);
42957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42959         this_ptr_conv.is_owned = false;
42960         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
42961 }
42962
42963 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
42964         LDKBlindedPayInfo this_ptr_conv;
42965         this_ptr_conv.inner = untag_ptr(this_ptr);
42966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42968         this_ptr_conv.is_owned = false;
42969         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
42970         return ret_conv;
42971 }
42972
42973 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
42974         LDKBlindedPayInfo this_ptr_conv;
42975         this_ptr_conv.inner = untag_ptr(this_ptr);
42976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42978         this_ptr_conv.is_owned = false;
42979         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
42980 }
42981
42982 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
42983         LDKBlindedPayInfo this_ptr_conv;
42984         this_ptr_conv.inner = untag_ptr(this_ptr);
42985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42987         this_ptr_conv.is_owned = false;
42988         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
42989         return ret_conv;
42990 }
42991
42992 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
42993         LDKBlindedPayInfo this_ptr_conv;
42994         this_ptr_conv.inner = untag_ptr(this_ptr);
42995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42997         this_ptr_conv.is_owned = false;
42998         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
42999 }
43000
43001 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
43002         LDKBlindedPayInfo this_ptr_conv;
43003         this_ptr_conv.inner = untag_ptr(this_ptr);
43004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43006         this_ptr_conv.is_owned = false;
43007         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
43008         return ret_conv;
43009 }
43010
43011 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
43012         LDKBlindedPayInfo this_ptr_conv;
43013         this_ptr_conv.inner = untag_ptr(this_ptr);
43014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43016         this_ptr_conv.is_owned = false;
43017         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
43018 }
43019
43020 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
43021         LDKBlindedPayInfo this_ptr_conv;
43022         this_ptr_conv.inner = untag_ptr(this_ptr);
43023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43025         this_ptr_conv.is_owned = false;
43026         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
43027         return ret_conv;
43028 }
43029
43030 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
43031         LDKBlindedPayInfo this_ptr_conv;
43032         this_ptr_conv.inner = untag_ptr(this_ptr);
43033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43035         this_ptr_conv.is_owned = false;
43036         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
43037 }
43038
43039 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
43040         LDKBlindedPayInfo this_ptr_conv;
43041         this_ptr_conv.inner = untag_ptr(this_ptr);
43042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43044         this_ptr_conv.is_owned = false;
43045         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
43046         uint64_t ret_ref = 0;
43047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43049         return ret_ref;
43050 }
43051
43052 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
43053         LDKBlindedPayInfo this_ptr_conv;
43054         this_ptr_conv.inner = untag_ptr(this_ptr);
43055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43057         this_ptr_conv.is_owned = false;
43058         LDKBlindedHopFeatures val_conv;
43059         val_conv.inner = untag_ptr(val);
43060         val_conv.is_owned = ptr_is_owned(val);
43061         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43062         val_conv = BlindedHopFeatures_clone(&val_conv);
43063         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
43064 }
43065
43066 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) {
43067         LDKBlindedHopFeatures features_arg_conv;
43068         features_arg_conv.inner = untag_ptr(features_arg);
43069         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43070         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43071         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
43072         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);
43073         uint64_t ret_ref = 0;
43074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43076         return ret_ref;
43077 }
43078
43079 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
43080         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
43081         uint64_t ret_ref = 0;
43082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43084         return ret_ref;
43085 }
43086 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
43087         LDKBlindedPayInfo arg_conv;
43088         arg_conv.inner = untag_ptr(arg);
43089         arg_conv.is_owned = ptr_is_owned(arg);
43090         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43091         arg_conv.is_owned = false;
43092         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
43093         return ret_conv;
43094 }
43095
43096 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
43097         LDKBlindedPayInfo orig_conv;
43098         orig_conv.inner = untag_ptr(orig);
43099         orig_conv.is_owned = ptr_is_owned(orig);
43100         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43101         orig_conv.is_owned = false;
43102         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
43103         uint64_t ret_ref = 0;
43104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43106         return ret_ref;
43107 }
43108
43109 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
43110         LDKBlindedPayInfo o_conv;
43111         o_conv.inner = untag_ptr(o);
43112         o_conv.is_owned = ptr_is_owned(o);
43113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43114         o_conv.is_owned = false;
43115         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
43116         return ret_conv;
43117 }
43118
43119 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
43120         LDKBlindedPayInfo a_conv;
43121         a_conv.inner = untag_ptr(a);
43122         a_conv.is_owned = ptr_is_owned(a);
43123         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43124         a_conv.is_owned = false;
43125         LDKBlindedPayInfo b_conv;
43126         b_conv.inner = untag_ptr(b);
43127         b_conv.is_owned = ptr_is_owned(b);
43128         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43129         b_conv.is_owned = false;
43130         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
43131         return ret_conv;
43132 }
43133
43134 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
43135         LDKBlindedPayInfo obj_conv;
43136         obj_conv.inner = untag_ptr(obj);
43137         obj_conv.is_owned = ptr_is_owned(obj);
43138         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43139         obj_conv.is_owned = false;
43140         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
43141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43143         CVec_u8Z_free(ret_var);
43144         return ret_arr;
43145 }
43146
43147 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
43148         LDKu8slice ser_ref;
43149         ser_ref.datalen = ser->arr_len;
43150         ser_ref.data = ser->elems;
43151         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
43152         *ret_conv = BlindedPayInfo_read(ser_ref);
43153         FREE(ser);
43154         return tag_ptr(ret_conv, true);
43155 }
43156
43157 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
43158         LDKUnsignedInvoiceRequest this_obj_conv;
43159         this_obj_conv.inner = untag_ptr(this_obj);
43160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43162         UnsignedInvoiceRequest_free(this_obj_conv);
43163 }
43164
43165 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
43166         LDKInvoiceRequest this_obj_conv;
43167         this_obj_conv.inner = untag_ptr(this_obj);
43168         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43170         InvoiceRequest_free(this_obj_conv);
43171 }
43172
43173 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
43174         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
43175         uint64_t ret_ref = 0;
43176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43178         return ret_ref;
43179 }
43180 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
43181         LDKInvoiceRequest arg_conv;
43182         arg_conv.inner = untag_ptr(arg);
43183         arg_conv.is_owned = ptr_is_owned(arg);
43184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43185         arg_conv.is_owned = false;
43186         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
43187         return ret_conv;
43188 }
43189
43190 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
43191         LDKInvoiceRequest orig_conv;
43192         orig_conv.inner = untag_ptr(orig);
43193         orig_conv.is_owned = ptr_is_owned(orig);
43194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43195         orig_conv.is_owned = false;
43196         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
43197         uint64_t ret_ref = 0;
43198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43200         return ret_ref;
43201 }
43202
43203 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
43204         LDKInvoiceRequest this_arg_conv;
43205         this_arg_conv.inner = untag_ptr(this_arg);
43206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43208         this_arg_conv.is_owned = false;
43209         LDKu8slice ret_var = InvoiceRequest_metadata(&this_arg_conv);
43210         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43211         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43212         return ret_arr;
43213 }
43214
43215 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
43216         LDKInvoiceRequest this_arg_conv;
43217         this_arg_conv.inner = untag_ptr(this_arg);
43218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43220         this_arg_conv.is_owned = false;
43221         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43222         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
43223         return ret_arr;
43224 }
43225
43226 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
43227         LDKInvoiceRequest this_arg_conv;
43228         this_arg_conv.inner = untag_ptr(this_arg);
43229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43231         this_arg_conv.is_owned = false;
43232         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43233         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
43234         uint64_t ret_ref = tag_ptr(ret_copy, true);
43235         return ret_ref;
43236 }
43237
43238 uint64_t  __attribute__((export_name("TS_InvoiceRequest_features"))) TS_InvoiceRequest_features(uint64_t this_arg) {
43239         LDKInvoiceRequest this_arg_conv;
43240         this_arg_conv.inner = untag_ptr(this_arg);
43241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43243         this_arg_conv.is_owned = false;
43244         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_features(&this_arg_conv);
43245         uint64_t ret_ref = 0;
43246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43248         return ret_ref;
43249 }
43250
43251 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
43252         LDKInvoiceRequest this_arg_conv;
43253         this_arg_conv.inner = untag_ptr(this_arg);
43254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43256         this_arg_conv.is_owned = false;
43257         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43258         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
43259         uint64_t ret_ref = tag_ptr(ret_copy, true);
43260         return ret_ref;
43261 }
43262
43263 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
43264         LDKInvoiceRequest this_arg_conv;
43265         this_arg_conv.inner = untag_ptr(this_arg);
43266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43268         this_arg_conv.is_owned = false;
43269         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43270         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
43271         return ret_arr;
43272 }
43273
43274 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
43275         LDKInvoiceRequest this_arg_conv;
43276         this_arg_conv.inner = untag_ptr(this_arg);
43277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43279         this_arg_conv.is_owned = false;
43280         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
43281         uint64_t ret_ref = 0;
43282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43284         return ret_ref;
43285 }
43286
43287 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
43288         LDKInvoiceRequest obj_conv;
43289         obj_conv.inner = untag_ptr(obj);
43290         obj_conv.is_owned = ptr_is_owned(obj);
43291         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43292         obj_conv.is_owned = false;
43293         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
43294         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43295         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43296         CVec_u8Z_free(ret_var);
43297         return ret_arr;
43298 }
43299
43300 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
43301         LDKOffer this_obj_conv;
43302         this_obj_conv.inner = untag_ptr(this_obj);
43303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43305         Offer_free(this_obj_conv);
43306 }
43307
43308 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
43309         LDKOffer ret_var = Offer_clone(arg);
43310         uint64_t ret_ref = 0;
43311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43313         return ret_ref;
43314 }
43315 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
43316         LDKOffer arg_conv;
43317         arg_conv.inner = untag_ptr(arg);
43318         arg_conv.is_owned = ptr_is_owned(arg);
43319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43320         arg_conv.is_owned = false;
43321         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
43322         return ret_conv;
43323 }
43324
43325 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
43326         LDKOffer orig_conv;
43327         orig_conv.inner = untag_ptr(orig);
43328         orig_conv.is_owned = ptr_is_owned(orig);
43329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43330         orig_conv.is_owned = false;
43331         LDKOffer ret_var = Offer_clone(&orig_conv);
43332         uint64_t ret_ref = 0;
43333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43335         return ret_ref;
43336 }
43337
43338 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
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         LDKCVec_ChainHashZ ret_var = Offer_chains(&this_arg_conv);
43345         ptrArray ret_arr = NULL;
43346         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
43347         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
43348         for (size_t m = 0; m < ret_var.datalen; m++) {
43349                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
43350                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
43351                 ret_arr_ptr[m] = ret_conv_12_arr;
43352         }
43353         
43354         FREE(ret_var.data);
43355         return ret_arr;
43356 }
43357
43358 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
43359         LDKOffer this_arg_conv;
43360         this_arg_conv.inner = untag_ptr(this_arg);
43361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43363         this_arg_conv.is_owned = false;
43364         LDKThirtyTwoBytes chain_ref;
43365         CHECK(chain->arr_len == 32);
43366         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
43367         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
43368         return ret_conv;
43369 }
43370
43371 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
43372         LDKOffer this_arg_conv;
43373         this_arg_conv.inner = untag_ptr(this_arg);
43374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43376         this_arg_conv.is_owned = false;
43377         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43378         *ret_copy = Offer_metadata(&this_arg_conv);
43379         uint64_t ret_ref = tag_ptr(ret_copy, true);
43380         return ret_ref;
43381 }
43382
43383 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
43384         LDKOffer this_arg_conv;
43385         this_arg_conv.inner = untag_ptr(this_arg);
43386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43388         this_arg_conv.is_owned = false;
43389         LDKAmount ret_var = Offer_amount(&this_arg_conv);
43390         uint64_t ret_ref = 0;
43391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43393         return ret_ref;
43394 }
43395
43396 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
43397         LDKOffer this_arg_conv;
43398         this_arg_conv.inner = untag_ptr(this_arg);
43399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43401         this_arg_conv.is_owned = false;
43402         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
43403         uint64_t ret_ref = 0;
43404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43406         return ret_ref;
43407 }
43408
43409 uint64_t  __attribute__((export_name("TS_Offer_features"))) TS_Offer_features(uint64_t this_arg) {
43410         LDKOffer this_arg_conv;
43411         this_arg_conv.inner = untag_ptr(this_arg);
43412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43414         this_arg_conv.is_owned = false;
43415         LDKOfferFeatures ret_var = Offer_features(&this_arg_conv);
43416         uint64_t ret_ref = 0;
43417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43419         return ret_ref;
43420 }
43421
43422 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
43423         LDKOffer this_arg_conv;
43424         this_arg_conv.inner = untag_ptr(this_arg);
43425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43427         this_arg_conv.is_owned = false;
43428         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
43429         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
43430         uint64_t ret_ref = tag_ptr(ret_copy, true);
43431         return ret_ref;
43432 }
43433
43434 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
43435         LDKOffer this_arg_conv;
43436         this_arg_conv.inner = untag_ptr(this_arg);
43437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43439         this_arg_conv.is_owned = false;
43440         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
43441         uint64_t ret_ref = 0;
43442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43444         return ret_ref;
43445 }
43446
43447 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
43448         LDKOffer this_arg_conv;
43449         this_arg_conv.inner = untag_ptr(this_arg);
43450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43452         this_arg_conv.is_owned = false;
43453         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
43454         uint64_tArray ret_arr = NULL;
43455         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43456         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43457         for (size_t n = 0; n < ret_var.datalen; n++) {
43458                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
43459                 uint64_t ret_conv_13_ref = 0;
43460                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
43461                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
43462                 ret_arr_ptr[n] = ret_conv_13_ref;
43463         }
43464         
43465         FREE(ret_var.data);
43466         return ret_arr;
43467 }
43468
43469 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
43470         LDKOffer this_arg_conv;
43471         this_arg_conv.inner = untag_ptr(this_arg);
43472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43474         this_arg_conv.is_owned = false;
43475         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
43476         uint64_t ret_ref = 0;
43477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43479         return ret_ref;
43480 }
43481
43482 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
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         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
43489         return ret_conv;
43490 }
43491
43492 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
43493         LDKOffer this_arg_conv;
43494         this_arg_conv.inner = untag_ptr(this_arg);
43495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43497         this_arg_conv.is_owned = false;
43498         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
43499         return ret_conv;
43500 }
43501
43502 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
43503         LDKOffer this_arg_conv;
43504         this_arg_conv.inner = untag_ptr(this_arg);
43505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43507         this_arg_conv.is_owned = false;
43508         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43509         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
43510         return ret_arr;
43511 }
43512
43513 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
43514         LDKOffer obj_conv;
43515         obj_conv.inner = untag_ptr(obj);
43516         obj_conv.is_owned = ptr_is_owned(obj);
43517         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43518         obj_conv.is_owned = false;
43519         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
43520         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43521         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43522         CVec_u8Z_free(ret_var);
43523         return ret_arr;
43524 }
43525
43526 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
43527         LDKAmount this_obj_conv;
43528         this_obj_conv.inner = untag_ptr(this_obj);
43529         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43531         Amount_free(this_obj_conv);
43532 }
43533
43534 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
43535         LDKAmount ret_var = Amount_clone(arg);
43536         uint64_t ret_ref = 0;
43537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43539         return ret_ref;
43540 }
43541 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
43542         LDKAmount arg_conv;
43543         arg_conv.inner = untag_ptr(arg);
43544         arg_conv.is_owned = ptr_is_owned(arg);
43545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43546         arg_conv.is_owned = false;
43547         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
43548         return ret_conv;
43549 }
43550
43551 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
43552         LDKAmount orig_conv;
43553         orig_conv.inner = untag_ptr(orig);
43554         orig_conv.is_owned = ptr_is_owned(orig);
43555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43556         orig_conv.is_owned = false;
43557         LDKAmount ret_var = Amount_clone(&orig_conv);
43558         uint64_t ret_ref = 0;
43559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43561         return ret_ref;
43562 }
43563
43564 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
43565         LDKQuantity this_obj_conv;
43566         this_obj_conv.inner = untag_ptr(this_obj);
43567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43569         Quantity_free(this_obj_conv);
43570 }
43571
43572 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
43573         LDKQuantity ret_var = Quantity_clone(arg);
43574         uint64_t ret_ref = 0;
43575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43577         return ret_ref;
43578 }
43579 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
43580         LDKQuantity arg_conv;
43581         arg_conv.inner = untag_ptr(arg);
43582         arg_conv.is_owned = ptr_is_owned(arg);
43583         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43584         arg_conv.is_owned = false;
43585         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
43586         return ret_conv;
43587 }
43588
43589 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
43590         LDKQuantity orig_conv;
43591         orig_conv.inner = untag_ptr(orig);
43592         orig_conv.is_owned = ptr_is_owned(orig);
43593         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43594         orig_conv.is_owned = false;
43595         LDKQuantity ret_var = Quantity_clone(&orig_conv);
43596         uint64_t ret_ref = 0;
43597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43599         return ret_ref;
43600 }
43601
43602 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
43603         LDKRefund this_obj_conv;
43604         this_obj_conv.inner = untag_ptr(this_obj);
43605         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43607         Refund_free(this_obj_conv);
43608 }
43609
43610 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
43611         LDKRefund ret_var = Refund_clone(arg);
43612         uint64_t ret_ref = 0;
43613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43615         return ret_ref;
43616 }
43617 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
43618         LDKRefund arg_conv;
43619         arg_conv.inner = untag_ptr(arg);
43620         arg_conv.is_owned = ptr_is_owned(arg);
43621         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43622         arg_conv.is_owned = false;
43623         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
43624         return ret_conv;
43625 }
43626
43627 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
43628         LDKRefund orig_conv;
43629         orig_conv.inner = untag_ptr(orig);
43630         orig_conv.is_owned = ptr_is_owned(orig);
43631         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43632         orig_conv.is_owned = false;
43633         LDKRefund ret_var = Refund_clone(&orig_conv);
43634         uint64_t ret_ref = 0;
43635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43637         return ret_ref;
43638 }
43639
43640 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
43641         LDKRefund this_arg_conv;
43642         this_arg_conv.inner = untag_ptr(this_arg);
43643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43645         this_arg_conv.is_owned = false;
43646         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
43647         uint64_t ret_ref = 0;
43648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43650         return ret_ref;
43651 }
43652
43653 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
43654         LDKRefund this_arg_conv;
43655         this_arg_conv.inner = untag_ptr(this_arg);
43656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43658         this_arg_conv.is_owned = false;
43659         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
43660         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
43661         uint64_t ret_ref = tag_ptr(ret_copy, true);
43662         return ret_ref;
43663 }
43664
43665 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
43666         LDKRefund this_arg_conv;
43667         this_arg_conv.inner = untag_ptr(this_arg);
43668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43670         this_arg_conv.is_owned = false;
43671         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
43672         uint64_t ret_ref = 0;
43673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43675         return ret_ref;
43676 }
43677
43678 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
43679         LDKRefund this_arg_conv;
43680         this_arg_conv.inner = untag_ptr(this_arg);
43681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43683         this_arg_conv.is_owned = false;
43684         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
43685         uint64_tArray ret_arr = NULL;
43686         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43687         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43688         for (size_t n = 0; n < ret_var.datalen; n++) {
43689                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
43690                 uint64_t ret_conv_13_ref = 0;
43691                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
43692                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
43693                 ret_arr_ptr[n] = ret_conv_13_ref;
43694         }
43695         
43696         FREE(ret_var.data);
43697         return ret_arr;
43698 }
43699
43700 int8_tArray  __attribute__((export_name("TS_Refund_metadata"))) TS_Refund_metadata(uint64_t this_arg) {
43701         LDKRefund this_arg_conv;
43702         this_arg_conv.inner = untag_ptr(this_arg);
43703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43705         this_arg_conv.is_owned = false;
43706         LDKu8slice ret_var = Refund_metadata(&this_arg_conv);
43707         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43708         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43709         return ret_arr;
43710 }
43711
43712 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
43713         LDKRefund this_arg_conv;
43714         this_arg_conv.inner = untag_ptr(this_arg);
43715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43717         this_arg_conv.is_owned = false;
43718         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43719         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
43720         return ret_arr;
43721 }
43722
43723 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
43724         LDKRefund this_arg_conv;
43725         this_arg_conv.inner = untag_ptr(this_arg);
43726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43728         this_arg_conv.is_owned = false;
43729         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
43730         return ret_conv;
43731 }
43732
43733 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
43734         LDKRefund this_arg_conv;
43735         this_arg_conv.inner = untag_ptr(this_arg);
43736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43738         this_arg_conv.is_owned = false;
43739         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
43740         uint64_t ret_ref = 0;
43741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43743         return ret_ref;
43744 }
43745
43746 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
43747         LDKRefund this_arg_conv;
43748         this_arg_conv.inner = untag_ptr(this_arg);
43749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43751         this_arg_conv.is_owned = false;
43752         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43753         *ret_copy = Refund_quantity(&this_arg_conv);
43754         uint64_t ret_ref = tag_ptr(ret_copy, true);
43755         return ret_ref;
43756 }
43757
43758 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
43759         LDKRefund this_arg_conv;
43760         this_arg_conv.inner = untag_ptr(this_arg);
43761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43763         this_arg_conv.is_owned = false;
43764         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43765         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
43766         return ret_arr;
43767 }
43768
43769 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
43770         LDKRefund this_arg_conv;
43771         this_arg_conv.inner = untag_ptr(this_arg);
43772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43774         this_arg_conv.is_owned = false;
43775         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
43776         uint64_t ret_ref = 0;
43777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43779         return ret_ref;
43780 }
43781
43782 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
43783         LDKRefund obj_conv;
43784         obj_conv.inner = untag_ptr(obj);
43785         obj_conv.is_owned = ptr_is_owned(obj);
43786         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43787         obj_conv.is_owned = false;
43788         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
43789         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43790         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43791         CVec_u8Z_free(ret_var);
43792         return ret_arr;
43793 }
43794
43795 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
43796         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
43797         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
43798         return ret_conv;
43799 }
43800
43801 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
43802         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
43803         return ret_conv;
43804 }
43805
43806 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
43807         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
43808         return ret_conv;
43809 }
43810
43811 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
43812         if (!ptr_is_owned(this_ptr)) return;
43813         void* this_ptr_ptr = untag_ptr(this_ptr);
43814         CHECK_ACCESS(this_ptr_ptr);
43815         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
43816         FREE(untag_ptr(this_ptr));
43817         UtxoResult_free(this_ptr_conv);
43818 }
43819
43820 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
43821         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43822         *ret_copy = UtxoResult_clone(arg);
43823         uint64_t ret_ref = tag_ptr(ret_copy, true);
43824         return ret_ref;
43825 }
43826 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
43827         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
43828         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
43829         return ret_conv;
43830 }
43831
43832 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
43833         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
43834         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43835         *ret_copy = UtxoResult_clone(orig_conv);
43836         uint64_t ret_ref = tag_ptr(ret_copy, true);
43837         return ret_ref;
43838 }
43839
43840 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
43841         void* a_ptr = untag_ptr(a);
43842         CHECK_ACCESS(a_ptr);
43843         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
43844         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
43845         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43846         *ret_copy = UtxoResult_sync(a_conv);
43847         uint64_t ret_ref = tag_ptr(ret_copy, true);
43848         return ret_ref;
43849 }
43850
43851 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
43852         LDKUtxoFuture a_conv;
43853         a_conv.inner = untag_ptr(a);
43854         a_conv.is_owned = ptr_is_owned(a);
43855         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43856         a_conv = UtxoFuture_clone(&a_conv);
43857         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43858         *ret_copy = UtxoResult_async(a_conv);
43859         uint64_t ret_ref = tag_ptr(ret_copy, true);
43860         return ret_ref;
43861 }
43862
43863 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
43864         if (!ptr_is_owned(this_ptr)) return;
43865         void* this_ptr_ptr = untag_ptr(this_ptr);
43866         CHECK_ACCESS(this_ptr_ptr);
43867         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
43868         FREE(untag_ptr(this_ptr));
43869         UtxoLookup_free(this_ptr_conv);
43870 }
43871
43872 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
43873         LDKUtxoFuture this_obj_conv;
43874         this_obj_conv.inner = untag_ptr(this_obj);
43875         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43877         UtxoFuture_free(this_obj_conv);
43878 }
43879
43880 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
43881         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
43882         uint64_t ret_ref = 0;
43883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43885         return ret_ref;
43886 }
43887 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
43888         LDKUtxoFuture arg_conv;
43889         arg_conv.inner = untag_ptr(arg);
43890         arg_conv.is_owned = ptr_is_owned(arg);
43891         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43892         arg_conv.is_owned = false;
43893         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
43894         return ret_conv;
43895 }
43896
43897 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
43898         LDKUtxoFuture orig_conv;
43899         orig_conv.inner = untag_ptr(orig);
43900         orig_conv.is_owned = ptr_is_owned(orig);
43901         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43902         orig_conv.is_owned = false;
43903         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
43904         uint64_t ret_ref = 0;
43905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43907         return ret_ref;
43908 }
43909
43910 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
43911         LDKUtxoFuture ret_var = UtxoFuture_new();
43912         uint64_t ret_ref = 0;
43913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43915         return ret_ref;
43916 }
43917
43918 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
43919         LDKUtxoFuture this_arg_conv;
43920         this_arg_conv.inner = untag_ptr(this_arg);
43921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43923         this_arg_conv.is_owned = false;
43924         LDKNetworkGraph graph_conv;
43925         graph_conv.inner = untag_ptr(graph);
43926         graph_conv.is_owned = ptr_is_owned(graph);
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
43928         graph_conv.is_owned = false;
43929         void* result_ptr = untag_ptr(result);
43930         CHECK_ACCESS(result_ptr);
43931         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
43932         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
43933 }
43934
43935 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
43936         LDKUtxoFuture this_arg_conv;
43937         this_arg_conv.inner = untag_ptr(this_arg);
43938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43940         this_arg_conv.is_owned = false;
43941         LDKNetworkGraph graph_conv;
43942         graph_conv.inner = untag_ptr(graph);
43943         graph_conv.is_owned = ptr_is_owned(graph);
43944         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
43945         graph_conv.is_owned = false;
43946         LDKP2PGossipSync gossip_conv;
43947         gossip_conv.inner = untag_ptr(gossip);
43948         gossip_conv.is_owned = ptr_is_owned(gossip);
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
43950         gossip_conv.is_owned = false;
43951         void* result_ptr = untag_ptr(result);
43952         CHECK_ACCESS(result_ptr);
43953         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
43954         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
43955 }
43956
43957 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
43958         LDKNodeId this_obj_conv;
43959         this_obj_conv.inner = untag_ptr(this_obj);
43960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43962         NodeId_free(this_obj_conv);
43963 }
43964
43965 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
43966         LDKNodeId ret_var = NodeId_clone(arg);
43967         uint64_t ret_ref = 0;
43968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43970         return ret_ref;
43971 }
43972 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
43973         LDKNodeId arg_conv;
43974         arg_conv.inner = untag_ptr(arg);
43975         arg_conv.is_owned = ptr_is_owned(arg);
43976         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43977         arg_conv.is_owned = false;
43978         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
43979         return ret_conv;
43980 }
43981
43982 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
43983         LDKNodeId orig_conv;
43984         orig_conv.inner = untag_ptr(orig);
43985         orig_conv.is_owned = ptr_is_owned(orig);
43986         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43987         orig_conv.is_owned = false;
43988         LDKNodeId ret_var = NodeId_clone(&orig_conv);
43989         uint64_t ret_ref = 0;
43990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43992         return ret_ref;
43993 }
43994
43995 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
43996         LDKPublicKey pubkey_ref;
43997         CHECK(pubkey->arr_len == 33);
43998         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
43999         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
44000         uint64_t ret_ref = 0;
44001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44003         return ret_ref;
44004 }
44005
44006 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
44007         LDKNodeId this_arg_conv;
44008         this_arg_conv.inner = untag_ptr(this_arg);
44009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44011         this_arg_conv.is_owned = false;
44012         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
44013         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44014         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44015         return ret_arr;
44016 }
44017
44018 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
44019         LDKNodeId this_arg_conv;
44020         this_arg_conv.inner = untag_ptr(this_arg);
44021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44023         this_arg_conv.is_owned = false;
44024         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
44025         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
44026         return tag_ptr(ret_conv, true);
44027 }
44028
44029 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
44030         LDKNodeId o_conv;
44031         o_conv.inner = untag_ptr(o);
44032         o_conv.is_owned = ptr_is_owned(o);
44033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44034         o_conv.is_owned = false;
44035         int64_t ret_conv = NodeId_hash(&o_conv);
44036         return ret_conv;
44037 }
44038
44039 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
44040         LDKNodeId obj_conv;
44041         obj_conv.inner = untag_ptr(obj);
44042         obj_conv.is_owned = ptr_is_owned(obj);
44043         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44044         obj_conv.is_owned = false;
44045         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
44046         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44047         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44048         CVec_u8Z_free(ret_var);
44049         return ret_arr;
44050 }
44051
44052 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
44053         LDKu8slice ser_ref;
44054         ser_ref.datalen = ser->arr_len;
44055         ser_ref.data = ser->elems;
44056         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
44057         *ret_conv = NodeId_read(ser_ref);
44058         FREE(ser);
44059         return tag_ptr(ret_conv, true);
44060 }
44061
44062 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
44063         LDKNetworkGraph this_obj_conv;
44064         this_obj_conv.inner = untag_ptr(this_obj);
44065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44067         NetworkGraph_free(this_obj_conv);
44068 }
44069
44070 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
44071         LDKReadOnlyNetworkGraph this_obj_conv;
44072         this_obj_conv.inner = untag_ptr(this_obj);
44073         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44075         ReadOnlyNetworkGraph_free(this_obj_conv);
44076 }
44077
44078 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
44079         if (!ptr_is_owned(this_ptr)) return;
44080         void* this_ptr_ptr = untag_ptr(this_ptr);
44081         CHECK_ACCESS(this_ptr_ptr);
44082         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
44083         FREE(untag_ptr(this_ptr));
44084         NetworkUpdate_free(this_ptr_conv);
44085 }
44086
44087 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
44088         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44089         *ret_copy = NetworkUpdate_clone(arg);
44090         uint64_t ret_ref = tag_ptr(ret_copy, true);
44091         return ret_ref;
44092 }
44093 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
44094         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
44095         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
44096         return ret_conv;
44097 }
44098
44099 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
44100         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
44101         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44102         *ret_copy = NetworkUpdate_clone(orig_conv);
44103         uint64_t ret_ref = tag_ptr(ret_copy, true);
44104         return ret_ref;
44105 }
44106
44107 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
44108         LDKChannelUpdate msg_conv;
44109         msg_conv.inner = untag_ptr(msg);
44110         msg_conv.is_owned = ptr_is_owned(msg);
44111         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44112         msg_conv = ChannelUpdate_clone(&msg_conv);
44113         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44114         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
44115         uint64_t ret_ref = tag_ptr(ret_copy, true);
44116         return ret_ref;
44117 }
44118
44119 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
44120         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44121         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
44122         uint64_t ret_ref = tag_ptr(ret_copy, true);
44123         return ret_ref;
44124 }
44125
44126 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
44127         LDKPublicKey node_id_ref;
44128         CHECK(node_id->arr_len == 33);
44129         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
44130         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44131         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
44132         uint64_t ret_ref = tag_ptr(ret_copy, true);
44133         return ret_ref;
44134 }
44135
44136 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
44137         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
44138         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
44139         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
44140         return ret_conv;
44141 }
44142
44143 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
44144         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
44145         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
44146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44148         CVec_u8Z_free(ret_var);
44149         return ret_arr;
44150 }
44151
44152 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
44153         LDKu8slice ser_ref;
44154         ser_ref.datalen = ser->arr_len;
44155         ser_ref.data = ser->elems;
44156         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
44157         *ret_conv = NetworkUpdate_read(ser_ref);
44158         FREE(ser);
44159         return tag_ptr(ret_conv, true);
44160 }
44161
44162 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
44163         LDKP2PGossipSync this_obj_conv;
44164         this_obj_conv.inner = untag_ptr(this_obj);
44165         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44167         P2PGossipSync_free(this_obj_conv);
44168 }
44169
44170 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
44171         LDKNetworkGraph network_graph_conv;
44172         network_graph_conv.inner = untag_ptr(network_graph);
44173         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44174         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44175         network_graph_conv.is_owned = false;
44176         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44177         CHECK_ACCESS(utxo_lookup_ptr);
44178         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44179         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44180         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44181                 // Manually implement clone for Java trait instances
44182                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44183                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44184                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44185                 }
44186         }
44187         void* logger_ptr = untag_ptr(logger);
44188         CHECK_ACCESS(logger_ptr);
44189         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44190         if (logger_conv.free == LDKLogger_JCalls_free) {
44191                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44192                 LDKLogger_JCalls_cloned(&logger_conv);
44193         }
44194         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
44195         uint64_t ret_ref = 0;
44196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44198         return ret_ref;
44199 }
44200
44201 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
44202         LDKP2PGossipSync 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         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44208         CHECK_ACCESS(utxo_lookup_ptr);
44209         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44210         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44211         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44212                 // Manually implement clone for Java trait instances
44213                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44214                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44215                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44216                 }
44217         }
44218         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
44219 }
44220
44221 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
44222         LDKNetworkGraph this_arg_conv;
44223         this_arg_conv.inner = untag_ptr(this_arg);
44224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44226         this_arg_conv.is_owned = false;
44227         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
44228         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
44229 }
44230
44231 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
44232         LDKP2PGossipSync this_arg_conv;
44233         this_arg_conv.inner = untag_ptr(this_arg);
44234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44236         this_arg_conv.is_owned = false;
44237         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
44238         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
44239         return tag_ptr(ret_ret, true);
44240 }
44241
44242 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
44243         LDKP2PGossipSync this_arg_conv;
44244         this_arg_conv.inner = untag_ptr(this_arg);
44245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44247         this_arg_conv.is_owned = false;
44248         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
44249         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
44250         return tag_ptr(ret_ret, true);
44251 }
44252
44253 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
44254         LDKChannelUpdateInfo this_obj_conv;
44255         this_obj_conv.inner = untag_ptr(this_obj);
44256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44258         ChannelUpdateInfo_free(this_obj_conv);
44259 }
44260
44261 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
44262         LDKChannelUpdateInfo this_ptr_conv;
44263         this_ptr_conv.inner = untag_ptr(this_ptr);
44264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44266         this_ptr_conv.is_owned = false;
44267         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
44268         return ret_conv;
44269 }
44270
44271 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
44272         LDKChannelUpdateInfo this_ptr_conv;
44273         this_ptr_conv.inner = untag_ptr(this_ptr);
44274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44276         this_ptr_conv.is_owned = false;
44277         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
44278 }
44279
44280 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
44281         LDKChannelUpdateInfo this_ptr_conv;
44282         this_ptr_conv.inner = untag_ptr(this_ptr);
44283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44285         this_ptr_conv.is_owned = false;
44286         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
44287         return ret_conv;
44288 }
44289
44290 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
44291         LDKChannelUpdateInfo this_ptr_conv;
44292         this_ptr_conv.inner = untag_ptr(this_ptr);
44293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44295         this_ptr_conv.is_owned = false;
44296         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
44297 }
44298
44299 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
44300         LDKChannelUpdateInfo this_ptr_conv;
44301         this_ptr_conv.inner = untag_ptr(this_ptr);
44302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44304         this_ptr_conv.is_owned = false;
44305         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
44306         return ret_conv;
44307 }
44308
44309 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
44310         LDKChannelUpdateInfo this_ptr_conv;
44311         this_ptr_conv.inner = untag_ptr(this_ptr);
44312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44314         this_ptr_conv.is_owned = false;
44315         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
44316 }
44317
44318 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
44319         LDKChannelUpdateInfo this_ptr_conv;
44320         this_ptr_conv.inner = untag_ptr(this_ptr);
44321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44323         this_ptr_conv.is_owned = false;
44324         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
44325         return ret_conv;
44326 }
44327
44328 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
44329         LDKChannelUpdateInfo this_ptr_conv;
44330         this_ptr_conv.inner = untag_ptr(this_ptr);
44331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44333         this_ptr_conv.is_owned = false;
44334         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
44335 }
44336
44337 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
44338         LDKChannelUpdateInfo this_ptr_conv;
44339         this_ptr_conv.inner = untag_ptr(this_ptr);
44340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44342         this_ptr_conv.is_owned = false;
44343         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
44344         return ret_conv;
44345 }
44346
44347 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
44348         LDKChannelUpdateInfo this_ptr_conv;
44349         this_ptr_conv.inner = untag_ptr(this_ptr);
44350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44352         this_ptr_conv.is_owned = false;
44353         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
44354 }
44355
44356 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
44357         LDKChannelUpdateInfo this_ptr_conv;
44358         this_ptr_conv.inner = untag_ptr(this_ptr);
44359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44361         this_ptr_conv.is_owned = false;
44362         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
44363         uint64_t ret_ref = 0;
44364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44366         return ret_ref;
44367 }
44368
44369 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
44370         LDKChannelUpdateInfo this_ptr_conv;
44371         this_ptr_conv.inner = untag_ptr(this_ptr);
44372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44374         this_ptr_conv.is_owned = false;
44375         LDKRoutingFees val_conv;
44376         val_conv.inner = untag_ptr(val);
44377         val_conv.is_owned = ptr_is_owned(val);
44378         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44379         val_conv = RoutingFees_clone(&val_conv);
44380         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
44381 }
44382
44383 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
44384         LDKChannelUpdateInfo this_ptr_conv;
44385         this_ptr_conv.inner = untag_ptr(this_ptr);
44386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44388         this_ptr_conv.is_owned = false;
44389         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
44390         uint64_t ret_ref = 0;
44391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44393         return ret_ref;
44394 }
44395
44396 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
44397         LDKChannelUpdateInfo this_ptr_conv;
44398         this_ptr_conv.inner = untag_ptr(this_ptr);
44399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44401         this_ptr_conv.is_owned = false;
44402         LDKChannelUpdate val_conv;
44403         val_conv.inner = untag_ptr(val);
44404         val_conv.is_owned = ptr_is_owned(val);
44405         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44406         val_conv = ChannelUpdate_clone(&val_conv);
44407         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
44408 }
44409
44410 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) {
44411         LDKRoutingFees fees_arg_conv;
44412         fees_arg_conv.inner = untag_ptr(fees_arg);
44413         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
44414         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
44415         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
44416         LDKChannelUpdate last_update_message_arg_conv;
44417         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
44418         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
44419         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
44420         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
44421         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);
44422         uint64_t ret_ref = 0;
44423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44425         return ret_ref;
44426 }
44427
44428 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
44429         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
44430         uint64_t ret_ref = 0;
44431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44433         return ret_ref;
44434 }
44435 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
44436         LDKChannelUpdateInfo arg_conv;
44437         arg_conv.inner = untag_ptr(arg);
44438         arg_conv.is_owned = ptr_is_owned(arg);
44439         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44440         arg_conv.is_owned = false;
44441         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
44442         return ret_conv;
44443 }
44444
44445 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
44446         LDKChannelUpdateInfo orig_conv;
44447         orig_conv.inner = untag_ptr(orig);
44448         orig_conv.is_owned = ptr_is_owned(orig);
44449         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44450         orig_conv.is_owned = false;
44451         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
44452         uint64_t ret_ref = 0;
44453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44455         return ret_ref;
44456 }
44457
44458 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
44459         LDKChannelUpdateInfo a_conv;
44460         a_conv.inner = untag_ptr(a);
44461         a_conv.is_owned = ptr_is_owned(a);
44462         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44463         a_conv.is_owned = false;
44464         LDKChannelUpdateInfo b_conv;
44465         b_conv.inner = untag_ptr(b);
44466         b_conv.is_owned = ptr_is_owned(b);
44467         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44468         b_conv.is_owned = false;
44469         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
44470         return ret_conv;
44471 }
44472
44473 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
44474         LDKChannelUpdateInfo obj_conv;
44475         obj_conv.inner = untag_ptr(obj);
44476         obj_conv.is_owned = ptr_is_owned(obj);
44477         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44478         obj_conv.is_owned = false;
44479         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
44480         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44481         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44482         CVec_u8Z_free(ret_var);
44483         return ret_arr;
44484 }
44485
44486 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
44487         LDKu8slice ser_ref;
44488         ser_ref.datalen = ser->arr_len;
44489         ser_ref.data = ser->elems;
44490         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
44491         *ret_conv = ChannelUpdateInfo_read(ser_ref);
44492         FREE(ser);
44493         return tag_ptr(ret_conv, true);
44494 }
44495
44496 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
44497         LDKChannelInfo this_obj_conv;
44498         this_obj_conv.inner = untag_ptr(this_obj);
44499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44501         ChannelInfo_free(this_obj_conv);
44502 }
44503
44504 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
44505         LDKChannelInfo this_ptr_conv;
44506         this_ptr_conv.inner = untag_ptr(this_ptr);
44507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44509         this_ptr_conv.is_owned = false;
44510         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
44511         uint64_t ret_ref = 0;
44512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44514         return ret_ref;
44515 }
44516
44517 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
44518         LDKChannelInfo this_ptr_conv;
44519         this_ptr_conv.inner = untag_ptr(this_ptr);
44520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44522         this_ptr_conv.is_owned = false;
44523         LDKChannelFeatures val_conv;
44524         val_conv.inner = untag_ptr(val);
44525         val_conv.is_owned = ptr_is_owned(val);
44526         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44527         val_conv = ChannelFeatures_clone(&val_conv);
44528         ChannelInfo_set_features(&this_ptr_conv, val_conv);
44529 }
44530
44531 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
44532         LDKChannelInfo this_ptr_conv;
44533         this_ptr_conv.inner = untag_ptr(this_ptr);
44534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44536         this_ptr_conv.is_owned = false;
44537         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
44538         uint64_t ret_ref = 0;
44539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44541         return ret_ref;
44542 }
44543
44544 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
44545         LDKChannelInfo this_ptr_conv;
44546         this_ptr_conv.inner = untag_ptr(this_ptr);
44547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44549         this_ptr_conv.is_owned = false;
44550         LDKNodeId val_conv;
44551         val_conv.inner = untag_ptr(val);
44552         val_conv.is_owned = ptr_is_owned(val);
44553         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44554         val_conv = NodeId_clone(&val_conv);
44555         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
44556 }
44557
44558 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
44559         LDKChannelInfo this_ptr_conv;
44560         this_ptr_conv.inner = untag_ptr(this_ptr);
44561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44563         this_ptr_conv.is_owned = false;
44564         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
44565         uint64_t ret_ref = 0;
44566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44568         return ret_ref;
44569 }
44570
44571 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
44572         LDKChannelInfo this_ptr_conv;
44573         this_ptr_conv.inner = untag_ptr(this_ptr);
44574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44576         this_ptr_conv.is_owned = false;
44577         LDKChannelUpdateInfo val_conv;
44578         val_conv.inner = untag_ptr(val);
44579         val_conv.is_owned = ptr_is_owned(val);
44580         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44581         val_conv = ChannelUpdateInfo_clone(&val_conv);
44582         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
44583 }
44584
44585 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
44586         LDKChannelInfo this_ptr_conv;
44587         this_ptr_conv.inner = untag_ptr(this_ptr);
44588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44590         this_ptr_conv.is_owned = false;
44591         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
44592         uint64_t ret_ref = 0;
44593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44595         return ret_ref;
44596 }
44597
44598 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
44599         LDKChannelInfo this_ptr_conv;
44600         this_ptr_conv.inner = untag_ptr(this_ptr);
44601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44603         this_ptr_conv.is_owned = false;
44604         LDKNodeId val_conv;
44605         val_conv.inner = untag_ptr(val);
44606         val_conv.is_owned = ptr_is_owned(val);
44607         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44608         val_conv = NodeId_clone(&val_conv);
44609         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
44610 }
44611
44612 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
44613         LDKChannelInfo this_ptr_conv;
44614         this_ptr_conv.inner = untag_ptr(this_ptr);
44615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44617         this_ptr_conv.is_owned = false;
44618         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
44619         uint64_t ret_ref = 0;
44620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44622         return ret_ref;
44623 }
44624
44625 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
44626         LDKChannelInfo this_ptr_conv;
44627         this_ptr_conv.inner = untag_ptr(this_ptr);
44628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44630         this_ptr_conv.is_owned = false;
44631         LDKChannelUpdateInfo val_conv;
44632         val_conv.inner = untag_ptr(val);
44633         val_conv.is_owned = ptr_is_owned(val);
44634         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44635         val_conv = ChannelUpdateInfo_clone(&val_conv);
44636         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
44637 }
44638
44639 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
44640         LDKChannelInfo this_ptr_conv;
44641         this_ptr_conv.inner = untag_ptr(this_ptr);
44642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44644         this_ptr_conv.is_owned = false;
44645         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44646         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
44647         uint64_t ret_ref = tag_ptr(ret_copy, true);
44648         return ret_ref;
44649 }
44650
44651 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
44652         LDKChannelInfo this_ptr_conv;
44653         this_ptr_conv.inner = untag_ptr(this_ptr);
44654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44656         this_ptr_conv.is_owned = false;
44657         void* val_ptr = untag_ptr(val);
44658         CHECK_ACCESS(val_ptr);
44659         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44660         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44661         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
44662 }
44663
44664 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
44665         LDKChannelInfo this_ptr_conv;
44666         this_ptr_conv.inner = untag_ptr(this_ptr);
44667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44669         this_ptr_conv.is_owned = false;
44670         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
44671         uint64_t ret_ref = 0;
44672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44674         return ret_ref;
44675 }
44676
44677 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
44678         LDKChannelInfo this_ptr_conv;
44679         this_ptr_conv.inner = untag_ptr(this_ptr);
44680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44682         this_ptr_conv.is_owned = false;
44683         LDKChannelAnnouncement val_conv;
44684         val_conv.inner = untag_ptr(val);
44685         val_conv.is_owned = ptr_is_owned(val);
44686         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44687         val_conv = ChannelAnnouncement_clone(&val_conv);
44688         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
44689 }
44690
44691 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
44692         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
44693         uint64_t ret_ref = 0;
44694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44696         return ret_ref;
44697 }
44698 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
44699         LDKChannelInfo arg_conv;
44700         arg_conv.inner = untag_ptr(arg);
44701         arg_conv.is_owned = ptr_is_owned(arg);
44702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44703         arg_conv.is_owned = false;
44704         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
44705         return ret_conv;
44706 }
44707
44708 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
44709         LDKChannelInfo orig_conv;
44710         orig_conv.inner = untag_ptr(orig);
44711         orig_conv.is_owned = ptr_is_owned(orig);
44712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44713         orig_conv.is_owned = false;
44714         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
44715         uint64_t ret_ref = 0;
44716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44718         return ret_ref;
44719 }
44720
44721 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
44722         LDKChannelInfo a_conv;
44723         a_conv.inner = untag_ptr(a);
44724         a_conv.is_owned = ptr_is_owned(a);
44725         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44726         a_conv.is_owned = false;
44727         LDKChannelInfo b_conv;
44728         b_conv.inner = untag_ptr(b);
44729         b_conv.is_owned = ptr_is_owned(b);
44730         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44731         b_conv.is_owned = false;
44732         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
44733         return ret_conv;
44734 }
44735
44736 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
44737         LDKChannelInfo this_arg_conv;
44738         this_arg_conv.inner = untag_ptr(this_arg);
44739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44741         this_arg_conv.is_owned = false;
44742         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
44743         uint64_t ret_ref = 0;
44744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44746         return ret_ref;
44747 }
44748
44749 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
44750         LDKChannelInfo obj_conv;
44751         obj_conv.inner = untag_ptr(obj);
44752         obj_conv.is_owned = ptr_is_owned(obj);
44753         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44754         obj_conv.is_owned = false;
44755         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
44756         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44757         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44758         CVec_u8Z_free(ret_var);
44759         return ret_arr;
44760 }
44761
44762 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
44763         LDKu8slice ser_ref;
44764         ser_ref.datalen = ser->arr_len;
44765         ser_ref.data = ser->elems;
44766         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
44767         *ret_conv = ChannelInfo_read(ser_ref);
44768         FREE(ser);
44769         return tag_ptr(ret_conv, true);
44770 }
44771
44772 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
44773         LDKDirectedChannelInfo this_obj_conv;
44774         this_obj_conv.inner = untag_ptr(this_obj);
44775         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44777         DirectedChannelInfo_free(this_obj_conv);
44778 }
44779
44780 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
44781         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
44782         uint64_t ret_ref = 0;
44783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44785         return ret_ref;
44786 }
44787 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
44788         LDKDirectedChannelInfo arg_conv;
44789         arg_conv.inner = untag_ptr(arg);
44790         arg_conv.is_owned = ptr_is_owned(arg);
44791         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44792         arg_conv.is_owned = false;
44793         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
44794         return ret_conv;
44795 }
44796
44797 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
44798         LDKDirectedChannelInfo orig_conv;
44799         orig_conv.inner = untag_ptr(orig);
44800         orig_conv.is_owned = ptr_is_owned(orig);
44801         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44802         orig_conv.is_owned = false;
44803         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
44804         uint64_t ret_ref = 0;
44805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44807         return ret_ref;
44808 }
44809
44810 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
44811         LDKDirectedChannelInfo this_arg_conv;
44812         this_arg_conv.inner = untag_ptr(this_arg);
44813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44815         this_arg_conv.is_owned = false;
44816         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
44817         uint64_t ret_ref = 0;
44818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44820         return ret_ref;
44821 }
44822
44823 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
44824         LDKDirectedChannelInfo this_arg_conv;
44825         this_arg_conv.inner = untag_ptr(this_arg);
44826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44828         this_arg_conv.is_owned = false;
44829         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
44830         return ret_conv;
44831 }
44832
44833 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
44834         LDKDirectedChannelInfo this_arg_conv;
44835         this_arg_conv.inner = untag_ptr(this_arg);
44836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44838         this_arg_conv.is_owned = false;
44839         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44840         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
44841         uint64_t ret_ref = tag_ptr(ret_copy, true);
44842         return ret_ref;
44843 }
44844
44845 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
44846         if (!ptr_is_owned(this_ptr)) return;
44847         void* this_ptr_ptr = untag_ptr(this_ptr);
44848         CHECK_ACCESS(this_ptr_ptr);
44849         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
44850         FREE(untag_ptr(this_ptr));
44851         EffectiveCapacity_free(this_ptr_conv);
44852 }
44853
44854 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
44855         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44856         *ret_copy = EffectiveCapacity_clone(arg);
44857         uint64_t ret_ref = tag_ptr(ret_copy, true);
44858         return ret_ref;
44859 }
44860 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
44861         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
44862         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
44863         return ret_conv;
44864 }
44865
44866 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
44867         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
44868         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44869         *ret_copy = EffectiveCapacity_clone(orig_conv);
44870         uint64_t ret_ref = tag_ptr(ret_copy, true);
44871         return ret_ref;
44872 }
44873
44874 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
44875         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44876         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
44877         uint64_t ret_ref = tag_ptr(ret_copy, true);
44878         return ret_ref;
44879 }
44880
44881 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
44882         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44883         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
44884         uint64_t ret_ref = tag_ptr(ret_copy, true);
44885         return ret_ref;
44886 }
44887
44888 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
44889         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44890         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
44891         uint64_t ret_ref = tag_ptr(ret_copy, true);
44892         return ret_ref;
44893 }
44894
44895 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
44896         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44897         *ret_copy = EffectiveCapacity_infinite();
44898         uint64_t ret_ref = tag_ptr(ret_copy, true);
44899         return ret_ref;
44900 }
44901
44902 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
44903         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44904         *ret_copy = EffectiveCapacity_unknown();
44905         uint64_t ret_ref = tag_ptr(ret_copy, true);
44906         return ret_ref;
44907 }
44908
44909 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
44910         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
44911         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
44912         return ret_conv;
44913 }
44914
44915 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
44916         LDKRoutingFees this_obj_conv;
44917         this_obj_conv.inner = untag_ptr(this_obj);
44918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44920         RoutingFees_free(this_obj_conv);
44921 }
44922
44923 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
44924         LDKRoutingFees this_ptr_conv;
44925         this_ptr_conv.inner = untag_ptr(this_ptr);
44926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44928         this_ptr_conv.is_owned = false;
44929         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
44930         return ret_conv;
44931 }
44932
44933 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
44934         LDKRoutingFees this_ptr_conv;
44935         this_ptr_conv.inner = untag_ptr(this_ptr);
44936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44938         this_ptr_conv.is_owned = false;
44939         RoutingFees_set_base_msat(&this_ptr_conv, val);
44940 }
44941
44942 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
44943         LDKRoutingFees this_ptr_conv;
44944         this_ptr_conv.inner = untag_ptr(this_ptr);
44945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44947         this_ptr_conv.is_owned = false;
44948         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
44949         return ret_conv;
44950 }
44951
44952 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
44953         LDKRoutingFees this_ptr_conv;
44954         this_ptr_conv.inner = untag_ptr(this_ptr);
44955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44957         this_ptr_conv.is_owned = false;
44958         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
44959 }
44960
44961 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
44962         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
44963         uint64_t ret_ref = 0;
44964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44966         return ret_ref;
44967 }
44968
44969 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
44970         LDKRoutingFees a_conv;
44971         a_conv.inner = untag_ptr(a);
44972         a_conv.is_owned = ptr_is_owned(a);
44973         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44974         a_conv.is_owned = false;
44975         LDKRoutingFees b_conv;
44976         b_conv.inner = untag_ptr(b);
44977         b_conv.is_owned = ptr_is_owned(b);
44978         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44979         b_conv.is_owned = false;
44980         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
44981         return ret_conv;
44982 }
44983
44984 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
44985         LDKRoutingFees ret_var = RoutingFees_clone(arg);
44986         uint64_t ret_ref = 0;
44987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44989         return ret_ref;
44990 }
44991 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
44992         LDKRoutingFees arg_conv;
44993         arg_conv.inner = untag_ptr(arg);
44994         arg_conv.is_owned = ptr_is_owned(arg);
44995         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44996         arg_conv.is_owned = false;
44997         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
44998         return ret_conv;
44999 }
45000
45001 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
45002         LDKRoutingFees orig_conv;
45003         orig_conv.inner = untag_ptr(orig);
45004         orig_conv.is_owned = ptr_is_owned(orig);
45005         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45006         orig_conv.is_owned = false;
45007         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
45008         uint64_t ret_ref = 0;
45009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45011         return ret_ref;
45012 }
45013
45014 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
45015         LDKRoutingFees o_conv;
45016         o_conv.inner = untag_ptr(o);
45017         o_conv.is_owned = ptr_is_owned(o);
45018         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45019         o_conv.is_owned = false;
45020         int64_t ret_conv = RoutingFees_hash(&o_conv);
45021         return ret_conv;
45022 }
45023
45024 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
45025         LDKRoutingFees obj_conv;
45026         obj_conv.inner = untag_ptr(obj);
45027         obj_conv.is_owned = ptr_is_owned(obj);
45028         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45029         obj_conv.is_owned = false;
45030         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
45031         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45032         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45033         CVec_u8Z_free(ret_var);
45034         return ret_arr;
45035 }
45036
45037 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
45038         LDKu8slice ser_ref;
45039         ser_ref.datalen = ser->arr_len;
45040         ser_ref.data = ser->elems;
45041         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
45042         *ret_conv = RoutingFees_read(ser_ref);
45043         FREE(ser);
45044         return tag_ptr(ret_conv, true);
45045 }
45046
45047 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
45048         LDKNodeAnnouncementInfo this_obj_conv;
45049         this_obj_conv.inner = untag_ptr(this_obj);
45050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45052         NodeAnnouncementInfo_free(this_obj_conv);
45053 }
45054
45055 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
45056         LDKNodeAnnouncementInfo this_ptr_conv;
45057         this_ptr_conv.inner = untag_ptr(this_ptr);
45058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45060         this_ptr_conv.is_owned = false;
45061         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
45062         uint64_t ret_ref = 0;
45063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45065         return ret_ref;
45066 }
45067
45068 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
45069         LDKNodeAnnouncementInfo this_ptr_conv;
45070         this_ptr_conv.inner = untag_ptr(this_ptr);
45071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45073         this_ptr_conv.is_owned = false;
45074         LDKNodeFeatures val_conv;
45075         val_conv.inner = untag_ptr(val);
45076         val_conv.is_owned = ptr_is_owned(val);
45077         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45078         val_conv = NodeFeatures_clone(&val_conv);
45079         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
45080 }
45081
45082 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
45083         LDKNodeAnnouncementInfo this_ptr_conv;
45084         this_ptr_conv.inner = untag_ptr(this_ptr);
45085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45087         this_ptr_conv.is_owned = false;
45088         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
45089         return ret_conv;
45090 }
45091
45092 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t 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         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
45099 }
45100
45101 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
45102         LDKNodeAnnouncementInfo this_ptr_conv;
45103         this_ptr_conv.inner = untag_ptr(this_ptr);
45104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45106         this_ptr_conv.is_owned = false;
45107         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
45108         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
45109         return ret_arr;
45110 }
45111
45112 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
45113         LDKNodeAnnouncementInfo this_ptr_conv;
45114         this_ptr_conv.inner = untag_ptr(this_ptr);
45115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45117         this_ptr_conv.is_owned = false;
45118         LDKThreeBytes val_ref;
45119         CHECK(val->arr_len == 3);
45120         memcpy(val_ref.data, val->elems, 3); FREE(val);
45121         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
45122 }
45123
45124 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
45125         LDKNodeAnnouncementInfo this_ptr_conv;
45126         this_ptr_conv.inner = untag_ptr(this_ptr);
45127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45129         this_ptr_conv.is_owned = false;
45130         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
45131         uint64_t ret_ref = 0;
45132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45134         return ret_ref;
45135 }
45136
45137 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
45138         LDKNodeAnnouncementInfo this_ptr_conv;
45139         this_ptr_conv.inner = untag_ptr(this_ptr);
45140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45142         this_ptr_conv.is_owned = false;
45143         LDKNodeAlias val_conv;
45144         val_conv.inner = untag_ptr(val);
45145         val_conv.is_owned = ptr_is_owned(val);
45146         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45147         val_conv = NodeAlias_clone(&val_conv);
45148         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
45149 }
45150
45151 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
45152         LDKNodeAnnouncementInfo this_ptr_conv;
45153         this_ptr_conv.inner = untag_ptr(this_ptr);
45154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45156         this_ptr_conv.is_owned = false;
45157         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
45158         uint64_t ret_ref = 0;
45159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45161         return ret_ref;
45162 }
45163
45164 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
45165         LDKNodeAnnouncementInfo this_ptr_conv;
45166         this_ptr_conv.inner = untag_ptr(this_ptr);
45167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45169         this_ptr_conv.is_owned = false;
45170         LDKNodeAnnouncement val_conv;
45171         val_conv.inner = untag_ptr(val);
45172         val_conv.is_owned = ptr_is_owned(val);
45173         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45174         val_conv = NodeAnnouncement_clone(&val_conv);
45175         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
45176 }
45177
45178 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) {
45179         LDKNodeFeatures features_arg_conv;
45180         features_arg_conv.inner = untag_ptr(features_arg);
45181         features_arg_conv.is_owned = ptr_is_owned(features_arg);
45182         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45183         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
45184         LDKThreeBytes rgb_arg_ref;
45185         CHECK(rgb_arg->arr_len == 3);
45186         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
45187         LDKNodeAlias alias_arg_conv;
45188         alias_arg_conv.inner = untag_ptr(alias_arg);
45189         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
45190         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
45191         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
45192         LDKNodeAnnouncement announcement_message_arg_conv;
45193         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
45194         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
45195         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
45196         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
45197         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
45198         uint64_t ret_ref = 0;
45199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45201         return ret_ref;
45202 }
45203
45204 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
45205         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
45206         uint64_t ret_ref = 0;
45207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45209         return ret_ref;
45210 }
45211 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
45212         LDKNodeAnnouncementInfo arg_conv;
45213         arg_conv.inner = untag_ptr(arg);
45214         arg_conv.is_owned = ptr_is_owned(arg);
45215         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45216         arg_conv.is_owned = false;
45217         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
45218         return ret_conv;
45219 }
45220
45221 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
45222         LDKNodeAnnouncementInfo orig_conv;
45223         orig_conv.inner = untag_ptr(orig);
45224         orig_conv.is_owned = ptr_is_owned(orig);
45225         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45226         orig_conv.is_owned = false;
45227         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
45228         uint64_t ret_ref = 0;
45229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45231         return ret_ref;
45232 }
45233
45234 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
45235         LDKNodeAnnouncementInfo a_conv;
45236         a_conv.inner = untag_ptr(a);
45237         a_conv.is_owned = ptr_is_owned(a);
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45239         a_conv.is_owned = false;
45240         LDKNodeAnnouncementInfo b_conv;
45241         b_conv.inner = untag_ptr(b);
45242         b_conv.is_owned = ptr_is_owned(b);
45243         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45244         b_conv.is_owned = false;
45245         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
45246         return ret_conv;
45247 }
45248
45249 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
45250         LDKNodeAnnouncementInfo this_arg_conv;
45251         this_arg_conv.inner = untag_ptr(this_arg);
45252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45254         this_arg_conv.is_owned = false;
45255         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
45256         uint64_tArray ret_arr = NULL;
45257         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45258         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45259         for (size_t m = 0; m < ret_var.datalen; m++) {
45260                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45261                 *ret_conv_12_copy = ret_var.data[m];
45262                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
45263                 ret_arr_ptr[m] = ret_conv_12_ref;
45264         }
45265         
45266         FREE(ret_var.data);
45267         return ret_arr;
45268 }
45269
45270 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
45271         LDKNodeAnnouncementInfo obj_conv;
45272         obj_conv.inner = untag_ptr(obj);
45273         obj_conv.is_owned = ptr_is_owned(obj);
45274         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45275         obj_conv.is_owned = false;
45276         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
45277         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45278         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45279         CVec_u8Z_free(ret_var);
45280         return ret_arr;
45281 }
45282
45283 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
45284         LDKu8slice ser_ref;
45285         ser_ref.datalen = ser->arr_len;
45286         ser_ref.data = ser->elems;
45287         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
45288         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
45289         FREE(ser);
45290         return tag_ptr(ret_conv, true);
45291 }
45292
45293 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
45294         LDKNodeAlias this_obj_conv;
45295         this_obj_conv.inner = untag_ptr(this_obj);
45296         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45298         NodeAlias_free(this_obj_conv);
45299 }
45300
45301 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
45302         LDKNodeAlias this_ptr_conv;
45303         this_ptr_conv.inner = untag_ptr(this_ptr);
45304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45306         this_ptr_conv.is_owned = false;
45307         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45308         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
45309         return ret_arr;
45310 }
45311
45312 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
45313         LDKNodeAlias this_ptr_conv;
45314         this_ptr_conv.inner = untag_ptr(this_ptr);
45315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45317         this_ptr_conv.is_owned = false;
45318         LDKThirtyTwoBytes val_ref;
45319         CHECK(val->arr_len == 32);
45320         memcpy(val_ref.data, val->elems, 32); FREE(val);
45321         NodeAlias_set_a(&this_ptr_conv, val_ref);
45322 }
45323
45324 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
45325         LDKThirtyTwoBytes a_arg_ref;
45326         CHECK(a_arg->arr_len == 32);
45327         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
45328         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
45329         uint64_t ret_ref = 0;
45330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45332         return ret_ref;
45333 }
45334
45335 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
45336         LDKNodeAlias ret_var = NodeAlias_clone(arg);
45337         uint64_t ret_ref = 0;
45338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45340         return ret_ref;
45341 }
45342 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
45343         LDKNodeAlias arg_conv;
45344         arg_conv.inner = untag_ptr(arg);
45345         arg_conv.is_owned = ptr_is_owned(arg);
45346         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45347         arg_conv.is_owned = false;
45348         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
45349         return ret_conv;
45350 }
45351
45352 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
45353         LDKNodeAlias orig_conv;
45354         orig_conv.inner = untag_ptr(orig);
45355         orig_conv.is_owned = ptr_is_owned(orig);
45356         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45357         orig_conv.is_owned = false;
45358         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
45359         uint64_t ret_ref = 0;
45360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45362         return ret_ref;
45363 }
45364
45365 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
45366         LDKNodeAlias a_conv;
45367         a_conv.inner = untag_ptr(a);
45368         a_conv.is_owned = ptr_is_owned(a);
45369         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45370         a_conv.is_owned = false;
45371         LDKNodeAlias b_conv;
45372         b_conv.inner = untag_ptr(b);
45373         b_conv.is_owned = ptr_is_owned(b);
45374         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45375         b_conv.is_owned = false;
45376         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
45377         return ret_conv;
45378 }
45379
45380 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
45381         LDKNodeAlias obj_conv;
45382         obj_conv.inner = untag_ptr(obj);
45383         obj_conv.is_owned = ptr_is_owned(obj);
45384         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45385         obj_conv.is_owned = false;
45386         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
45387         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45388         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45389         CVec_u8Z_free(ret_var);
45390         return ret_arr;
45391 }
45392
45393 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
45394         LDKu8slice ser_ref;
45395         ser_ref.datalen = ser->arr_len;
45396         ser_ref.data = ser->elems;
45397         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
45398         *ret_conv = NodeAlias_read(ser_ref);
45399         FREE(ser);
45400         return tag_ptr(ret_conv, true);
45401 }
45402
45403 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
45404         LDKNodeInfo this_obj_conv;
45405         this_obj_conv.inner = untag_ptr(this_obj);
45406         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45408         NodeInfo_free(this_obj_conv);
45409 }
45410
45411 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
45412         LDKNodeInfo this_ptr_conv;
45413         this_ptr_conv.inner = untag_ptr(this_ptr);
45414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45416         this_ptr_conv.is_owned = false;
45417         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
45418         int64_tArray ret_arr = NULL;
45419         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45420         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45421         for (size_t i = 0; i < ret_var.datalen; i++) {
45422                 int64_t ret_conv_8_conv = ret_var.data[i];
45423                 ret_arr_ptr[i] = ret_conv_8_conv;
45424         }
45425         
45426         FREE(ret_var.data);
45427         return ret_arr;
45428 }
45429
45430 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
45431         LDKNodeInfo this_ptr_conv;
45432         this_ptr_conv.inner = untag_ptr(this_ptr);
45433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45435         this_ptr_conv.is_owned = false;
45436         LDKCVec_u64Z val_constr;
45437         val_constr.datalen = val->arr_len;
45438         if (val_constr.datalen > 0)
45439                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45440         else
45441                 val_constr.data = NULL;
45442         int64_t* val_vals = val->elems;
45443         for (size_t i = 0; i < val_constr.datalen; i++) {
45444                 int64_t val_conv_8 = val_vals[i];
45445                 val_constr.data[i] = val_conv_8;
45446         }
45447         FREE(val);
45448         NodeInfo_set_channels(&this_ptr_conv, val_constr);
45449 }
45450
45451 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
45452         LDKNodeInfo this_ptr_conv;
45453         this_ptr_conv.inner = untag_ptr(this_ptr);
45454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45456         this_ptr_conv.is_owned = false;
45457         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
45458         uint64_t ret_ref = 0;
45459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45461         return ret_ref;
45462 }
45463
45464 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
45465         LDKNodeInfo this_ptr_conv;
45466         this_ptr_conv.inner = untag_ptr(this_ptr);
45467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45469         this_ptr_conv.is_owned = false;
45470         LDKNodeAnnouncementInfo val_conv;
45471         val_conv.inner = untag_ptr(val);
45472         val_conv.is_owned = ptr_is_owned(val);
45473         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45474         val_conv = NodeAnnouncementInfo_clone(&val_conv);
45475         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
45476 }
45477
45478 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
45479         LDKCVec_u64Z channels_arg_constr;
45480         channels_arg_constr.datalen = channels_arg->arr_len;
45481         if (channels_arg_constr.datalen > 0)
45482                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45483         else
45484                 channels_arg_constr.data = NULL;
45485         int64_t* channels_arg_vals = channels_arg->elems;
45486         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
45487                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
45488                 channels_arg_constr.data[i] = channels_arg_conv_8;
45489         }
45490         FREE(channels_arg);
45491         LDKNodeAnnouncementInfo announcement_info_arg_conv;
45492         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
45493         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
45494         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
45495         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
45496         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
45497         uint64_t ret_ref = 0;
45498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45500         return ret_ref;
45501 }
45502
45503 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
45504         LDKNodeInfo ret_var = NodeInfo_clone(arg);
45505         uint64_t ret_ref = 0;
45506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45508         return ret_ref;
45509 }
45510 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
45511         LDKNodeInfo arg_conv;
45512         arg_conv.inner = untag_ptr(arg);
45513         arg_conv.is_owned = ptr_is_owned(arg);
45514         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45515         arg_conv.is_owned = false;
45516         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
45517         return ret_conv;
45518 }
45519
45520 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
45521         LDKNodeInfo orig_conv;
45522         orig_conv.inner = untag_ptr(orig);
45523         orig_conv.is_owned = ptr_is_owned(orig);
45524         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45525         orig_conv.is_owned = false;
45526         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
45527         uint64_t ret_ref = 0;
45528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45530         return ret_ref;
45531 }
45532
45533 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
45534         LDKNodeInfo a_conv;
45535         a_conv.inner = untag_ptr(a);
45536         a_conv.is_owned = ptr_is_owned(a);
45537         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45538         a_conv.is_owned = false;
45539         LDKNodeInfo b_conv;
45540         b_conv.inner = untag_ptr(b);
45541         b_conv.is_owned = ptr_is_owned(b);
45542         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45543         b_conv.is_owned = false;
45544         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
45545         return ret_conv;
45546 }
45547
45548 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
45549         LDKNodeInfo obj_conv;
45550         obj_conv.inner = untag_ptr(obj);
45551         obj_conv.is_owned = ptr_is_owned(obj);
45552         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45553         obj_conv.is_owned = false;
45554         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
45555         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45556         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45557         CVec_u8Z_free(ret_var);
45558         return ret_arr;
45559 }
45560
45561 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
45562         LDKu8slice ser_ref;
45563         ser_ref.datalen = ser->arr_len;
45564         ser_ref.data = ser->elems;
45565         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
45566         *ret_conv = NodeInfo_read(ser_ref);
45567         FREE(ser);
45568         return tag_ptr(ret_conv, true);
45569 }
45570
45571 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
45572         LDKNetworkGraph obj_conv;
45573         obj_conv.inner = untag_ptr(obj);
45574         obj_conv.is_owned = ptr_is_owned(obj);
45575         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45576         obj_conv.is_owned = false;
45577         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
45578         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45579         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45580         CVec_u8Z_free(ret_var);
45581         return ret_arr;
45582 }
45583
45584 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
45585         LDKu8slice ser_ref;
45586         ser_ref.datalen = ser->arr_len;
45587         ser_ref.data = ser->elems;
45588         void* arg_ptr = untag_ptr(arg);
45589         CHECK_ACCESS(arg_ptr);
45590         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
45591         if (arg_conv.free == LDKLogger_JCalls_free) {
45592                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45593                 LDKLogger_JCalls_cloned(&arg_conv);
45594         }
45595         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
45596         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
45597         FREE(ser);
45598         return tag_ptr(ret_conv, true);
45599 }
45600
45601 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
45602         LDKNetwork network_conv = LDKNetwork_from_js(network);
45603         void* logger_ptr = untag_ptr(logger);
45604         CHECK_ACCESS(logger_ptr);
45605         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45606         if (logger_conv.free == LDKLogger_JCalls_free) {
45607                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45608                 LDKLogger_JCalls_cloned(&logger_conv);
45609         }
45610         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
45611         uint64_t ret_ref = 0;
45612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45614         return ret_ref;
45615 }
45616
45617 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
45618         LDKNetworkGraph this_arg_conv;
45619         this_arg_conv.inner = untag_ptr(this_arg);
45620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45622         this_arg_conv.is_owned = false;
45623         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
45624         uint64_t ret_ref = 0;
45625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45627         return ret_ref;
45628 }
45629
45630 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) {
45631         LDKNetworkGraph this_arg_conv;
45632         this_arg_conv.inner = untag_ptr(this_arg);
45633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45635         this_arg_conv.is_owned = false;
45636         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45637         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
45638         uint64_t ret_ref = tag_ptr(ret_copy, true);
45639         return ret_ref;
45640 }
45641
45642 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) {
45643         LDKNetworkGraph this_arg_conv;
45644         this_arg_conv.inner = untag_ptr(this_arg);
45645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45647         this_arg_conv.is_owned = false;
45648         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
45649 }
45650
45651 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
45652         LDKNetworkGraph this_arg_conv;
45653         this_arg_conv.inner = untag_ptr(this_arg);
45654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45656         this_arg_conv.is_owned = false;
45657         LDKNodeAnnouncement msg_conv;
45658         msg_conv.inner = untag_ptr(msg);
45659         msg_conv.is_owned = ptr_is_owned(msg);
45660         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45661         msg_conv.is_owned = false;
45662         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45663         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
45664         return tag_ptr(ret_conv, true);
45665 }
45666
45667 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) {
45668         LDKNetworkGraph this_arg_conv;
45669         this_arg_conv.inner = untag_ptr(this_arg);
45670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45672         this_arg_conv.is_owned = false;
45673         LDKUnsignedNodeAnnouncement msg_conv;
45674         msg_conv.inner = untag_ptr(msg);
45675         msg_conv.is_owned = ptr_is_owned(msg);
45676         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45677         msg_conv.is_owned = false;
45678         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45679         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
45680         return tag_ptr(ret_conv, true);
45681 }
45682
45683 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) {
45684         LDKNetworkGraph this_arg_conv;
45685         this_arg_conv.inner = untag_ptr(this_arg);
45686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45688         this_arg_conv.is_owned = false;
45689         LDKChannelAnnouncement msg_conv;
45690         msg_conv.inner = untag_ptr(msg);
45691         msg_conv.is_owned = ptr_is_owned(msg);
45692         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45693         msg_conv.is_owned = false;
45694         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
45695         CHECK_ACCESS(utxo_lookup_ptr);
45696         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
45697         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
45698         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
45699                 // Manually implement clone for Java trait instances
45700                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
45701                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45702                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
45703                 }
45704         }
45705         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45706         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
45707         return tag_ptr(ret_conv, true);
45708 }
45709
45710 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) {
45711         LDKNetworkGraph this_arg_conv;
45712         this_arg_conv.inner = untag_ptr(this_arg);
45713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45715         this_arg_conv.is_owned = false;
45716         LDKUnsignedChannelAnnouncement msg_conv;
45717         msg_conv.inner = untag_ptr(msg);
45718         msg_conv.is_owned = ptr_is_owned(msg);
45719         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45720         msg_conv.is_owned = false;
45721         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
45722         CHECK_ACCESS(utxo_lookup_ptr);
45723         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
45724         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
45725         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
45726                 // Manually implement clone for Java trait instances
45727                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
45728                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45729                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
45730                 }
45731         }
45732         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45733         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
45734         return tag_ptr(ret_conv, true);
45735 }
45736
45737 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) {
45738         LDKNetworkGraph this_arg_conv;
45739         this_arg_conv.inner = untag_ptr(this_arg);
45740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45742         this_arg_conv.is_owned = false;
45743         LDKChannelFeatures features_conv;
45744         features_conv.inner = untag_ptr(features);
45745         features_conv.is_owned = ptr_is_owned(features);
45746         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
45747         features_conv = ChannelFeatures_clone(&features_conv);
45748         LDKPublicKey node_id_1_ref;
45749         CHECK(node_id_1->arr_len == 33);
45750         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
45751         LDKPublicKey node_id_2_ref;
45752         CHECK(node_id_2->arr_len == 33);
45753         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
45754         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45755         *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);
45756         return tag_ptr(ret_conv, true);
45757 }
45758
45759 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
45760         LDKNetworkGraph this_arg_conv;
45761         this_arg_conv.inner = untag_ptr(this_arg);
45762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45764         this_arg_conv.is_owned = false;
45765         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
45766 }
45767
45768 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
45769         LDKNetworkGraph this_arg_conv;
45770         this_arg_conv.inner = untag_ptr(this_arg);
45771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45773         this_arg_conv.is_owned = false;
45774         LDKPublicKey node_id_ref;
45775         CHECK(node_id->arr_len == 33);
45776         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
45777         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
45778 }
45779
45780 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) {
45781         LDKNetworkGraph this_arg_conv;
45782         this_arg_conv.inner = untag_ptr(this_arg);
45783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45785         this_arg_conv.is_owned = false;
45786         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
45787 }
45788
45789 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
45790         LDKNetworkGraph this_arg_conv;
45791         this_arg_conv.inner = untag_ptr(this_arg);
45792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45794         this_arg_conv.is_owned = false;
45795         LDKChannelUpdate msg_conv;
45796         msg_conv.inner = untag_ptr(msg);
45797         msg_conv.is_owned = ptr_is_owned(msg);
45798         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45799         msg_conv.is_owned = false;
45800         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45801         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
45802         return tag_ptr(ret_conv, true);
45803 }
45804
45805 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
45806         LDKNetworkGraph this_arg_conv;
45807         this_arg_conv.inner = untag_ptr(this_arg);
45808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45810         this_arg_conv.is_owned = false;
45811         LDKUnsignedChannelUpdate msg_conv;
45812         msg_conv.inner = untag_ptr(msg);
45813         msg_conv.is_owned = ptr_is_owned(msg);
45814         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45815         msg_conv.is_owned = false;
45816         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45817         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
45818         return tag_ptr(ret_conv, true);
45819 }
45820
45821 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
45822         LDKReadOnlyNetworkGraph this_arg_conv;
45823         this_arg_conv.inner = untag_ptr(this_arg);
45824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45826         this_arg_conv.is_owned = false;
45827         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
45828         uint64_t ret_ref = 0;
45829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45831         return ret_ref;
45832 }
45833
45834 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
45835         LDKReadOnlyNetworkGraph this_arg_conv;
45836         this_arg_conv.inner = untag_ptr(this_arg);
45837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45839         this_arg_conv.is_owned = false;
45840         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
45841         int64_tArray ret_arr = NULL;
45842         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45843         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45844         for (size_t i = 0; i < ret_var.datalen; i++) {
45845                 int64_t ret_conv_8_conv = ret_var.data[i];
45846                 ret_arr_ptr[i] = ret_conv_8_conv;
45847         }
45848         
45849         FREE(ret_var.data);
45850         return ret_arr;
45851 }
45852
45853 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
45854         LDKReadOnlyNetworkGraph this_arg_conv;
45855         this_arg_conv.inner = untag_ptr(this_arg);
45856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45858         this_arg_conv.is_owned = false;
45859         LDKNodeId node_id_conv;
45860         node_id_conv.inner = untag_ptr(node_id);
45861         node_id_conv.is_owned = ptr_is_owned(node_id);
45862         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45863         node_id_conv.is_owned = false;
45864         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
45865         uint64_t ret_ref = 0;
45866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45868         return ret_ref;
45869 }
45870
45871 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
45872         LDKReadOnlyNetworkGraph this_arg_conv;
45873         this_arg_conv.inner = untag_ptr(this_arg);
45874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45876         this_arg_conv.is_owned = false;
45877         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
45878         uint64_tArray ret_arr = NULL;
45879         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45880         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45881         for (size_t i = 0; i < ret_var.datalen; i++) {
45882                 LDKNodeId ret_conv_8_var = ret_var.data[i];
45883                 uint64_t ret_conv_8_ref = 0;
45884                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
45885                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
45886                 ret_arr_ptr[i] = ret_conv_8_ref;
45887         }
45888         
45889         FREE(ret_var.data);
45890         return ret_arr;
45891 }
45892
45893 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
45894         LDKReadOnlyNetworkGraph this_arg_conv;
45895         this_arg_conv.inner = untag_ptr(this_arg);
45896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45898         this_arg_conv.is_owned = false;
45899         LDKPublicKey pubkey_ref;
45900         CHECK(pubkey->arr_len == 33);
45901         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
45902         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
45903         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
45904         uint64_t ret_ref = tag_ptr(ret_copy, true);
45905         return ret_ref;
45906 }
45907
45908 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
45909         LDKDefaultRouter this_obj_conv;
45910         this_obj_conv.inner = untag_ptr(this_obj);
45911         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45913         DefaultRouter_free(this_obj_conv);
45914 }
45915
45916 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) {
45917         LDKNetworkGraph network_graph_conv;
45918         network_graph_conv.inner = untag_ptr(network_graph);
45919         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45920         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45921         network_graph_conv.is_owned = false;
45922         void* logger_ptr = untag_ptr(logger);
45923         CHECK_ACCESS(logger_ptr);
45924         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45925         if (logger_conv.free == LDKLogger_JCalls_free) {
45926                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45927                 LDKLogger_JCalls_cloned(&logger_conv);
45928         }
45929         LDKThirtyTwoBytes random_seed_bytes_ref;
45930         CHECK(random_seed_bytes->arr_len == 32);
45931         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
45932         void* scorer_ptr = untag_ptr(scorer);
45933         CHECK_ACCESS(scorer_ptr);
45934         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
45935         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
45936                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45937                 LDKLockableScore_JCalls_cloned(&scorer_conv);
45938         }
45939         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
45940         uint64_t ret_ref = 0;
45941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45943         return ret_ref;
45944 }
45945
45946 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
45947         LDKDefaultRouter this_arg_conv;
45948         this_arg_conv.inner = untag_ptr(this_arg);
45949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45951         this_arg_conv.is_owned = false;
45952         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
45953         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
45954         return tag_ptr(ret_ret, true);
45955 }
45956
45957 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
45958         if (!ptr_is_owned(this_ptr)) return;
45959         void* this_ptr_ptr = untag_ptr(this_ptr);
45960         CHECK_ACCESS(this_ptr_ptr);
45961         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
45962         FREE(untag_ptr(this_ptr));
45963         Router_free(this_ptr_conv);
45964 }
45965
45966 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
45967         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
45968         this_obj_conv.inner = untag_ptr(this_obj);
45969         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45971         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
45972 }
45973
45974 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
45975         void* scorer_ptr = untag_ptr(scorer);
45976         CHECK_ACCESS(scorer_ptr);
45977         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
45978         if (scorer_conv.free == LDKScore_JCalls_free) {
45979                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45980                 LDKScore_JCalls_cloned(&scorer_conv);
45981         }
45982         LDKInFlightHtlcs inflight_htlcs_conv;
45983         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
45984         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
45985         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
45986         inflight_htlcs_conv.is_owned = false;
45987         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
45988         uint64_t ret_ref = 0;
45989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45991         return ret_ref;
45992 }
45993
45994 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
45995         LDKScorerAccountingForInFlightHtlcs obj_conv;
45996         obj_conv.inner = untag_ptr(obj);
45997         obj_conv.is_owned = ptr_is_owned(obj);
45998         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45999         obj_conv.is_owned = false;
46000         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
46001         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46002         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46003         CVec_u8Z_free(ret_var);
46004         return ret_arr;
46005 }
46006
46007 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
46008         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
46009         this_arg_conv.inner = untag_ptr(this_arg);
46010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46012         this_arg_conv.is_owned = false;
46013         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
46014         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
46015         return tag_ptr(ret_ret, true);
46016 }
46017
46018 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
46019         LDKInFlightHtlcs this_obj_conv;
46020         this_obj_conv.inner = untag_ptr(this_obj);
46021         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46023         InFlightHtlcs_free(this_obj_conv);
46024 }
46025
46026 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
46027         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
46028         uint64_t ret_ref = 0;
46029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46031         return ret_ref;
46032 }
46033 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
46034         LDKInFlightHtlcs arg_conv;
46035         arg_conv.inner = untag_ptr(arg);
46036         arg_conv.is_owned = ptr_is_owned(arg);
46037         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46038         arg_conv.is_owned = false;
46039         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
46040         return ret_conv;
46041 }
46042
46043 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
46044         LDKInFlightHtlcs orig_conv;
46045         orig_conv.inner = untag_ptr(orig);
46046         orig_conv.is_owned = ptr_is_owned(orig);
46047         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46048         orig_conv.is_owned = false;
46049         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
46050         uint64_t ret_ref = 0;
46051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46053         return ret_ref;
46054 }
46055
46056 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
46057         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
46058         uint64_t ret_ref = 0;
46059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46061         return ret_ref;
46062 }
46063
46064 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
46065         LDKInFlightHtlcs this_arg_conv;
46066         this_arg_conv.inner = untag_ptr(this_arg);
46067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46069         this_arg_conv.is_owned = false;
46070         LDKPath path_conv;
46071         path_conv.inner = untag_ptr(path);
46072         path_conv.is_owned = ptr_is_owned(path);
46073         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
46074         path_conv.is_owned = false;
46075         LDKPublicKey payer_node_id_ref;
46076         CHECK(payer_node_id->arr_len == 33);
46077         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
46078         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
46079 }
46080
46081 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) {
46082         LDKInFlightHtlcs this_arg_conv;
46083         this_arg_conv.inner = untag_ptr(this_arg);
46084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46086         this_arg_conv.is_owned = false;
46087         LDKNodeId source_conv;
46088         source_conv.inner = untag_ptr(source);
46089         source_conv.is_owned = ptr_is_owned(source);
46090         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
46091         source_conv.is_owned = false;
46092         LDKNodeId target_conv;
46093         target_conv.inner = untag_ptr(target);
46094         target_conv.is_owned = ptr_is_owned(target);
46095         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
46096         target_conv.is_owned = false;
46097         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46098         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
46099         uint64_t ret_ref = tag_ptr(ret_copy, true);
46100         return ret_ref;
46101 }
46102
46103 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
46104         LDKInFlightHtlcs obj_conv;
46105         obj_conv.inner = untag_ptr(obj);
46106         obj_conv.is_owned = ptr_is_owned(obj);
46107         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46108         obj_conv.is_owned = false;
46109         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
46110         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46111         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46112         CVec_u8Z_free(ret_var);
46113         return ret_arr;
46114 }
46115
46116 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
46117         LDKu8slice ser_ref;
46118         ser_ref.datalen = ser->arr_len;
46119         ser_ref.data = ser->elems;
46120         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
46121         *ret_conv = InFlightHtlcs_read(ser_ref);
46122         FREE(ser);
46123         return tag_ptr(ret_conv, true);
46124 }
46125
46126 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
46127         LDKRouteHop this_obj_conv;
46128         this_obj_conv.inner = untag_ptr(this_obj);
46129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46131         RouteHop_free(this_obj_conv);
46132 }
46133
46134 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
46135         LDKRouteHop this_ptr_conv;
46136         this_ptr_conv.inner = untag_ptr(this_ptr);
46137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46139         this_ptr_conv.is_owned = false;
46140         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46141         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
46142         return ret_arr;
46143 }
46144
46145 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
46146         LDKRouteHop this_ptr_conv;
46147         this_ptr_conv.inner = untag_ptr(this_ptr);
46148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46150         this_ptr_conv.is_owned = false;
46151         LDKPublicKey val_ref;
46152         CHECK(val->arr_len == 33);
46153         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46154         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
46155 }
46156
46157 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
46158         LDKRouteHop this_ptr_conv;
46159         this_ptr_conv.inner = untag_ptr(this_ptr);
46160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46162         this_ptr_conv.is_owned = false;
46163         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
46164         uint64_t ret_ref = 0;
46165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46167         return ret_ref;
46168 }
46169
46170 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
46171         LDKRouteHop this_ptr_conv;
46172         this_ptr_conv.inner = untag_ptr(this_ptr);
46173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46175         this_ptr_conv.is_owned = false;
46176         LDKNodeFeatures val_conv;
46177         val_conv.inner = untag_ptr(val);
46178         val_conv.is_owned = ptr_is_owned(val);
46179         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46180         val_conv = NodeFeatures_clone(&val_conv);
46181         RouteHop_set_node_features(&this_ptr_conv, val_conv);
46182 }
46183
46184 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
46185         LDKRouteHop this_ptr_conv;
46186         this_ptr_conv.inner = untag_ptr(this_ptr);
46187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46189         this_ptr_conv.is_owned = false;
46190         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
46191         return ret_conv;
46192 }
46193
46194 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
46195         LDKRouteHop this_ptr_conv;
46196         this_ptr_conv.inner = untag_ptr(this_ptr);
46197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46199         this_ptr_conv.is_owned = false;
46200         RouteHop_set_short_channel_id(&this_ptr_conv, val);
46201 }
46202
46203 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
46204         LDKRouteHop this_ptr_conv;
46205         this_ptr_conv.inner = untag_ptr(this_ptr);
46206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46208         this_ptr_conv.is_owned = false;
46209         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
46210         uint64_t ret_ref = 0;
46211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46213         return ret_ref;
46214 }
46215
46216 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
46217         LDKRouteHop this_ptr_conv;
46218         this_ptr_conv.inner = untag_ptr(this_ptr);
46219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46221         this_ptr_conv.is_owned = false;
46222         LDKChannelFeatures val_conv;
46223         val_conv.inner = untag_ptr(val);
46224         val_conv.is_owned = ptr_is_owned(val);
46225         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46226         val_conv = ChannelFeatures_clone(&val_conv);
46227         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
46228 }
46229
46230 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
46231         LDKRouteHop this_ptr_conv;
46232         this_ptr_conv.inner = untag_ptr(this_ptr);
46233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46235         this_ptr_conv.is_owned = false;
46236         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
46237         return ret_conv;
46238 }
46239
46240 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
46241         LDKRouteHop this_ptr_conv;
46242         this_ptr_conv.inner = untag_ptr(this_ptr);
46243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46245         this_ptr_conv.is_owned = false;
46246         RouteHop_set_fee_msat(&this_ptr_conv, val);
46247 }
46248
46249 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
46250         LDKRouteHop this_ptr_conv;
46251         this_ptr_conv.inner = untag_ptr(this_ptr);
46252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46254         this_ptr_conv.is_owned = false;
46255         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
46256         return ret_conv;
46257 }
46258
46259 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
46260         LDKRouteHop this_ptr_conv;
46261         this_ptr_conv.inner = untag_ptr(this_ptr);
46262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46264         this_ptr_conv.is_owned = false;
46265         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
46266 }
46267
46268 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) {
46269         LDKPublicKey pubkey_arg_ref;
46270         CHECK(pubkey_arg->arr_len == 33);
46271         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
46272         LDKNodeFeatures node_features_arg_conv;
46273         node_features_arg_conv.inner = untag_ptr(node_features_arg);
46274         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
46275         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
46276         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
46277         LDKChannelFeatures channel_features_arg_conv;
46278         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
46279         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
46280         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
46281         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
46282         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);
46283         uint64_t ret_ref = 0;
46284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46286         return ret_ref;
46287 }
46288
46289 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
46290         LDKRouteHop ret_var = RouteHop_clone(arg);
46291         uint64_t ret_ref = 0;
46292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46294         return ret_ref;
46295 }
46296 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
46297         LDKRouteHop arg_conv;
46298         arg_conv.inner = untag_ptr(arg);
46299         arg_conv.is_owned = ptr_is_owned(arg);
46300         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46301         arg_conv.is_owned = false;
46302         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
46303         return ret_conv;
46304 }
46305
46306 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
46307         LDKRouteHop orig_conv;
46308         orig_conv.inner = untag_ptr(orig);
46309         orig_conv.is_owned = ptr_is_owned(orig);
46310         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46311         orig_conv.is_owned = false;
46312         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
46313         uint64_t ret_ref = 0;
46314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46316         return ret_ref;
46317 }
46318
46319 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
46320         LDKRouteHop o_conv;
46321         o_conv.inner = untag_ptr(o);
46322         o_conv.is_owned = ptr_is_owned(o);
46323         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46324         o_conv.is_owned = false;
46325         int64_t ret_conv = RouteHop_hash(&o_conv);
46326         return ret_conv;
46327 }
46328
46329 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
46330         LDKRouteHop a_conv;
46331         a_conv.inner = untag_ptr(a);
46332         a_conv.is_owned = ptr_is_owned(a);
46333         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46334         a_conv.is_owned = false;
46335         LDKRouteHop b_conv;
46336         b_conv.inner = untag_ptr(b);
46337         b_conv.is_owned = ptr_is_owned(b);
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46339         b_conv.is_owned = false;
46340         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
46341         return ret_conv;
46342 }
46343
46344 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
46345         LDKRouteHop obj_conv;
46346         obj_conv.inner = untag_ptr(obj);
46347         obj_conv.is_owned = ptr_is_owned(obj);
46348         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46349         obj_conv.is_owned = false;
46350         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
46351         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46352         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46353         CVec_u8Z_free(ret_var);
46354         return ret_arr;
46355 }
46356
46357 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
46358         LDKu8slice ser_ref;
46359         ser_ref.datalen = ser->arr_len;
46360         ser_ref.data = ser->elems;
46361         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
46362         *ret_conv = RouteHop_read(ser_ref);
46363         FREE(ser);
46364         return tag_ptr(ret_conv, true);
46365 }
46366
46367 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
46368         LDKBlindedTail this_obj_conv;
46369         this_obj_conv.inner = untag_ptr(this_obj);
46370         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46372         BlindedTail_free(this_obj_conv);
46373 }
46374
46375 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
46376         LDKBlindedTail this_ptr_conv;
46377         this_ptr_conv.inner = untag_ptr(this_ptr);
46378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46380         this_ptr_conv.is_owned = false;
46381         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
46382         uint64_tArray ret_arr = NULL;
46383         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46384         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46385         for (size_t m = 0; m < ret_var.datalen; m++) {
46386                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
46387                 uint64_t ret_conv_12_ref = 0;
46388                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
46389                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
46390                 ret_arr_ptr[m] = ret_conv_12_ref;
46391         }
46392         
46393         FREE(ret_var.data);
46394         return ret_arr;
46395 }
46396
46397 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
46398         LDKBlindedTail this_ptr_conv;
46399         this_ptr_conv.inner = untag_ptr(this_ptr);
46400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46402         this_ptr_conv.is_owned = false;
46403         LDKCVec_BlindedHopZ val_constr;
46404         val_constr.datalen = val->arr_len;
46405         if (val_constr.datalen > 0)
46406                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
46407         else
46408                 val_constr.data = NULL;
46409         uint64_t* val_vals = val->elems;
46410         for (size_t m = 0; m < val_constr.datalen; m++) {
46411                 uint64_t val_conv_12 = val_vals[m];
46412                 LDKBlindedHop val_conv_12_conv;
46413                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
46414                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
46415                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
46416                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
46417                 val_constr.data[m] = val_conv_12_conv;
46418         }
46419         FREE(val);
46420         BlindedTail_set_hops(&this_ptr_conv, val_constr);
46421 }
46422
46423 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
46424         LDKBlindedTail this_ptr_conv;
46425         this_ptr_conv.inner = untag_ptr(this_ptr);
46426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46428         this_ptr_conv.is_owned = false;
46429         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46430         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46431         return ret_arr;
46432 }
46433
46434 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
46435         LDKBlindedTail this_ptr_conv;
46436         this_ptr_conv.inner = untag_ptr(this_ptr);
46437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46439         this_ptr_conv.is_owned = false;
46440         LDKPublicKey val_ref;
46441         CHECK(val->arr_len == 33);
46442         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46443         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
46444 }
46445
46446 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) {
46447         LDKBlindedTail this_ptr_conv;
46448         this_ptr_conv.inner = untag_ptr(this_ptr);
46449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46451         this_ptr_conv.is_owned = false;
46452         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
46453         return ret_conv;
46454 }
46455
46456 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) {
46457         LDKBlindedTail this_ptr_conv;
46458         this_ptr_conv.inner = untag_ptr(this_ptr);
46459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46461         this_ptr_conv.is_owned = false;
46462         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
46463 }
46464
46465 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
46466         LDKBlindedTail this_ptr_conv;
46467         this_ptr_conv.inner = untag_ptr(this_ptr);
46468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46470         this_ptr_conv.is_owned = false;
46471         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
46472         return ret_conv;
46473 }
46474
46475 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
46476         LDKBlindedTail this_ptr_conv;
46477         this_ptr_conv.inner = untag_ptr(this_ptr);
46478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46480         this_ptr_conv.is_owned = false;
46481         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
46482 }
46483
46484 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) {
46485         LDKCVec_BlindedHopZ hops_arg_constr;
46486         hops_arg_constr.datalen = hops_arg->arr_len;
46487         if (hops_arg_constr.datalen > 0)
46488                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
46489         else
46490                 hops_arg_constr.data = NULL;
46491         uint64_t* hops_arg_vals = hops_arg->elems;
46492         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
46493                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
46494                 LDKBlindedHop hops_arg_conv_12_conv;
46495                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
46496                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
46497                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
46498                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
46499                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
46500         }
46501         FREE(hops_arg);
46502         LDKPublicKey blinding_point_arg_ref;
46503         CHECK(blinding_point_arg->arr_len == 33);
46504         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46505         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
46506         uint64_t ret_ref = 0;
46507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46509         return ret_ref;
46510 }
46511
46512 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
46513         LDKBlindedTail ret_var = BlindedTail_clone(arg);
46514         uint64_t ret_ref = 0;
46515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46517         return ret_ref;
46518 }
46519 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
46520         LDKBlindedTail arg_conv;
46521         arg_conv.inner = untag_ptr(arg);
46522         arg_conv.is_owned = ptr_is_owned(arg);
46523         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46524         arg_conv.is_owned = false;
46525         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
46526         return ret_conv;
46527 }
46528
46529 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
46530         LDKBlindedTail orig_conv;
46531         orig_conv.inner = untag_ptr(orig);
46532         orig_conv.is_owned = ptr_is_owned(orig);
46533         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46534         orig_conv.is_owned = false;
46535         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
46536         uint64_t ret_ref = 0;
46537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46539         return ret_ref;
46540 }
46541
46542 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
46543         LDKBlindedTail o_conv;
46544         o_conv.inner = untag_ptr(o);
46545         o_conv.is_owned = ptr_is_owned(o);
46546         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46547         o_conv.is_owned = false;
46548         int64_t ret_conv = BlindedTail_hash(&o_conv);
46549         return ret_conv;
46550 }
46551
46552 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
46553         LDKBlindedTail a_conv;
46554         a_conv.inner = untag_ptr(a);
46555         a_conv.is_owned = ptr_is_owned(a);
46556         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46557         a_conv.is_owned = false;
46558         LDKBlindedTail b_conv;
46559         b_conv.inner = untag_ptr(b);
46560         b_conv.is_owned = ptr_is_owned(b);
46561         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46562         b_conv.is_owned = false;
46563         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
46564         return ret_conv;
46565 }
46566
46567 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
46568         LDKBlindedTail obj_conv;
46569         obj_conv.inner = untag_ptr(obj);
46570         obj_conv.is_owned = ptr_is_owned(obj);
46571         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46572         obj_conv.is_owned = false;
46573         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
46574         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46575         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46576         CVec_u8Z_free(ret_var);
46577         return ret_arr;
46578 }
46579
46580 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
46581         LDKu8slice ser_ref;
46582         ser_ref.datalen = ser->arr_len;
46583         ser_ref.data = ser->elems;
46584         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
46585         *ret_conv = BlindedTail_read(ser_ref);
46586         FREE(ser);
46587         return tag_ptr(ret_conv, true);
46588 }
46589
46590 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
46591         LDKPath this_obj_conv;
46592         this_obj_conv.inner = untag_ptr(this_obj);
46593         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46595         Path_free(this_obj_conv);
46596 }
46597
46598 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
46599         LDKPath this_ptr_conv;
46600         this_ptr_conv.inner = untag_ptr(this_ptr);
46601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46603         this_ptr_conv.is_owned = false;
46604         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
46605         uint64_tArray ret_arr = NULL;
46606         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46607         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46608         for (size_t k = 0; k < ret_var.datalen; k++) {
46609                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
46610                 uint64_t ret_conv_10_ref = 0;
46611                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
46612                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
46613                 ret_arr_ptr[k] = ret_conv_10_ref;
46614         }
46615         
46616         FREE(ret_var.data);
46617         return ret_arr;
46618 }
46619
46620 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
46621         LDKPath this_ptr_conv;
46622         this_ptr_conv.inner = untag_ptr(this_ptr);
46623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46625         this_ptr_conv.is_owned = false;
46626         LDKCVec_RouteHopZ val_constr;
46627         val_constr.datalen = val->arr_len;
46628         if (val_constr.datalen > 0)
46629                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
46630         else
46631                 val_constr.data = NULL;
46632         uint64_t* val_vals = val->elems;
46633         for (size_t k = 0; k < val_constr.datalen; k++) {
46634                 uint64_t val_conv_10 = val_vals[k];
46635                 LDKRouteHop val_conv_10_conv;
46636                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
46637                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
46638                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
46639                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
46640                 val_constr.data[k] = val_conv_10_conv;
46641         }
46642         FREE(val);
46643         Path_set_hops(&this_ptr_conv, val_constr);
46644 }
46645
46646 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
46647         LDKPath this_ptr_conv;
46648         this_ptr_conv.inner = untag_ptr(this_ptr);
46649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46651         this_ptr_conv.is_owned = false;
46652         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
46653         uint64_t ret_ref = 0;
46654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46656         return ret_ref;
46657 }
46658
46659 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
46660         LDKPath this_ptr_conv;
46661         this_ptr_conv.inner = untag_ptr(this_ptr);
46662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46664         this_ptr_conv.is_owned = false;
46665         LDKBlindedTail val_conv;
46666         val_conv.inner = untag_ptr(val);
46667         val_conv.is_owned = ptr_is_owned(val);
46668         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46669         val_conv = BlindedTail_clone(&val_conv);
46670         Path_set_blinded_tail(&this_ptr_conv, val_conv);
46671 }
46672
46673 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
46674         LDKCVec_RouteHopZ hops_arg_constr;
46675         hops_arg_constr.datalen = hops_arg->arr_len;
46676         if (hops_arg_constr.datalen > 0)
46677                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
46678         else
46679                 hops_arg_constr.data = NULL;
46680         uint64_t* hops_arg_vals = hops_arg->elems;
46681         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
46682                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
46683                 LDKRouteHop hops_arg_conv_10_conv;
46684                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
46685                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
46686                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
46687                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
46688                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
46689         }
46690         FREE(hops_arg);
46691         LDKBlindedTail blinded_tail_arg_conv;
46692         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
46693         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
46694         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
46695         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
46696         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
46697         uint64_t ret_ref = 0;
46698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46700         return ret_ref;
46701 }
46702
46703 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
46704         LDKPath ret_var = Path_clone(arg);
46705         uint64_t ret_ref = 0;
46706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46708         return ret_ref;
46709 }
46710 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
46711         LDKPath arg_conv;
46712         arg_conv.inner = untag_ptr(arg);
46713         arg_conv.is_owned = ptr_is_owned(arg);
46714         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46715         arg_conv.is_owned = false;
46716         int64_t ret_conv = Path_clone_ptr(&arg_conv);
46717         return ret_conv;
46718 }
46719
46720 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
46721         LDKPath orig_conv;
46722         orig_conv.inner = untag_ptr(orig);
46723         orig_conv.is_owned = ptr_is_owned(orig);
46724         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46725         orig_conv.is_owned = false;
46726         LDKPath ret_var = Path_clone(&orig_conv);
46727         uint64_t ret_ref = 0;
46728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46730         return ret_ref;
46731 }
46732
46733 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
46734         LDKPath o_conv;
46735         o_conv.inner = untag_ptr(o);
46736         o_conv.is_owned = ptr_is_owned(o);
46737         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46738         o_conv.is_owned = false;
46739         int64_t ret_conv = Path_hash(&o_conv);
46740         return ret_conv;
46741 }
46742
46743 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
46744         LDKPath a_conv;
46745         a_conv.inner = untag_ptr(a);
46746         a_conv.is_owned = ptr_is_owned(a);
46747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46748         a_conv.is_owned = false;
46749         LDKPath b_conv;
46750         b_conv.inner = untag_ptr(b);
46751         b_conv.is_owned = ptr_is_owned(b);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46753         b_conv.is_owned = false;
46754         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
46755         return ret_conv;
46756 }
46757
46758 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(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         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
46765         return ret_conv;
46766 }
46767
46768 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
46769         LDKPath this_arg_conv;
46770         this_arg_conv.inner = untag_ptr(this_arg);
46771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46773         this_arg_conv.is_owned = false;
46774         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
46775         return ret_conv;
46776 }
46777
46778 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
46779         LDKPath this_arg_conv;
46780         this_arg_conv.inner = untag_ptr(this_arg);
46781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46783         this_arg_conv.is_owned = false;
46784         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
46785         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
46786         uint64_t ret_ref = tag_ptr(ret_copy, true);
46787         return ret_ref;
46788 }
46789
46790 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
46791         LDKRoute this_obj_conv;
46792         this_obj_conv.inner = untag_ptr(this_obj);
46793         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46795         Route_free(this_obj_conv);
46796 }
46797
46798 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
46799         LDKRoute this_ptr_conv;
46800         this_ptr_conv.inner = untag_ptr(this_ptr);
46801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46803         this_ptr_conv.is_owned = false;
46804         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
46805         uint64_tArray ret_arr = NULL;
46806         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46807         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46808         for (size_t g = 0; g < ret_var.datalen; g++) {
46809                 LDKPath ret_conv_6_var = ret_var.data[g];
46810                 uint64_t ret_conv_6_ref = 0;
46811                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
46812                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
46813                 ret_arr_ptr[g] = ret_conv_6_ref;
46814         }
46815         
46816         FREE(ret_var.data);
46817         return ret_arr;
46818 }
46819
46820 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
46821         LDKRoute this_ptr_conv;
46822         this_ptr_conv.inner = untag_ptr(this_ptr);
46823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46825         this_ptr_conv.is_owned = false;
46826         LDKCVec_PathZ val_constr;
46827         val_constr.datalen = val->arr_len;
46828         if (val_constr.datalen > 0)
46829                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
46830         else
46831                 val_constr.data = NULL;
46832         uint64_t* val_vals = val->elems;
46833         for (size_t g = 0; g < val_constr.datalen; g++) {
46834                 uint64_t val_conv_6 = val_vals[g];
46835                 LDKPath val_conv_6_conv;
46836                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
46837                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
46838                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
46839                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
46840                 val_constr.data[g] = val_conv_6_conv;
46841         }
46842         FREE(val);
46843         Route_set_paths(&this_ptr_conv, val_constr);
46844 }
46845
46846 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
46847         LDKRoute this_ptr_conv;
46848         this_ptr_conv.inner = untag_ptr(this_ptr);
46849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46851         this_ptr_conv.is_owned = false;
46852         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
46853         uint64_t ret_ref = 0;
46854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46856         return ret_ref;
46857 }
46858
46859 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
46860         LDKRoute this_ptr_conv;
46861         this_ptr_conv.inner = untag_ptr(this_ptr);
46862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46864         this_ptr_conv.is_owned = false;
46865         LDKPaymentParameters val_conv;
46866         val_conv.inner = untag_ptr(val);
46867         val_conv.is_owned = ptr_is_owned(val);
46868         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46869         val_conv = PaymentParameters_clone(&val_conv);
46870         Route_set_payment_params(&this_ptr_conv, val_conv);
46871 }
46872
46873 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t payment_params_arg) {
46874         LDKCVec_PathZ paths_arg_constr;
46875         paths_arg_constr.datalen = paths_arg->arr_len;
46876         if (paths_arg_constr.datalen > 0)
46877                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
46878         else
46879                 paths_arg_constr.data = NULL;
46880         uint64_t* paths_arg_vals = paths_arg->elems;
46881         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
46882                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
46883                 LDKPath paths_arg_conv_6_conv;
46884                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
46885                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
46886                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
46887                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
46888                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
46889         }
46890         FREE(paths_arg);
46891         LDKPaymentParameters payment_params_arg_conv;
46892         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
46893         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
46894         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
46895         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
46896         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
46897         uint64_t ret_ref = 0;
46898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46900         return ret_ref;
46901 }
46902
46903 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
46904         LDKRoute ret_var = Route_clone(arg);
46905         uint64_t ret_ref = 0;
46906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46908         return ret_ref;
46909 }
46910 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
46911         LDKRoute arg_conv;
46912         arg_conv.inner = untag_ptr(arg);
46913         arg_conv.is_owned = ptr_is_owned(arg);
46914         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46915         arg_conv.is_owned = false;
46916         int64_t ret_conv = Route_clone_ptr(&arg_conv);
46917         return ret_conv;
46918 }
46919
46920 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
46921         LDKRoute orig_conv;
46922         orig_conv.inner = untag_ptr(orig);
46923         orig_conv.is_owned = ptr_is_owned(orig);
46924         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46925         orig_conv.is_owned = false;
46926         LDKRoute ret_var = Route_clone(&orig_conv);
46927         uint64_t ret_ref = 0;
46928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46930         return ret_ref;
46931 }
46932
46933 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
46934         LDKRoute o_conv;
46935         o_conv.inner = untag_ptr(o);
46936         o_conv.is_owned = ptr_is_owned(o);
46937         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46938         o_conv.is_owned = false;
46939         int64_t ret_conv = Route_hash(&o_conv);
46940         return ret_conv;
46941 }
46942
46943 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
46944         LDKRoute a_conv;
46945         a_conv.inner = untag_ptr(a);
46946         a_conv.is_owned = ptr_is_owned(a);
46947         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46948         a_conv.is_owned = false;
46949         LDKRoute b_conv;
46950         b_conv.inner = untag_ptr(b);
46951         b_conv.is_owned = ptr_is_owned(b);
46952         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46953         b_conv.is_owned = false;
46954         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
46955         return ret_conv;
46956 }
46957
46958 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
46959         LDKRoute this_arg_conv;
46960         this_arg_conv.inner = untag_ptr(this_arg);
46961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46963         this_arg_conv.is_owned = false;
46964         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
46965         return ret_conv;
46966 }
46967
46968 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
46969         LDKRoute this_arg_conv;
46970         this_arg_conv.inner = untag_ptr(this_arg);
46971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46973         this_arg_conv.is_owned = false;
46974         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
46975         return ret_conv;
46976 }
46977
46978 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
46979         LDKRoute obj_conv;
46980         obj_conv.inner = untag_ptr(obj);
46981         obj_conv.is_owned = ptr_is_owned(obj);
46982         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46983         obj_conv.is_owned = false;
46984         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
46985         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46986         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46987         CVec_u8Z_free(ret_var);
46988         return ret_arr;
46989 }
46990
46991 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
46992         LDKu8slice ser_ref;
46993         ser_ref.datalen = ser->arr_len;
46994         ser_ref.data = ser->elems;
46995         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
46996         *ret_conv = Route_read(ser_ref);
46997         FREE(ser);
46998         return tag_ptr(ret_conv, true);
46999 }
47000
47001 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
47002         LDKRouteParameters this_obj_conv;
47003         this_obj_conv.inner = untag_ptr(this_obj);
47004         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47006         RouteParameters_free(this_obj_conv);
47007 }
47008
47009 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
47010         LDKRouteParameters this_ptr_conv;
47011         this_ptr_conv.inner = untag_ptr(this_ptr);
47012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47014         this_ptr_conv.is_owned = false;
47015         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
47016         uint64_t ret_ref = 0;
47017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47019         return ret_ref;
47020 }
47021
47022 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
47023         LDKRouteParameters this_ptr_conv;
47024         this_ptr_conv.inner = untag_ptr(this_ptr);
47025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47027         this_ptr_conv.is_owned = false;
47028         LDKPaymentParameters val_conv;
47029         val_conv.inner = untag_ptr(val);
47030         val_conv.is_owned = ptr_is_owned(val);
47031         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47032         val_conv = PaymentParameters_clone(&val_conv);
47033         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
47034 }
47035
47036 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
47037         LDKRouteParameters this_ptr_conv;
47038         this_ptr_conv.inner = untag_ptr(this_ptr);
47039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47041         this_ptr_conv.is_owned = false;
47042         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
47043         return ret_conv;
47044 }
47045
47046 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
47047         LDKRouteParameters this_ptr_conv;
47048         this_ptr_conv.inner = untag_ptr(this_ptr);
47049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47051         this_ptr_conv.is_owned = false;
47052         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
47053 }
47054
47055 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) {
47056         LDKPaymentParameters payment_params_arg_conv;
47057         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
47058         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
47059         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
47060         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
47061         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
47062         uint64_t ret_ref = 0;
47063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47065         return ret_ref;
47066 }
47067
47068 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
47069         LDKRouteParameters ret_var = RouteParameters_clone(arg);
47070         uint64_t ret_ref = 0;
47071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47073         return ret_ref;
47074 }
47075 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
47076         LDKRouteParameters arg_conv;
47077         arg_conv.inner = untag_ptr(arg);
47078         arg_conv.is_owned = ptr_is_owned(arg);
47079         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47080         arg_conv.is_owned = false;
47081         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
47082         return ret_conv;
47083 }
47084
47085 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
47086         LDKRouteParameters orig_conv;
47087         orig_conv.inner = untag_ptr(orig);
47088         orig_conv.is_owned = ptr_is_owned(orig);
47089         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47090         orig_conv.is_owned = false;
47091         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
47092         uint64_t ret_ref = 0;
47093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47095         return ret_ref;
47096 }
47097
47098 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
47099         LDKRouteParameters a_conv;
47100         a_conv.inner = untag_ptr(a);
47101         a_conv.is_owned = ptr_is_owned(a);
47102         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47103         a_conv.is_owned = false;
47104         LDKRouteParameters b_conv;
47105         b_conv.inner = untag_ptr(b);
47106         b_conv.is_owned = ptr_is_owned(b);
47107         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47108         b_conv.is_owned = false;
47109         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
47110         return ret_conv;
47111 }
47112
47113 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
47114         LDKRouteParameters obj_conv;
47115         obj_conv.inner = untag_ptr(obj);
47116         obj_conv.is_owned = ptr_is_owned(obj);
47117         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47118         obj_conv.is_owned = false;
47119         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
47120         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47121         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47122         CVec_u8Z_free(ret_var);
47123         return ret_arr;
47124 }
47125
47126 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
47127         LDKu8slice ser_ref;
47128         ser_ref.datalen = ser->arr_len;
47129         ser_ref.data = ser->elems;
47130         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
47131         *ret_conv = RouteParameters_read(ser_ref);
47132         FREE(ser);
47133         return tag_ptr(ret_conv, true);
47134 }
47135
47136 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
47137         LDKPaymentParameters this_obj_conv;
47138         this_obj_conv.inner = untag_ptr(this_obj);
47139         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47141         PaymentParameters_free(this_obj_conv);
47142 }
47143
47144 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
47145         LDKPaymentParameters this_ptr_conv;
47146         this_ptr_conv.inner = untag_ptr(this_ptr);
47147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47149         this_ptr_conv.is_owned = false;
47150         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47151         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
47152         return ret_arr;
47153 }
47154
47155 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
47156         LDKPaymentParameters this_ptr_conv;
47157         this_ptr_conv.inner = untag_ptr(this_ptr);
47158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47160         this_ptr_conv.is_owned = false;
47161         LDKPublicKey val_ref;
47162         CHECK(val->arr_len == 33);
47163         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47164         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
47165 }
47166
47167 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
47168         LDKPaymentParameters this_ptr_conv;
47169         this_ptr_conv.inner = untag_ptr(this_ptr);
47170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47172         this_ptr_conv.is_owned = false;
47173         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
47174         uint64_t ret_ref = 0;
47175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47177         return ret_ref;
47178 }
47179
47180 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
47181         LDKPaymentParameters this_ptr_conv;
47182         this_ptr_conv.inner = untag_ptr(this_ptr);
47183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47185         this_ptr_conv.is_owned = false;
47186         LDKInvoiceFeatures val_conv;
47187         val_conv.inner = untag_ptr(val);
47188         val_conv.is_owned = ptr_is_owned(val);
47189         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47190         val_conv = InvoiceFeatures_clone(&val_conv);
47191         PaymentParameters_set_features(&this_ptr_conv, val_conv);
47192 }
47193
47194 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
47195         LDKPaymentParameters this_ptr_conv;
47196         this_ptr_conv.inner = untag_ptr(this_ptr);
47197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47199         this_ptr_conv.is_owned = false;
47200         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47201         *ret_copy = PaymentParameters_get_route_hints(&this_ptr_conv);
47202         uint64_t ret_ref = tag_ptr(ret_copy, true);
47203         return ret_ref;
47204 }
47205
47206 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_t val) {
47207         LDKPaymentParameters this_ptr_conv;
47208         this_ptr_conv.inner = untag_ptr(this_ptr);
47209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47211         this_ptr_conv.is_owned = false;
47212         void* val_ptr = untag_ptr(val);
47213         CHECK_ACCESS(val_ptr);
47214         LDKHints val_conv = *(LDKHints*)(val_ptr);
47215         val_conv = Hints_clone((LDKHints*)untag_ptr(val));
47216         PaymentParameters_set_route_hints(&this_ptr_conv, val_conv);
47217 }
47218
47219 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
47220         LDKPaymentParameters this_ptr_conv;
47221         this_ptr_conv.inner = untag_ptr(this_ptr);
47222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47224         this_ptr_conv.is_owned = false;
47225         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47226         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
47227         uint64_t ret_ref = tag_ptr(ret_copy, true);
47228         return ret_ref;
47229 }
47230
47231 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
47232         LDKPaymentParameters this_ptr_conv;
47233         this_ptr_conv.inner = untag_ptr(this_ptr);
47234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47236         this_ptr_conv.is_owned = false;
47237         void* val_ptr = untag_ptr(val);
47238         CHECK_ACCESS(val_ptr);
47239         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47240         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47241         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
47242 }
47243
47244 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) {
47245         LDKPaymentParameters this_ptr_conv;
47246         this_ptr_conv.inner = untag_ptr(this_ptr);
47247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47249         this_ptr_conv.is_owned = false;
47250         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
47251         return ret_conv;
47252 }
47253
47254 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) {
47255         LDKPaymentParameters this_ptr_conv;
47256         this_ptr_conv.inner = untag_ptr(this_ptr);
47257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47259         this_ptr_conv.is_owned = false;
47260         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
47261 }
47262
47263 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
47264         LDKPaymentParameters this_ptr_conv;
47265         this_ptr_conv.inner = untag_ptr(this_ptr);
47266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47268         this_ptr_conv.is_owned = false;
47269         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
47270         return ret_conv;
47271 }
47272
47273 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
47274         LDKPaymentParameters this_ptr_conv;
47275         this_ptr_conv.inner = untag_ptr(this_ptr);
47276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47278         this_ptr_conv.is_owned = false;
47279         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
47280 }
47281
47282 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) {
47283         LDKPaymentParameters this_ptr_conv;
47284         this_ptr_conv.inner = untag_ptr(this_ptr);
47285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47287         this_ptr_conv.is_owned = false;
47288         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
47289         return ret_conv;
47290 }
47291
47292 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) {
47293         LDKPaymentParameters this_ptr_conv;
47294         this_ptr_conv.inner = untag_ptr(this_ptr);
47295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47297         this_ptr_conv.is_owned = false;
47298         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
47299 }
47300
47301 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
47302         LDKPaymentParameters this_ptr_conv;
47303         this_ptr_conv.inner = untag_ptr(this_ptr);
47304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47306         this_ptr_conv.is_owned = false;
47307         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
47308         int64_tArray ret_arr = NULL;
47309         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
47310         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
47311         for (size_t i = 0; i < ret_var.datalen; i++) {
47312                 int64_t ret_conv_8_conv = ret_var.data[i];
47313                 ret_arr_ptr[i] = ret_conv_8_conv;
47314         }
47315         
47316         FREE(ret_var.data);
47317         return ret_arr;
47318 }
47319
47320 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
47321         LDKPaymentParameters this_ptr_conv;
47322         this_ptr_conv.inner = untag_ptr(this_ptr);
47323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47325         this_ptr_conv.is_owned = false;
47326         LDKCVec_u64Z val_constr;
47327         val_constr.datalen = val->arr_len;
47328         if (val_constr.datalen > 0)
47329                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47330         else
47331                 val_constr.data = NULL;
47332         int64_t* val_vals = val->elems;
47333         for (size_t i = 0; i < val_constr.datalen; i++) {
47334                 int64_t val_conv_8 = val_vals[i];
47335                 val_constr.data[i] = val_conv_8;
47336         }
47337         FREE(val);
47338         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
47339 }
47340
47341 int32_t  __attribute__((export_name("TS_PaymentParameters_get_final_cltv_expiry_delta"))) TS_PaymentParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
47342         LDKPaymentParameters this_ptr_conv;
47343         this_ptr_conv.inner = untag_ptr(this_ptr);
47344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47346         this_ptr_conv.is_owned = false;
47347         int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
47348         return ret_conv;
47349 }
47350
47351 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) {
47352         LDKPaymentParameters this_ptr_conv;
47353         this_ptr_conv.inner = untag_ptr(this_ptr);
47354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47356         this_ptr_conv.is_owned = false;
47357         PaymentParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
47358 }
47359
47360 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) {
47361         LDKPublicKey payee_pubkey_arg_ref;
47362         CHECK(payee_pubkey_arg->arr_len == 33);
47363         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
47364         LDKInvoiceFeatures features_arg_conv;
47365         features_arg_conv.inner = untag_ptr(features_arg);
47366         features_arg_conv.is_owned = ptr_is_owned(features_arg);
47367         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
47368         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
47369         void* route_hints_arg_ptr = untag_ptr(route_hints_arg);
47370         CHECK_ACCESS(route_hints_arg_ptr);
47371         LDKHints route_hints_arg_conv = *(LDKHints*)(route_hints_arg_ptr);
47372         route_hints_arg_conv = Hints_clone((LDKHints*)untag_ptr(route_hints_arg));
47373         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
47374         CHECK_ACCESS(expiry_time_arg_ptr);
47375         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
47376         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
47377         LDKCVec_u64Z previously_failed_channels_arg_constr;
47378         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
47379         if (previously_failed_channels_arg_constr.datalen > 0)
47380                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47381         else
47382                 previously_failed_channels_arg_constr.data = NULL;
47383         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
47384         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
47385                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
47386                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
47387         }
47388         FREE(previously_failed_channels_arg);
47389         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);
47390         uint64_t ret_ref = 0;
47391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47393         return ret_ref;
47394 }
47395
47396 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
47397         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
47398         uint64_t ret_ref = 0;
47399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47401         return ret_ref;
47402 }
47403 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
47404         LDKPaymentParameters arg_conv;
47405         arg_conv.inner = untag_ptr(arg);
47406         arg_conv.is_owned = ptr_is_owned(arg);
47407         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47408         arg_conv.is_owned = false;
47409         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
47410         return ret_conv;
47411 }
47412
47413 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
47414         LDKPaymentParameters orig_conv;
47415         orig_conv.inner = untag_ptr(orig);
47416         orig_conv.is_owned = ptr_is_owned(orig);
47417         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47418         orig_conv.is_owned = false;
47419         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
47420         uint64_t ret_ref = 0;
47421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47423         return ret_ref;
47424 }
47425
47426 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
47427         LDKPaymentParameters o_conv;
47428         o_conv.inner = untag_ptr(o);
47429         o_conv.is_owned = ptr_is_owned(o);
47430         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47431         o_conv.is_owned = false;
47432         int64_t ret_conv = PaymentParameters_hash(&o_conv);
47433         return ret_conv;
47434 }
47435
47436 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
47437         LDKPaymentParameters a_conv;
47438         a_conv.inner = untag_ptr(a);
47439         a_conv.is_owned = ptr_is_owned(a);
47440         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47441         a_conv.is_owned = false;
47442         LDKPaymentParameters b_conv;
47443         b_conv.inner = untag_ptr(b);
47444         b_conv.is_owned = ptr_is_owned(b);
47445         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47446         b_conv.is_owned = false;
47447         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
47448         return ret_conv;
47449 }
47450
47451 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
47452         LDKPaymentParameters obj_conv;
47453         obj_conv.inner = untag_ptr(obj);
47454         obj_conv.is_owned = ptr_is_owned(obj);
47455         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47456         obj_conv.is_owned = false;
47457         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
47458         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47459         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47460         CVec_u8Z_free(ret_var);
47461         return ret_arr;
47462 }
47463
47464 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
47465         LDKu8slice ser_ref;
47466         ser_ref.datalen = ser->arr_len;
47467         ser_ref.data = ser->elems;
47468         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
47469         *ret_conv = PaymentParameters_read(ser_ref, arg);
47470         FREE(ser);
47471         return tag_ptr(ret_conv, true);
47472 }
47473
47474 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) {
47475         LDKPublicKey payee_pubkey_ref;
47476         CHECK(payee_pubkey->arr_len == 33);
47477         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
47478         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
47479         uint64_t ret_ref = 0;
47480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47482         return ret_ref;
47483 }
47484
47485 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
47486         LDKPublicKey payee_pubkey_ref;
47487         CHECK(payee_pubkey->arr_len == 33);
47488         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
47489         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta);
47490         uint64_t ret_ref = 0;
47491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47493         return ret_ref;
47494 }
47495
47496 void  __attribute__((export_name("TS_Hints_free"))) TS_Hints_free(uint64_t this_ptr) {
47497         if (!ptr_is_owned(this_ptr)) return;
47498         void* this_ptr_ptr = untag_ptr(this_ptr);
47499         CHECK_ACCESS(this_ptr_ptr);
47500         LDKHints this_ptr_conv = *(LDKHints*)(this_ptr_ptr);
47501         FREE(untag_ptr(this_ptr));
47502         Hints_free(this_ptr_conv);
47503 }
47504
47505 static inline uint64_t Hints_clone_ptr(LDKHints *NONNULL_PTR arg) {
47506         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47507         *ret_copy = Hints_clone(arg);
47508         uint64_t ret_ref = tag_ptr(ret_copy, true);
47509         return ret_ref;
47510 }
47511 int64_t  __attribute__((export_name("TS_Hints_clone_ptr"))) TS_Hints_clone_ptr(uint64_t arg) {
47512         LDKHints* arg_conv = (LDKHints*)untag_ptr(arg);
47513         int64_t ret_conv = Hints_clone_ptr(arg_conv);
47514         return ret_conv;
47515 }
47516
47517 uint64_t  __attribute__((export_name("TS_Hints_clone"))) TS_Hints_clone(uint64_t orig) {
47518         LDKHints* orig_conv = (LDKHints*)untag_ptr(orig);
47519         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47520         *ret_copy = Hints_clone(orig_conv);
47521         uint64_t ret_ref = tag_ptr(ret_copy, true);
47522         return ret_ref;
47523 }
47524
47525 uint64_t  __attribute__((export_name("TS_Hints_blinded"))) TS_Hints_blinded(uint64_tArray a) {
47526         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ a_constr;
47527         a_constr.datalen = a->arr_len;
47528         if (a_constr.datalen > 0)
47529                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
47530         else
47531                 a_constr.data = NULL;
47532         uint64_t* a_vals = a->elems;
47533         for (size_t l = 0; l < a_constr.datalen; l++) {
47534                 uint64_t a_conv_37 = a_vals[l];
47535                 void* a_conv_37_ptr = untag_ptr(a_conv_37);
47536                 CHECK_ACCESS(a_conv_37_ptr);
47537                 LDKC2Tuple_BlindedPayInfoBlindedPathZ a_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(a_conv_37_ptr);
47538                 a_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(a_conv_37));
47539                 a_constr.data[l] = a_conv_37_conv;
47540         }
47541         FREE(a);
47542         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47543         *ret_copy = Hints_blinded(a_constr);
47544         uint64_t ret_ref = tag_ptr(ret_copy, true);
47545         return ret_ref;
47546 }
47547
47548 uint64_t  __attribute__((export_name("TS_Hints_clear"))) TS_Hints_clear(uint64_tArray a) {
47549         LDKCVec_RouteHintZ a_constr;
47550         a_constr.datalen = a->arr_len;
47551         if (a_constr.datalen > 0)
47552                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
47553         else
47554                 a_constr.data = NULL;
47555         uint64_t* a_vals = a->elems;
47556         for (size_t l = 0; l < a_constr.datalen; l++) {
47557                 uint64_t a_conv_11 = a_vals[l];
47558                 LDKRouteHint a_conv_11_conv;
47559                 a_conv_11_conv.inner = untag_ptr(a_conv_11);
47560                 a_conv_11_conv.is_owned = ptr_is_owned(a_conv_11);
47561                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv_11_conv);
47562                 a_conv_11_conv = RouteHint_clone(&a_conv_11_conv);
47563                 a_constr.data[l] = a_conv_11_conv;
47564         }
47565         FREE(a);
47566         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47567         *ret_copy = Hints_clear(a_constr);
47568         uint64_t ret_ref = tag_ptr(ret_copy, true);
47569         return ret_ref;
47570 }
47571
47572 int64_t  __attribute__((export_name("TS_Hints_hash"))) TS_Hints_hash(uint64_t o) {
47573         LDKHints* o_conv = (LDKHints*)untag_ptr(o);
47574         int64_t ret_conv = Hints_hash(o_conv);
47575         return ret_conv;
47576 }
47577
47578 jboolean  __attribute__((export_name("TS_Hints_eq"))) TS_Hints_eq(uint64_t a, uint64_t b) {
47579         LDKHints* a_conv = (LDKHints*)untag_ptr(a);
47580         LDKHints* b_conv = (LDKHints*)untag_ptr(b);
47581         jboolean ret_conv = Hints_eq(a_conv, b_conv);
47582         return ret_conv;
47583 }
47584
47585 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
47586         LDKRouteHint this_obj_conv;
47587         this_obj_conv.inner = untag_ptr(this_obj);
47588         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47590         RouteHint_free(this_obj_conv);
47591 }
47592
47593 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
47594         LDKRouteHint this_ptr_conv;
47595         this_ptr_conv.inner = untag_ptr(this_ptr);
47596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47598         this_ptr_conv.is_owned = false;
47599         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
47600         uint64_tArray ret_arr = NULL;
47601         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47602         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47603         for (size_t o = 0; o < ret_var.datalen; o++) {
47604                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
47605                 uint64_t ret_conv_14_ref = 0;
47606                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47607                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
47608                 ret_arr_ptr[o] = ret_conv_14_ref;
47609         }
47610         
47611         FREE(ret_var.data);
47612         return ret_arr;
47613 }
47614
47615 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
47616         LDKRouteHint this_ptr_conv;
47617         this_ptr_conv.inner = untag_ptr(this_ptr);
47618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47620         this_ptr_conv.is_owned = false;
47621         LDKCVec_RouteHintHopZ val_constr;
47622         val_constr.datalen = val->arr_len;
47623         if (val_constr.datalen > 0)
47624                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
47625         else
47626                 val_constr.data = NULL;
47627         uint64_t* val_vals = val->elems;
47628         for (size_t o = 0; o < val_constr.datalen; o++) {
47629                 uint64_t val_conv_14 = val_vals[o];
47630                 LDKRouteHintHop val_conv_14_conv;
47631                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
47632                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
47633                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
47634                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
47635                 val_constr.data[o] = val_conv_14_conv;
47636         }
47637         FREE(val);
47638         RouteHint_set_a(&this_ptr_conv, val_constr);
47639 }
47640
47641 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
47642         LDKCVec_RouteHintHopZ a_arg_constr;
47643         a_arg_constr.datalen = a_arg->arr_len;
47644         if (a_arg_constr.datalen > 0)
47645                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
47646         else
47647                 a_arg_constr.data = NULL;
47648         uint64_t* a_arg_vals = a_arg->elems;
47649         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
47650                 uint64_t a_arg_conv_14 = a_arg_vals[o];
47651                 LDKRouteHintHop a_arg_conv_14_conv;
47652                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
47653                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
47654                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
47655                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
47656                 a_arg_constr.data[o] = a_arg_conv_14_conv;
47657         }
47658         FREE(a_arg);
47659         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
47660         uint64_t ret_ref = 0;
47661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47663         return ret_ref;
47664 }
47665
47666 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
47667         LDKRouteHint ret_var = RouteHint_clone(arg);
47668         uint64_t ret_ref = 0;
47669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47671         return ret_ref;
47672 }
47673 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
47674         LDKRouteHint arg_conv;
47675         arg_conv.inner = untag_ptr(arg);
47676         arg_conv.is_owned = ptr_is_owned(arg);
47677         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47678         arg_conv.is_owned = false;
47679         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
47680         return ret_conv;
47681 }
47682
47683 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
47684         LDKRouteHint orig_conv;
47685         orig_conv.inner = untag_ptr(orig);
47686         orig_conv.is_owned = ptr_is_owned(orig);
47687         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47688         orig_conv.is_owned = false;
47689         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
47690         uint64_t ret_ref = 0;
47691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47693         return ret_ref;
47694 }
47695
47696 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
47697         LDKRouteHint o_conv;
47698         o_conv.inner = untag_ptr(o);
47699         o_conv.is_owned = ptr_is_owned(o);
47700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47701         o_conv.is_owned = false;
47702         int64_t ret_conv = RouteHint_hash(&o_conv);
47703         return ret_conv;
47704 }
47705
47706 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
47707         LDKRouteHint a_conv;
47708         a_conv.inner = untag_ptr(a);
47709         a_conv.is_owned = ptr_is_owned(a);
47710         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47711         a_conv.is_owned = false;
47712         LDKRouteHint b_conv;
47713         b_conv.inner = untag_ptr(b);
47714         b_conv.is_owned = ptr_is_owned(b);
47715         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47716         b_conv.is_owned = false;
47717         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
47718         return ret_conv;
47719 }
47720
47721 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
47722         LDKRouteHint obj_conv;
47723         obj_conv.inner = untag_ptr(obj);
47724         obj_conv.is_owned = ptr_is_owned(obj);
47725         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47726         obj_conv.is_owned = false;
47727         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
47728         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47729         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47730         CVec_u8Z_free(ret_var);
47731         return ret_arr;
47732 }
47733
47734 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
47735         LDKu8slice ser_ref;
47736         ser_ref.datalen = ser->arr_len;
47737         ser_ref.data = ser->elems;
47738         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
47739         *ret_conv = RouteHint_read(ser_ref);
47740         FREE(ser);
47741         return tag_ptr(ret_conv, true);
47742 }
47743
47744 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
47745         LDKRouteHintHop this_obj_conv;
47746         this_obj_conv.inner = untag_ptr(this_obj);
47747         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47749         RouteHintHop_free(this_obj_conv);
47750 }
47751
47752 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
47753         LDKRouteHintHop this_ptr_conv;
47754         this_ptr_conv.inner = untag_ptr(this_ptr);
47755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47757         this_ptr_conv.is_owned = false;
47758         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47759         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
47760         return ret_arr;
47761 }
47762
47763 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
47764         LDKRouteHintHop this_ptr_conv;
47765         this_ptr_conv.inner = untag_ptr(this_ptr);
47766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47768         this_ptr_conv.is_owned = false;
47769         LDKPublicKey val_ref;
47770         CHECK(val->arr_len == 33);
47771         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47772         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
47773 }
47774
47775 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
47776         LDKRouteHintHop this_ptr_conv;
47777         this_ptr_conv.inner = untag_ptr(this_ptr);
47778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47780         this_ptr_conv.is_owned = false;
47781         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
47782         return ret_conv;
47783 }
47784
47785 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
47786         LDKRouteHintHop this_ptr_conv;
47787         this_ptr_conv.inner = untag_ptr(this_ptr);
47788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47790         this_ptr_conv.is_owned = false;
47791         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
47792 }
47793
47794 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
47795         LDKRouteHintHop this_ptr_conv;
47796         this_ptr_conv.inner = untag_ptr(this_ptr);
47797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47799         this_ptr_conv.is_owned = false;
47800         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
47801         uint64_t ret_ref = 0;
47802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47804         return ret_ref;
47805 }
47806
47807 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
47808         LDKRouteHintHop this_ptr_conv;
47809         this_ptr_conv.inner = untag_ptr(this_ptr);
47810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47812         this_ptr_conv.is_owned = false;
47813         LDKRoutingFees val_conv;
47814         val_conv.inner = untag_ptr(val);
47815         val_conv.is_owned = ptr_is_owned(val);
47816         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47817         val_conv = RoutingFees_clone(&val_conv);
47818         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
47819 }
47820
47821 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
47822         LDKRouteHintHop this_ptr_conv;
47823         this_ptr_conv.inner = untag_ptr(this_ptr);
47824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47826         this_ptr_conv.is_owned = false;
47827         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
47828         return ret_conv;
47829 }
47830
47831 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
47832         LDKRouteHintHop this_ptr_conv;
47833         this_ptr_conv.inner = untag_ptr(this_ptr);
47834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47836         this_ptr_conv.is_owned = false;
47837         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
47838 }
47839
47840 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
47841         LDKRouteHintHop this_ptr_conv;
47842         this_ptr_conv.inner = untag_ptr(this_ptr);
47843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47845         this_ptr_conv.is_owned = false;
47846         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47847         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
47848         uint64_t ret_ref = tag_ptr(ret_copy, true);
47849         return ret_ref;
47850 }
47851
47852 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
47853         LDKRouteHintHop this_ptr_conv;
47854         this_ptr_conv.inner = untag_ptr(this_ptr);
47855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47857         this_ptr_conv.is_owned = false;
47858         void* val_ptr = untag_ptr(val);
47859         CHECK_ACCESS(val_ptr);
47860         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47861         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47862         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
47863 }
47864
47865 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
47866         LDKRouteHintHop this_ptr_conv;
47867         this_ptr_conv.inner = untag_ptr(this_ptr);
47868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47870         this_ptr_conv.is_owned = false;
47871         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47872         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
47873         uint64_t ret_ref = tag_ptr(ret_copy, true);
47874         return ret_ref;
47875 }
47876
47877 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
47878         LDKRouteHintHop this_ptr_conv;
47879         this_ptr_conv.inner = untag_ptr(this_ptr);
47880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47882         this_ptr_conv.is_owned = false;
47883         void* val_ptr = untag_ptr(val);
47884         CHECK_ACCESS(val_ptr);
47885         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47886         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47887         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
47888 }
47889
47890 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) {
47891         LDKPublicKey src_node_id_arg_ref;
47892         CHECK(src_node_id_arg->arr_len == 33);
47893         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
47894         LDKRoutingFees fees_arg_conv;
47895         fees_arg_conv.inner = untag_ptr(fees_arg);
47896         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
47897         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
47898         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
47899         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
47900         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
47901         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
47902         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
47903         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
47904         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
47905         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
47906         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
47907         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);
47908         uint64_t ret_ref = 0;
47909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47911         return ret_ref;
47912 }
47913
47914 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
47915         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
47916         uint64_t ret_ref = 0;
47917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47919         return ret_ref;
47920 }
47921 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
47922         LDKRouteHintHop arg_conv;
47923         arg_conv.inner = untag_ptr(arg);
47924         arg_conv.is_owned = ptr_is_owned(arg);
47925         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47926         arg_conv.is_owned = false;
47927         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
47928         return ret_conv;
47929 }
47930
47931 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
47932         LDKRouteHintHop orig_conv;
47933         orig_conv.inner = untag_ptr(orig);
47934         orig_conv.is_owned = ptr_is_owned(orig);
47935         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47936         orig_conv.is_owned = false;
47937         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
47938         uint64_t ret_ref = 0;
47939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47941         return ret_ref;
47942 }
47943
47944 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
47945         LDKRouteHintHop o_conv;
47946         o_conv.inner = untag_ptr(o);
47947         o_conv.is_owned = ptr_is_owned(o);
47948         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47949         o_conv.is_owned = false;
47950         int64_t ret_conv = RouteHintHop_hash(&o_conv);
47951         return ret_conv;
47952 }
47953
47954 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
47955         LDKRouteHintHop a_conv;
47956         a_conv.inner = untag_ptr(a);
47957         a_conv.is_owned = ptr_is_owned(a);
47958         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47959         a_conv.is_owned = false;
47960         LDKRouteHintHop b_conv;
47961         b_conv.inner = untag_ptr(b);
47962         b_conv.is_owned = ptr_is_owned(b);
47963         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47964         b_conv.is_owned = false;
47965         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
47966         return ret_conv;
47967 }
47968
47969 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
47970         LDKRouteHintHop obj_conv;
47971         obj_conv.inner = untag_ptr(obj);
47972         obj_conv.is_owned = ptr_is_owned(obj);
47973         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47974         obj_conv.is_owned = false;
47975         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
47976         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47977         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47978         CVec_u8Z_free(ret_var);
47979         return ret_arr;
47980 }
47981
47982 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
47983         LDKu8slice ser_ref;
47984         ser_ref.datalen = ser->arr_len;
47985         ser_ref.data = ser->elems;
47986         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
47987         *ret_conv = RouteHintHop_read(ser_ref);
47988         FREE(ser);
47989         return tag_ptr(ret_conv, true);
47990 }
47991
47992 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) {
47993         LDKPublicKey our_node_pubkey_ref;
47994         CHECK(our_node_pubkey->arr_len == 33);
47995         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
47996         LDKRouteParameters route_params_conv;
47997         route_params_conv.inner = untag_ptr(route_params);
47998         route_params_conv.is_owned = ptr_is_owned(route_params);
47999         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48000         route_params_conv.is_owned = false;
48001         LDKNetworkGraph network_graph_conv;
48002         network_graph_conv.inner = untag_ptr(network_graph);
48003         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48004         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48005         network_graph_conv.is_owned = false;
48006         LDKCVec_ChannelDetailsZ first_hops_constr;
48007         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
48008         if (first_hops != 0) {
48009                 first_hops_constr.datalen = first_hops->arr_len;
48010                 if (first_hops_constr.datalen > 0)
48011                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
48012                 else
48013                         first_hops_constr.data = NULL;
48014                 uint64_t* first_hops_vals = first_hops->elems;
48015                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
48016                         uint64_t first_hops_conv_16 = first_hops_vals[q];
48017                         LDKChannelDetails first_hops_conv_16_conv;
48018                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
48019                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
48020                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
48021                         first_hops_conv_16_conv.is_owned = false;
48022                         first_hops_constr.data[q] = first_hops_conv_16_conv;
48023                 }
48024                 FREE(first_hops);
48025                 first_hops_ptr = &first_hops_constr;
48026         }
48027         void* logger_ptr = untag_ptr(logger);
48028         CHECK_ACCESS(logger_ptr);
48029         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48030         if (logger_conv.free == LDKLogger_JCalls_free) {
48031                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48032                 LDKLogger_JCalls_cloned(&logger_conv);
48033         }
48034         void* scorer_ptr = untag_ptr(scorer);
48035         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
48036         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
48037         uint8_t random_seed_bytes_arr[32];
48038         CHECK(random_seed_bytes->arr_len == 32);
48039         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
48040         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
48041         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
48042         *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);
48043         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
48044         return tag_ptr(ret_conv, true);
48045 }
48046
48047 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) {
48048         LDKPublicKey our_node_pubkey_ref;
48049         CHECK(our_node_pubkey->arr_len == 33);
48050         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
48051         LDKCVec_PublicKeyZ hops_constr;
48052         hops_constr.datalen = hops->arr_len;
48053         if (hops_constr.datalen > 0)
48054                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
48055         else
48056                 hops_constr.data = NULL;
48057         int8_tArray* hops_vals = (void*) hops->elems;
48058         for (size_t m = 0; m < hops_constr.datalen; m++) {
48059                 int8_tArray hops_conv_12 = hops_vals[m];
48060                 LDKPublicKey hops_conv_12_ref;
48061                 CHECK(hops_conv_12->arr_len == 33);
48062                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
48063                 hops_constr.data[m] = hops_conv_12_ref;
48064         }
48065         FREE(hops);
48066         LDKRouteParameters route_params_conv;
48067         route_params_conv.inner = untag_ptr(route_params);
48068         route_params_conv.is_owned = ptr_is_owned(route_params);
48069         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48070         route_params_conv.is_owned = false;
48071         LDKNetworkGraph network_graph_conv;
48072         network_graph_conv.inner = untag_ptr(network_graph);
48073         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48074         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48075         network_graph_conv.is_owned = false;
48076         void* logger_ptr = untag_ptr(logger);
48077         CHECK_ACCESS(logger_ptr);
48078         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48079         if (logger_conv.free == LDKLogger_JCalls_free) {
48080                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48081                 LDKLogger_JCalls_cloned(&logger_conv);
48082         }
48083         uint8_t random_seed_bytes_arr[32];
48084         CHECK(random_seed_bytes->arr_len == 32);
48085         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
48086         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
48087         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
48088         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
48089         return tag_ptr(ret_conv, true);
48090 }
48091
48092 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
48093         if (!ptr_is_owned(this_ptr)) return;
48094         void* this_ptr_ptr = untag_ptr(this_ptr);
48095         CHECK_ACCESS(this_ptr_ptr);
48096         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
48097         FREE(untag_ptr(this_ptr));
48098         Score_free(this_ptr_conv);
48099 }
48100
48101 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
48102         if (!ptr_is_owned(this_ptr)) return;
48103         void* this_ptr_ptr = untag_ptr(this_ptr);
48104         CHECK_ACCESS(this_ptr_ptr);
48105         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
48106         FREE(untag_ptr(this_ptr));
48107         LockableScore_free(this_ptr_conv);
48108 }
48109
48110 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
48111         if (!ptr_is_owned(this_ptr)) return;
48112         void* this_ptr_ptr = untag_ptr(this_ptr);
48113         CHECK_ACCESS(this_ptr_ptr);
48114         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
48115         FREE(untag_ptr(this_ptr));
48116         WriteableScore_free(this_ptr_conv);
48117 }
48118
48119 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
48120         LDKMultiThreadedLockableScore this_obj_conv;
48121         this_obj_conv.inner = untag_ptr(this_obj);
48122         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48124         MultiThreadedLockableScore_free(this_obj_conv);
48125 }
48126
48127 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
48128         LDKMultiThreadedScoreLock this_obj_conv;
48129         this_obj_conv.inner = untag_ptr(this_obj);
48130         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48132         MultiThreadedScoreLock_free(this_obj_conv);
48133 }
48134
48135 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
48136         LDKMultiThreadedScoreLock this_arg_conv;
48137         this_arg_conv.inner = untag_ptr(this_arg);
48138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48140         this_arg_conv.is_owned = false;
48141         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48142         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
48143         return tag_ptr(ret_ret, true);
48144 }
48145
48146 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
48147         LDKMultiThreadedScoreLock obj_conv;
48148         obj_conv.inner = untag_ptr(obj);
48149         obj_conv.is_owned = ptr_is_owned(obj);
48150         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48151         obj_conv.is_owned = false;
48152         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
48153         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48154         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48155         CVec_u8Z_free(ret_var);
48156         return ret_arr;
48157 }
48158
48159 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
48160         LDKMultiThreadedLockableScore this_arg_conv;
48161         this_arg_conv.inner = untag_ptr(this_arg);
48162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48164         this_arg_conv.is_owned = false;
48165         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
48166         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
48167         return tag_ptr(ret_ret, true);
48168 }
48169
48170 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
48171         LDKMultiThreadedLockableScore obj_conv;
48172         obj_conv.inner = untag_ptr(obj);
48173         obj_conv.is_owned = ptr_is_owned(obj);
48174         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48175         obj_conv.is_owned = false;
48176         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
48177         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48178         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48179         CVec_u8Z_free(ret_var);
48180         return ret_arr;
48181 }
48182
48183 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
48184         LDKMultiThreadedLockableScore this_arg_conv;
48185         this_arg_conv.inner = untag_ptr(this_arg);
48186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48188         this_arg_conv.is_owned = false;
48189         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
48190         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
48191         return tag_ptr(ret_ret, true);
48192 }
48193
48194 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
48195         void* score_ptr = untag_ptr(score);
48196         CHECK_ACCESS(score_ptr);
48197         LDKScore score_conv = *(LDKScore*)(score_ptr);
48198         if (score_conv.free == LDKScore_JCalls_free) {
48199                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48200                 LDKScore_JCalls_cloned(&score_conv);
48201         }
48202         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
48203         uint64_t ret_ref = 0;
48204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48206         return ret_ref;
48207 }
48208
48209 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
48210         LDKChannelUsage this_obj_conv;
48211         this_obj_conv.inner = untag_ptr(this_obj);
48212         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48214         ChannelUsage_free(this_obj_conv);
48215 }
48216
48217 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
48218         LDKChannelUsage this_ptr_conv;
48219         this_ptr_conv.inner = untag_ptr(this_ptr);
48220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48222         this_ptr_conv.is_owned = false;
48223         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
48224         return ret_conv;
48225 }
48226
48227 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
48228         LDKChannelUsage this_ptr_conv;
48229         this_ptr_conv.inner = untag_ptr(this_ptr);
48230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48232         this_ptr_conv.is_owned = false;
48233         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
48234 }
48235
48236 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
48237         LDKChannelUsage this_ptr_conv;
48238         this_ptr_conv.inner = untag_ptr(this_ptr);
48239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48241         this_ptr_conv.is_owned = false;
48242         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
48243         return ret_conv;
48244 }
48245
48246 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
48247         LDKChannelUsage this_ptr_conv;
48248         this_ptr_conv.inner = untag_ptr(this_ptr);
48249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48251         this_ptr_conv.is_owned = false;
48252         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
48253 }
48254
48255 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
48256         LDKChannelUsage this_ptr_conv;
48257         this_ptr_conv.inner = untag_ptr(this_ptr);
48258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48260         this_ptr_conv.is_owned = false;
48261         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48262         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
48263         uint64_t ret_ref = tag_ptr(ret_copy, true);
48264         return ret_ref;
48265 }
48266
48267 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
48268         LDKChannelUsage this_ptr_conv;
48269         this_ptr_conv.inner = untag_ptr(this_ptr);
48270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48272         this_ptr_conv.is_owned = false;
48273         void* val_ptr = untag_ptr(val);
48274         CHECK_ACCESS(val_ptr);
48275         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
48276         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
48277         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
48278 }
48279
48280 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) {
48281         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
48282         CHECK_ACCESS(effective_capacity_arg_ptr);
48283         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
48284         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
48285         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
48286         uint64_t ret_ref = 0;
48287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48289         return ret_ref;
48290 }
48291
48292 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
48293         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
48294         uint64_t ret_ref = 0;
48295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48297         return ret_ref;
48298 }
48299 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
48300         LDKChannelUsage arg_conv;
48301         arg_conv.inner = untag_ptr(arg);
48302         arg_conv.is_owned = ptr_is_owned(arg);
48303         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48304         arg_conv.is_owned = false;
48305         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
48306         return ret_conv;
48307 }
48308
48309 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
48310         LDKChannelUsage orig_conv;
48311         orig_conv.inner = untag_ptr(orig);
48312         orig_conv.is_owned = ptr_is_owned(orig);
48313         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48314         orig_conv.is_owned = false;
48315         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
48316         uint64_t ret_ref = 0;
48317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48319         return ret_ref;
48320 }
48321
48322 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
48323         LDKFixedPenaltyScorer this_obj_conv;
48324         this_obj_conv.inner = untag_ptr(this_obj);
48325         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48327         FixedPenaltyScorer_free(this_obj_conv);
48328 }
48329
48330 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
48331         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
48332         uint64_t ret_ref = 0;
48333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48335         return ret_ref;
48336 }
48337 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
48338         LDKFixedPenaltyScorer arg_conv;
48339         arg_conv.inner = untag_ptr(arg);
48340         arg_conv.is_owned = ptr_is_owned(arg);
48341         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48342         arg_conv.is_owned = false;
48343         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
48344         return ret_conv;
48345 }
48346
48347 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
48348         LDKFixedPenaltyScorer orig_conv;
48349         orig_conv.inner = untag_ptr(orig);
48350         orig_conv.is_owned = ptr_is_owned(orig);
48351         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48352         orig_conv.is_owned = false;
48353         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
48354         uint64_t ret_ref = 0;
48355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48357         return ret_ref;
48358 }
48359
48360 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
48361         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
48362         uint64_t ret_ref = 0;
48363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48365         return ret_ref;
48366 }
48367
48368 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
48369         LDKFixedPenaltyScorer this_arg_conv;
48370         this_arg_conv.inner = untag_ptr(this_arg);
48371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48373         this_arg_conv.is_owned = false;
48374         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48375         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
48376         return tag_ptr(ret_ret, true);
48377 }
48378
48379 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
48380         LDKFixedPenaltyScorer obj_conv;
48381         obj_conv.inner = untag_ptr(obj);
48382         obj_conv.is_owned = ptr_is_owned(obj);
48383         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48384         obj_conv.is_owned = false;
48385         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
48386         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48387         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48388         CVec_u8Z_free(ret_var);
48389         return ret_arr;
48390 }
48391
48392 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
48393         LDKu8slice ser_ref;
48394         ser_ref.datalen = ser->arr_len;
48395         ser_ref.data = ser->elems;
48396         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
48397         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
48398         FREE(ser);
48399         return tag_ptr(ret_conv, true);
48400 }
48401
48402 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
48403         LDKProbabilisticScorer this_obj_conv;
48404         this_obj_conv.inner = untag_ptr(this_obj);
48405         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48407         ProbabilisticScorer_free(this_obj_conv);
48408 }
48409
48410 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
48411         LDKProbabilisticScoringParameters this_obj_conv;
48412         this_obj_conv.inner = untag_ptr(this_obj);
48413         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48415         ProbabilisticScoringParameters_free(this_obj_conv);
48416 }
48417
48418 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
48419         LDKProbabilisticScoringParameters this_ptr_conv;
48420         this_ptr_conv.inner = untag_ptr(this_ptr);
48421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48423         this_ptr_conv.is_owned = false;
48424         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
48425         return ret_conv;
48426 }
48427
48428 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
48429         LDKProbabilisticScoringParameters this_ptr_conv;
48430         this_ptr_conv.inner = untag_ptr(this_ptr);
48431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48433         this_ptr_conv.is_owned = false;
48434         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
48435 }
48436
48437 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) {
48438         LDKProbabilisticScoringParameters this_ptr_conv;
48439         this_ptr_conv.inner = untag_ptr(this_ptr);
48440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48442         this_ptr_conv.is_owned = false;
48443         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
48444         return ret_conv;
48445 }
48446
48447 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) {
48448         LDKProbabilisticScoringParameters this_ptr_conv;
48449         this_ptr_conv.inner = untag_ptr(this_ptr);
48450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48452         this_ptr_conv.is_owned = false;
48453         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48454 }
48455
48456 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
48457         LDKProbabilisticScoringParameters this_ptr_conv;
48458         this_ptr_conv.inner = untag_ptr(this_ptr);
48459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48461         this_ptr_conv.is_owned = false;
48462         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
48463         return ret_conv;
48464 }
48465
48466 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) {
48467         LDKProbabilisticScoringParameters this_ptr_conv;
48468         this_ptr_conv.inner = untag_ptr(this_ptr);
48469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48471         this_ptr_conv.is_owned = false;
48472         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
48473 }
48474
48475 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
48476         LDKProbabilisticScoringParameters this_ptr_conv;
48477         this_ptr_conv.inner = untag_ptr(this_ptr);
48478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48480         this_ptr_conv.is_owned = false;
48481         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
48482         return ret_conv;
48483 }
48484
48485 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) {
48486         LDKProbabilisticScoringParameters this_ptr_conv;
48487         this_ptr_conv.inner = untag_ptr(this_ptr);
48488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48490         this_ptr_conv.is_owned = false;
48491         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
48492 }
48493
48494 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) {
48495         LDKProbabilisticScoringParameters this_ptr_conv;
48496         this_ptr_conv.inner = untag_ptr(this_ptr);
48497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48499         this_ptr_conv.is_owned = false;
48500         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
48501         return ret_conv;
48502 }
48503
48504 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) {
48505         LDKProbabilisticScoringParameters this_ptr_conv;
48506         this_ptr_conv.inner = untag_ptr(this_ptr);
48507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48509         this_ptr_conv.is_owned = false;
48510         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48511 }
48512
48513 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) {
48514         LDKProbabilisticScoringParameters this_ptr_conv;
48515         this_ptr_conv.inner = untag_ptr(this_ptr);
48516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48518         this_ptr_conv.is_owned = false;
48519         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
48520         return ret_conv;
48521 }
48522
48523 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) {
48524         LDKProbabilisticScoringParameters this_ptr_conv;
48525         this_ptr_conv.inner = untag_ptr(this_ptr);
48526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48528         this_ptr_conv.is_owned = false;
48529         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
48530 }
48531
48532 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) {
48533         LDKProbabilisticScoringParameters this_ptr_conv;
48534         this_ptr_conv.inner = untag_ptr(this_ptr);
48535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48537         this_ptr_conv.is_owned = false;
48538         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
48539         return ret_conv;
48540 }
48541
48542 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) {
48543         LDKProbabilisticScoringParameters this_ptr_conv;
48544         this_ptr_conv.inner = untag_ptr(this_ptr);
48545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48547         this_ptr_conv.is_owned = false;
48548         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48549 }
48550
48551 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) {
48552         LDKProbabilisticScoringParameters this_ptr_conv;
48553         this_ptr_conv.inner = untag_ptr(this_ptr);
48554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48556         this_ptr_conv.is_owned = false;
48557         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
48558         return ret_conv;
48559 }
48560
48561 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) {
48562         LDKProbabilisticScoringParameters this_ptr_conv;
48563         this_ptr_conv.inner = untag_ptr(this_ptr);
48564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48566         this_ptr_conv.is_owned = false;
48567         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
48568 }
48569
48570 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
48571         LDKProbabilisticScoringParameters this_ptr_conv;
48572         this_ptr_conv.inner = untag_ptr(this_ptr);
48573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48575         this_ptr_conv.is_owned = false;
48576         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
48577         return ret_conv;
48578 }
48579
48580 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) {
48581         LDKProbabilisticScoringParameters this_ptr_conv;
48582         this_ptr_conv.inner = untag_ptr(this_ptr);
48583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48585         this_ptr_conv.is_owned = false;
48586         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
48587 }
48588
48589 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
48590         LDKProbabilisticScoringParameters this_ptr_conv;
48591         this_ptr_conv.inner = untag_ptr(this_ptr);
48592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48594         this_ptr_conv.is_owned = false;
48595         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
48596         return ret_conv;
48597 }
48598
48599 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) {
48600         LDKProbabilisticScoringParameters this_ptr_conv;
48601         this_ptr_conv.inner = untag_ptr(this_ptr);
48602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48604         this_ptr_conv.is_owned = false;
48605         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
48606 }
48607
48608 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
48609         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
48610         uint64_t ret_ref = 0;
48611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48613         return ret_ref;
48614 }
48615 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
48616         LDKProbabilisticScoringParameters arg_conv;
48617         arg_conv.inner = untag_ptr(arg);
48618         arg_conv.is_owned = ptr_is_owned(arg);
48619         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48620         arg_conv.is_owned = false;
48621         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
48622         return ret_conv;
48623 }
48624
48625 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
48626         LDKProbabilisticScoringParameters orig_conv;
48627         orig_conv.inner = untag_ptr(orig);
48628         orig_conv.is_owned = ptr_is_owned(orig);
48629         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48630         orig_conv.is_owned = false;
48631         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
48632         uint64_t ret_ref = 0;
48633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48635         return ret_ref;
48636 }
48637
48638 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
48639         LDKProbabilisticScoringParameters params_conv;
48640         params_conv.inner = untag_ptr(params);
48641         params_conv.is_owned = ptr_is_owned(params);
48642         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
48643         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
48644         LDKNetworkGraph network_graph_conv;
48645         network_graph_conv.inner = untag_ptr(network_graph);
48646         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48647         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48648         network_graph_conv.is_owned = false;
48649         void* logger_ptr = untag_ptr(logger);
48650         CHECK_ACCESS(logger_ptr);
48651         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48652         if (logger_conv.free == LDKLogger_JCalls_free) {
48653                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48654                 LDKLogger_JCalls_cloned(&logger_conv);
48655         }
48656         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
48657         uint64_t ret_ref = 0;
48658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48660         return ret_ref;
48661 }
48662
48663 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
48664         LDKProbabilisticScorer this_arg_conv;
48665         this_arg_conv.inner = untag_ptr(this_arg);
48666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48668         this_arg_conv.is_owned = false;
48669         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
48670 }
48671
48672 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) {
48673         LDKProbabilisticScorer this_arg_conv;
48674         this_arg_conv.inner = untag_ptr(this_arg);
48675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48677         this_arg_conv.is_owned = false;
48678         LDKNodeId target_conv;
48679         target_conv.inner = untag_ptr(target);
48680         target_conv.is_owned = ptr_is_owned(target);
48681         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
48682         target_conv.is_owned = false;
48683         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
48684         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
48685         uint64_t ret_ref = tag_ptr(ret_copy, true);
48686         return ret_ref;
48687 }
48688
48689 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) {
48690         LDKProbabilisticScorer this_arg_conv;
48691         this_arg_conv.inner = untag_ptr(this_arg);
48692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48694         this_arg_conv.is_owned = false;
48695         LDKNodeId target_conv;
48696         target_conv.inner = untag_ptr(target);
48697         target_conv.is_owned = ptr_is_owned(target);
48698         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
48699         target_conv.is_owned = false;
48700         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
48701         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
48702         uint64_t ret_ref = tag_ptr(ret_copy, true);
48703         return ret_ref;
48704 }
48705
48706 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
48707         LDKProbabilisticScorer this_arg_conv;
48708         this_arg_conv.inner = untag_ptr(this_arg);
48709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48711         this_arg_conv.is_owned = false;
48712         LDKNodeId node_id_conv;
48713         node_id_conv.inner = untag_ptr(node_id);
48714         node_id_conv.is_owned = ptr_is_owned(node_id);
48715         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48716         node_id_conv.is_owned = false;
48717         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
48718 }
48719
48720 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
48721         LDKProbabilisticScorer this_arg_conv;
48722         this_arg_conv.inner = untag_ptr(this_arg);
48723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48725         this_arg_conv.is_owned = false;
48726         LDKNodeId node_id_conv;
48727         node_id_conv.inner = untag_ptr(node_id);
48728         node_id_conv.is_owned = ptr_is_owned(node_id);
48729         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48730         node_id_conv.is_owned = false;
48731         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
48732 }
48733
48734 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) {
48735         LDKProbabilisticScorer this_arg_conv;
48736         this_arg_conv.inner = untag_ptr(this_arg);
48737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48739         this_arg_conv.is_owned = false;
48740         LDKNodeId node_id_conv;
48741         node_id_conv.inner = untag_ptr(node_id);
48742         node_id_conv.is_owned = ptr_is_owned(node_id);
48743         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48744         node_id_conv.is_owned = false;
48745         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
48746 }
48747
48748 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
48749         LDKProbabilisticScorer this_arg_conv;
48750         this_arg_conv.inner = untag_ptr(this_arg);
48751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48753         this_arg_conv.is_owned = false;
48754         LDKNodeId node_id_conv;
48755         node_id_conv.inner = untag_ptr(node_id);
48756         node_id_conv.is_owned = ptr_is_owned(node_id);
48757         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48758         node_id_conv.is_owned = false;
48759         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
48760 }
48761
48762 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
48763         LDKProbabilisticScorer this_arg_conv;
48764         this_arg_conv.inner = untag_ptr(this_arg);
48765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48767         this_arg_conv.is_owned = false;
48768         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
48769 }
48770
48771 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
48772         LDKProbabilisticScoringParameters this_arg_conv;
48773         this_arg_conv.inner = untag_ptr(this_arg);
48774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48776         this_arg_conv.is_owned = false;
48777         LDKCVec_NodeIdZ node_ids_constr;
48778         node_ids_constr.datalen = node_ids->arr_len;
48779         if (node_ids_constr.datalen > 0)
48780                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
48781         else
48782                 node_ids_constr.data = NULL;
48783         uint64_t* node_ids_vals = node_ids->elems;
48784         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
48785                 uint64_t node_ids_conv_8 = node_ids_vals[i];
48786                 LDKNodeId node_ids_conv_8_conv;
48787                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
48788                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
48789                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
48790                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
48791                 node_ids_constr.data[i] = node_ids_conv_8_conv;
48792         }
48793         FREE(node_ids);
48794         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
48795 }
48796
48797 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
48798         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
48799         uint64_t ret_ref = 0;
48800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48802         return ret_ref;
48803 }
48804
48805 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
48806         LDKProbabilisticScorer this_arg_conv;
48807         this_arg_conv.inner = untag_ptr(this_arg);
48808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48810         this_arg_conv.is_owned = false;
48811         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48812         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
48813         return tag_ptr(ret_ret, true);
48814 }
48815
48816 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
48817         LDKProbabilisticScorer obj_conv;
48818         obj_conv.inner = untag_ptr(obj);
48819         obj_conv.is_owned = ptr_is_owned(obj);
48820         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48821         obj_conv.is_owned = false;
48822         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
48823         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48824         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48825         CVec_u8Z_free(ret_var);
48826         return ret_arr;
48827 }
48828
48829 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) {
48830         LDKu8slice ser_ref;
48831         ser_ref.datalen = ser->arr_len;
48832         ser_ref.data = ser->elems;
48833         LDKProbabilisticScoringParameters arg_a_conv;
48834         arg_a_conv.inner = untag_ptr(arg_a);
48835         arg_a_conv.is_owned = ptr_is_owned(arg_a);
48836         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
48837         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
48838         LDKNetworkGraph arg_b_conv;
48839         arg_b_conv.inner = untag_ptr(arg_b);
48840         arg_b_conv.is_owned = ptr_is_owned(arg_b);
48841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
48842         arg_b_conv.is_owned = false;
48843         void* arg_c_ptr = untag_ptr(arg_c);
48844         CHECK_ACCESS(arg_c_ptr);
48845         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
48846         if (arg_c_conv.free == LDKLogger_JCalls_free) {
48847                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48848                 LDKLogger_JCalls_cloned(&arg_c_conv);
48849         }
48850         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
48851         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
48852         FREE(ser);
48853         return tag_ptr(ret_conv, true);
48854 }
48855
48856 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
48857         LDKOnionMessenger this_obj_conv;
48858         this_obj_conv.inner = untag_ptr(this_obj);
48859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48861         OnionMessenger_free(this_obj_conv);
48862 }
48863
48864 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
48865         if (!ptr_is_owned(this_ptr)) return;
48866         void* this_ptr_ptr = untag_ptr(this_ptr);
48867         CHECK_ACCESS(this_ptr_ptr);
48868         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
48869         FREE(untag_ptr(this_ptr));
48870         Destination_free(this_ptr_conv);
48871 }
48872
48873 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
48874         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48875         *ret_copy = Destination_clone(arg);
48876         uint64_t ret_ref = tag_ptr(ret_copy, true);
48877         return ret_ref;
48878 }
48879 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
48880         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
48881         int64_t ret_conv = Destination_clone_ptr(arg_conv);
48882         return ret_conv;
48883 }
48884
48885 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
48886         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
48887         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48888         *ret_copy = Destination_clone(orig_conv);
48889         uint64_t ret_ref = tag_ptr(ret_copy, true);
48890         return ret_ref;
48891 }
48892
48893 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
48894         LDKPublicKey a_ref;
48895         CHECK(a->arr_len == 33);
48896         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
48897         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48898         *ret_copy = Destination_node(a_ref);
48899         uint64_t ret_ref = tag_ptr(ret_copy, true);
48900         return ret_ref;
48901 }
48902
48903 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
48904         LDKBlindedPath a_conv;
48905         a_conv.inner = untag_ptr(a);
48906         a_conv.is_owned = ptr_is_owned(a);
48907         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48908         a_conv = BlindedPath_clone(&a_conv);
48909         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48910         *ret_copy = Destination_blinded_path(a_conv);
48911         uint64_t ret_ref = tag_ptr(ret_copy, true);
48912         return ret_ref;
48913 }
48914
48915 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
48916         if (!ptr_is_owned(this_ptr)) return;
48917         void* this_ptr_ptr = untag_ptr(this_ptr);
48918         CHECK_ACCESS(this_ptr_ptr);
48919         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
48920         FREE(untag_ptr(this_ptr));
48921         SendError_free(this_ptr_conv);
48922 }
48923
48924 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
48925         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48926         *ret_copy = SendError_clone(arg);
48927         uint64_t ret_ref = tag_ptr(ret_copy, true);
48928         return ret_ref;
48929 }
48930 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
48931         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
48932         int64_t ret_conv = SendError_clone_ptr(arg_conv);
48933         return ret_conv;
48934 }
48935
48936 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
48937         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
48938         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48939         *ret_copy = SendError_clone(orig_conv);
48940         uint64_t ret_ref = tag_ptr(ret_copy, true);
48941         return ret_ref;
48942 }
48943
48944 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
48945         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
48946         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48947         *ret_copy = SendError_secp256k1(a_conv);
48948         uint64_t ret_ref = tag_ptr(ret_copy, true);
48949         return ret_ref;
48950 }
48951
48952 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
48953         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48954         *ret_copy = SendError_too_big_packet();
48955         uint64_t ret_ref = tag_ptr(ret_copy, true);
48956         return ret_ref;
48957 }
48958
48959 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
48960         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48961         *ret_copy = SendError_too_few_blinded_hops();
48962         uint64_t ret_ref = tag_ptr(ret_copy, true);
48963         return ret_ref;
48964 }
48965
48966 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
48967         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48968         *ret_copy = SendError_invalid_first_hop();
48969         uint64_t ret_ref = tag_ptr(ret_copy, true);
48970         return ret_ref;
48971 }
48972
48973 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
48974         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48975         *ret_copy = SendError_invalid_message();
48976         uint64_t ret_ref = tag_ptr(ret_copy, true);
48977         return ret_ref;
48978 }
48979
48980 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
48981         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48982         *ret_copy = SendError_buffer_full();
48983         uint64_t ret_ref = tag_ptr(ret_copy, true);
48984         return ret_ref;
48985 }
48986
48987 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
48988         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48989         *ret_copy = SendError_get_node_id_failed();
48990         uint64_t ret_ref = tag_ptr(ret_copy, true);
48991         return ret_ref;
48992 }
48993
48994 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
48995         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48996         *ret_copy = SendError_blinded_path_advance_failed();
48997         uint64_t ret_ref = tag_ptr(ret_copy, true);
48998         return ret_ref;
48999 }
49000
49001 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
49002         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
49003         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
49004         jboolean ret_conv = SendError_eq(a_conv, b_conv);
49005         return ret_conv;
49006 }
49007
49008 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
49009         if (!ptr_is_owned(this_ptr)) return;
49010         void* this_ptr_ptr = untag_ptr(this_ptr);
49011         CHECK_ACCESS(this_ptr_ptr);
49012         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
49013         FREE(untag_ptr(this_ptr));
49014         CustomOnionMessageHandler_free(this_ptr_conv);
49015 }
49016
49017 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) {
49018         void* entropy_source_ptr = untag_ptr(entropy_source);
49019         CHECK_ACCESS(entropy_source_ptr);
49020         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
49021         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
49022                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49023                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
49024         }
49025         void* node_signer_ptr = untag_ptr(node_signer);
49026         CHECK_ACCESS(node_signer_ptr);
49027         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
49028         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
49029                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49030                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
49031         }
49032         void* logger_ptr = untag_ptr(logger);
49033         CHECK_ACCESS(logger_ptr);
49034         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49035         if (logger_conv.free == LDKLogger_JCalls_free) {
49036                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49037                 LDKLogger_JCalls_cloned(&logger_conv);
49038         }
49039         void* custom_handler_ptr = untag_ptr(custom_handler);
49040         CHECK_ACCESS(custom_handler_ptr);
49041         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
49042         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
49043                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49044                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
49045         }
49046         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_conv);
49047         uint64_t ret_ref = 0;
49048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49050         return ret_ref;
49051 }
49052
49053 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) {
49054         LDKOnionMessenger this_arg_conv;
49055         this_arg_conv.inner = untag_ptr(this_arg);
49056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49058         this_arg_conv.is_owned = false;
49059         LDKCVec_PublicKeyZ intermediate_nodes_constr;
49060         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
49061         if (intermediate_nodes_constr.datalen > 0)
49062                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
49063         else
49064                 intermediate_nodes_constr.data = NULL;
49065         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
49066         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
49067                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
49068                 LDKPublicKey intermediate_nodes_conv_12_ref;
49069                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
49070                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
49071                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
49072         }
49073         FREE(intermediate_nodes);
49074         void* destination_ptr = untag_ptr(destination);
49075         CHECK_ACCESS(destination_ptr);
49076         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
49077         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
49078         void* message_ptr = untag_ptr(message);
49079         CHECK_ACCESS(message_ptr);
49080         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
49081         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
49082         LDKBlindedPath reply_path_conv;
49083         reply_path_conv.inner = untag_ptr(reply_path);
49084         reply_path_conv.is_owned = ptr_is_owned(reply_path);
49085         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
49086         reply_path_conv = BlindedPath_clone(&reply_path_conv);
49087         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
49088         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
49089         return tag_ptr(ret_conv, true);
49090 }
49091
49092 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
49093         LDKOnionMessenger this_arg_conv;
49094         this_arg_conv.inner = untag_ptr(this_arg);
49095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49097         this_arg_conv.is_owned = false;
49098         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
49099         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
49100         return tag_ptr(ret_ret, true);
49101 }
49102
49103 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
49104         LDKOnionMessenger this_arg_conv;
49105         this_arg_conv.inner = untag_ptr(this_arg);
49106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49108         this_arg_conv.is_owned = false;
49109         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
49110         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
49111         return tag_ptr(ret_ret, true);
49112 }
49113
49114 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
49115         if (!ptr_is_owned(this_ptr)) return;
49116         void* this_ptr_ptr = untag_ptr(this_ptr);
49117         CHECK_ACCESS(this_ptr_ptr);
49118         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
49119         FREE(untag_ptr(this_ptr));
49120         OnionMessageContents_free(this_ptr_conv);
49121 }
49122
49123 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
49124         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49125         *ret_copy = OnionMessageContents_clone(arg);
49126         uint64_t ret_ref = tag_ptr(ret_copy, true);
49127         return ret_ref;
49128 }
49129 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
49130         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
49131         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
49132         return ret_conv;
49133 }
49134
49135 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
49136         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
49137         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49138         *ret_copy = OnionMessageContents_clone(orig_conv);
49139         uint64_t ret_ref = tag_ptr(ret_copy, true);
49140         return ret_ref;
49141 }
49142
49143 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
49144         void* a_ptr = untag_ptr(a);
49145         CHECK_ACCESS(a_ptr);
49146         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
49147         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
49148                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49149                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
49150         }
49151         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49152         *ret_copy = OnionMessageContents_custom(a_conv);
49153         uint64_t ret_ref = tag_ptr(ret_copy, true);
49154         return ret_ref;
49155 }
49156
49157 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
49158         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
49159         *ret_ret = CustomOnionMessageContents_clone(arg);
49160         return tag_ptr(ret_ret, true);
49161 }
49162 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
49163         void* arg_ptr = untag_ptr(arg);
49164         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
49165         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
49166         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
49167         return ret_conv;
49168 }
49169
49170 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
49171         void* orig_ptr = untag_ptr(orig);
49172         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
49173         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
49174         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
49175         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
49176         return tag_ptr(ret_ret, true);
49177 }
49178
49179 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
49180         if (!ptr_is_owned(this_ptr)) return;
49181         void* this_ptr_ptr = untag_ptr(this_ptr);
49182         CHECK_ACCESS(this_ptr_ptr);
49183         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
49184         FREE(untag_ptr(this_ptr));
49185         CustomOnionMessageContents_free(this_ptr_conv);
49186 }
49187
49188 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
49189         LDKBlindedPath this_obj_conv;
49190         this_obj_conv.inner = untag_ptr(this_obj);
49191         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49193         BlindedPath_free(this_obj_conv);
49194 }
49195
49196 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
49197         LDKBlindedPath ret_var = BlindedPath_clone(arg);
49198         uint64_t ret_ref = 0;
49199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49201         return ret_ref;
49202 }
49203 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
49204         LDKBlindedPath arg_conv;
49205         arg_conv.inner = untag_ptr(arg);
49206         arg_conv.is_owned = ptr_is_owned(arg);
49207         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49208         arg_conv.is_owned = false;
49209         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
49210         return ret_conv;
49211 }
49212
49213 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
49214         LDKBlindedPath orig_conv;
49215         orig_conv.inner = untag_ptr(orig);
49216         orig_conv.is_owned = ptr_is_owned(orig);
49217         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49218         orig_conv.is_owned = false;
49219         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
49220         uint64_t ret_ref = 0;
49221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49223         return ret_ref;
49224 }
49225
49226 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
49227         LDKBlindedPath o_conv;
49228         o_conv.inner = untag_ptr(o);
49229         o_conv.is_owned = ptr_is_owned(o);
49230         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49231         o_conv.is_owned = false;
49232         int64_t ret_conv = BlindedPath_hash(&o_conv);
49233         return ret_conv;
49234 }
49235
49236 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
49237         LDKBlindedPath a_conv;
49238         a_conv.inner = untag_ptr(a);
49239         a_conv.is_owned = ptr_is_owned(a);
49240         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49241         a_conv.is_owned = false;
49242         LDKBlindedPath b_conv;
49243         b_conv.inner = untag_ptr(b);
49244         b_conv.is_owned = ptr_is_owned(b);
49245         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49246         b_conv.is_owned = false;
49247         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
49248         return ret_conv;
49249 }
49250
49251 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
49252         LDKBlindedHop this_obj_conv;
49253         this_obj_conv.inner = untag_ptr(this_obj);
49254         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49256         BlindedHop_free(this_obj_conv);
49257 }
49258
49259 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
49260         LDKBlindedHop ret_var = BlindedHop_clone(arg);
49261         uint64_t ret_ref = 0;
49262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49264         return ret_ref;
49265 }
49266 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
49267         LDKBlindedHop arg_conv;
49268         arg_conv.inner = untag_ptr(arg);
49269         arg_conv.is_owned = ptr_is_owned(arg);
49270         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49271         arg_conv.is_owned = false;
49272         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
49273         return ret_conv;
49274 }
49275
49276 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
49277         LDKBlindedHop orig_conv;
49278         orig_conv.inner = untag_ptr(orig);
49279         orig_conv.is_owned = ptr_is_owned(orig);
49280         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49281         orig_conv.is_owned = false;
49282         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
49283         uint64_t ret_ref = 0;
49284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49286         return ret_ref;
49287 }
49288
49289 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
49290         LDKBlindedHop o_conv;
49291         o_conv.inner = untag_ptr(o);
49292         o_conv.is_owned = ptr_is_owned(o);
49293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49294         o_conv.is_owned = false;
49295         int64_t ret_conv = BlindedHop_hash(&o_conv);
49296         return ret_conv;
49297 }
49298
49299 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
49300         LDKBlindedHop a_conv;
49301         a_conv.inner = untag_ptr(a);
49302         a_conv.is_owned = ptr_is_owned(a);
49303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49304         a_conv.is_owned = false;
49305         LDKBlindedHop b_conv;
49306         b_conv.inner = untag_ptr(b);
49307         b_conv.is_owned = ptr_is_owned(b);
49308         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49309         b_conv.is_owned = false;
49310         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
49311         return ret_conv;
49312 }
49313
49314 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
49315         LDKCVec_PublicKeyZ node_pks_constr;
49316         node_pks_constr.datalen = node_pks->arr_len;
49317         if (node_pks_constr.datalen > 0)
49318                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
49319         else
49320                 node_pks_constr.data = NULL;
49321         int8_tArray* node_pks_vals = (void*) node_pks->elems;
49322         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
49323                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
49324                 LDKPublicKey node_pks_conv_12_ref;
49325                 CHECK(node_pks_conv_12->arr_len == 33);
49326                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
49327                 node_pks_constr.data[m] = node_pks_conv_12_ref;
49328         }
49329         FREE(node_pks);
49330         void* entropy_source_ptr = untag_ptr(entropy_source);
49331         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49332         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49333         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
49334         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
49335         return tag_ptr(ret_conv, true);
49336 }
49337
49338 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
49339         LDKBlindedPath obj_conv;
49340         obj_conv.inner = untag_ptr(obj);
49341         obj_conv.is_owned = ptr_is_owned(obj);
49342         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49343         obj_conv.is_owned = false;
49344         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
49345         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49346         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49347         CVec_u8Z_free(ret_var);
49348         return ret_arr;
49349 }
49350
49351 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
49352         LDKu8slice ser_ref;
49353         ser_ref.datalen = ser->arr_len;
49354         ser_ref.data = ser->elems;
49355         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
49356         *ret_conv = BlindedPath_read(ser_ref);
49357         FREE(ser);
49358         return tag_ptr(ret_conv, true);
49359 }
49360
49361 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
49362         LDKBlindedHop obj_conv;
49363         obj_conv.inner = untag_ptr(obj);
49364         obj_conv.is_owned = ptr_is_owned(obj);
49365         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49366         obj_conv.is_owned = false;
49367         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
49368         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49369         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49370         CVec_u8Z_free(ret_var);
49371         return ret_arr;
49372 }
49373
49374 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
49375         LDKu8slice ser_ref;
49376         ser_ref.datalen = ser->arr_len;
49377         ser_ref.data = ser->elems;
49378         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
49379         *ret_conv = BlindedHop_read(ser_ref);
49380         FREE(ser);
49381         return tag_ptr(ret_conv, true);
49382 }
49383
49384 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
49385         if (!ptr_is_owned(this_ptr)) return;
49386         void* this_ptr_ptr = untag_ptr(this_ptr);
49387         CHECK_ACCESS(this_ptr_ptr);
49388         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
49389         FREE(untag_ptr(this_ptr));
49390         PaymentPurpose_free(this_ptr_conv);
49391 }
49392
49393 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
49394         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49395         *ret_copy = PaymentPurpose_clone(arg);
49396         uint64_t ret_ref = tag_ptr(ret_copy, true);
49397         return ret_ref;
49398 }
49399 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
49400         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
49401         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
49402         return ret_conv;
49403 }
49404
49405 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
49406         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
49407         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49408         *ret_copy = PaymentPurpose_clone(orig_conv);
49409         uint64_t ret_ref = tag_ptr(ret_copy, true);
49410         return ret_ref;
49411 }
49412
49413 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
49414         LDKThirtyTwoBytes payment_preimage_ref;
49415         CHECK(payment_preimage->arr_len == 32);
49416         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
49417         LDKThirtyTwoBytes payment_secret_ref;
49418         CHECK(payment_secret->arr_len == 32);
49419         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
49420         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49421         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
49422         uint64_t ret_ref = tag_ptr(ret_copy, true);
49423         return ret_ref;
49424 }
49425
49426 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
49427         LDKThirtyTwoBytes a_ref;
49428         CHECK(a->arr_len == 32);
49429         memcpy(a_ref.data, a->elems, 32); FREE(a);
49430         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49431         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
49432         uint64_t ret_ref = tag_ptr(ret_copy, true);
49433         return ret_ref;
49434 }
49435
49436 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
49437         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
49438         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
49439         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
49440         return ret_conv;
49441 }
49442
49443 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
49444         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
49445         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
49446         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49447         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49448         CVec_u8Z_free(ret_var);
49449         return ret_arr;
49450 }
49451
49452 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
49453         LDKu8slice ser_ref;
49454         ser_ref.datalen = ser->arr_len;
49455         ser_ref.data = ser->elems;
49456         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
49457         *ret_conv = PaymentPurpose_read(ser_ref);
49458         FREE(ser);
49459         return tag_ptr(ret_conv, true);
49460 }
49461
49462 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
49463         if (!ptr_is_owned(this_ptr)) return;
49464         void* this_ptr_ptr = untag_ptr(this_ptr);
49465         CHECK_ACCESS(this_ptr_ptr);
49466         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
49467         FREE(untag_ptr(this_ptr));
49468         PathFailure_free(this_ptr_conv);
49469 }
49470
49471 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
49472         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49473         *ret_copy = PathFailure_clone(arg);
49474         uint64_t ret_ref = tag_ptr(ret_copy, true);
49475         return ret_ref;
49476 }
49477 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
49478         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
49479         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
49480         return ret_conv;
49481 }
49482
49483 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
49484         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
49485         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49486         *ret_copy = PathFailure_clone(orig_conv);
49487         uint64_t ret_ref = tag_ptr(ret_copy, true);
49488         return ret_ref;
49489 }
49490
49491 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
49492         void* err_ptr = untag_ptr(err);
49493         CHECK_ACCESS(err_ptr);
49494         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
49495         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
49496         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49497         *ret_copy = PathFailure_initial_send(err_conv);
49498         uint64_t ret_ref = tag_ptr(ret_copy, true);
49499         return ret_ref;
49500 }
49501
49502 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
49503         void* network_update_ptr = untag_ptr(network_update);
49504         CHECK_ACCESS(network_update_ptr);
49505         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
49506         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
49507         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49508         *ret_copy = PathFailure_on_path(network_update_conv);
49509         uint64_t ret_ref = tag_ptr(ret_copy, true);
49510         return ret_ref;
49511 }
49512
49513 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
49514         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
49515         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
49516         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
49517         return ret_conv;
49518 }
49519
49520 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
49521         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
49522         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
49523         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49524         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49525         CVec_u8Z_free(ret_var);
49526         return ret_arr;
49527 }
49528
49529 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
49530         LDKu8slice ser_ref;
49531         ser_ref.datalen = ser->arr_len;
49532         ser_ref.data = ser->elems;
49533         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
49534         *ret_conv = PathFailure_read(ser_ref);
49535         FREE(ser);
49536         return tag_ptr(ret_conv, true);
49537 }
49538
49539 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
49540         if (!ptr_is_owned(this_ptr)) return;
49541         void* this_ptr_ptr = untag_ptr(this_ptr);
49542         CHECK_ACCESS(this_ptr_ptr);
49543         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
49544         FREE(untag_ptr(this_ptr));
49545         ClosureReason_free(this_ptr_conv);
49546 }
49547
49548 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
49549         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49550         *ret_copy = ClosureReason_clone(arg);
49551         uint64_t ret_ref = tag_ptr(ret_copy, true);
49552         return ret_ref;
49553 }
49554 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
49555         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
49556         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
49557         return ret_conv;
49558 }
49559
49560 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
49561         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
49562         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49563         *ret_copy = ClosureReason_clone(orig_conv);
49564         uint64_t ret_ref = tag_ptr(ret_copy, true);
49565         return ret_ref;
49566 }
49567
49568 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
49569         LDKUntrustedString peer_msg_conv;
49570         peer_msg_conv.inner = untag_ptr(peer_msg);
49571         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
49572         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
49573         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
49574         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49575         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
49576         uint64_t ret_ref = tag_ptr(ret_copy, true);
49577         return ret_ref;
49578 }
49579
49580 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
49581         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49582         *ret_copy = ClosureReason_holder_force_closed();
49583         uint64_t ret_ref = tag_ptr(ret_copy, true);
49584         return ret_ref;
49585 }
49586
49587 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
49588         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49589         *ret_copy = ClosureReason_cooperative_closure();
49590         uint64_t ret_ref = tag_ptr(ret_copy, true);
49591         return ret_ref;
49592 }
49593
49594 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
49595         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49596         *ret_copy = ClosureReason_commitment_tx_confirmed();
49597         uint64_t ret_ref = tag_ptr(ret_copy, true);
49598         return ret_ref;
49599 }
49600
49601 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
49602         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49603         *ret_copy = ClosureReason_funding_timed_out();
49604         uint64_t ret_ref = tag_ptr(ret_copy, true);
49605         return ret_ref;
49606 }
49607
49608 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
49609         LDKStr err_conv = str_ref_to_owned_c(err);
49610         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49611         *ret_copy = ClosureReason_processing_error(err_conv);
49612         uint64_t ret_ref = tag_ptr(ret_copy, true);
49613         return ret_ref;
49614 }
49615
49616 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
49617         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49618         *ret_copy = ClosureReason_disconnected_peer();
49619         uint64_t ret_ref = tag_ptr(ret_copy, true);
49620         return ret_ref;
49621 }
49622
49623 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
49624         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49625         *ret_copy = ClosureReason_outdated_channel_manager();
49626         uint64_t ret_ref = tag_ptr(ret_copy, true);
49627         return ret_ref;
49628 }
49629
49630 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
49631         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
49632         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
49633         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
49634         return ret_conv;
49635 }
49636
49637 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
49638         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
49639         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
49640         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49641         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49642         CVec_u8Z_free(ret_var);
49643         return ret_arr;
49644 }
49645
49646 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
49647         LDKu8slice ser_ref;
49648         ser_ref.datalen = ser->arr_len;
49649         ser_ref.data = ser->elems;
49650         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
49651         *ret_conv = ClosureReason_read(ser_ref);
49652         FREE(ser);
49653         return tag_ptr(ret_conv, true);
49654 }
49655
49656 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
49657         if (!ptr_is_owned(this_ptr)) return;
49658         void* this_ptr_ptr = untag_ptr(this_ptr);
49659         CHECK_ACCESS(this_ptr_ptr);
49660         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
49661         FREE(untag_ptr(this_ptr));
49662         HTLCDestination_free(this_ptr_conv);
49663 }
49664
49665 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
49666         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49667         *ret_copy = HTLCDestination_clone(arg);
49668         uint64_t ret_ref = tag_ptr(ret_copy, true);
49669         return ret_ref;
49670 }
49671 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
49672         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
49673         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
49674         return ret_conv;
49675 }
49676
49677 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
49678         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
49679         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49680         *ret_copy = HTLCDestination_clone(orig_conv);
49681         uint64_t ret_ref = tag_ptr(ret_copy, true);
49682         return ret_ref;
49683 }
49684
49685 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
49686         LDKPublicKey node_id_ref;
49687         CHECK(node_id->arr_len == 33);
49688         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
49689         LDKThirtyTwoBytes channel_id_ref;
49690         CHECK(channel_id->arr_len == 32);
49691         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
49692         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49693         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
49694         uint64_t ret_ref = tag_ptr(ret_copy, true);
49695         return ret_ref;
49696 }
49697
49698 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
49699         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49700         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
49701         uint64_t ret_ref = tag_ptr(ret_copy, true);
49702         return ret_ref;
49703 }
49704
49705 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
49706         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49707         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
49708         uint64_t ret_ref = tag_ptr(ret_copy, true);
49709         return ret_ref;
49710 }
49711
49712 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
49713         LDKThirtyTwoBytes payment_hash_ref;
49714         CHECK(payment_hash->arr_len == 32);
49715         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49716         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49717         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
49718         uint64_t ret_ref = tag_ptr(ret_copy, true);
49719         return ret_ref;
49720 }
49721
49722 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
49723         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
49724         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
49725         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
49726         return ret_conv;
49727 }
49728
49729 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
49730         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
49731         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
49732         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49733         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49734         CVec_u8Z_free(ret_var);
49735         return ret_arr;
49736 }
49737
49738 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
49739         LDKu8slice ser_ref;
49740         ser_ref.datalen = ser->arr_len;
49741         ser_ref.data = ser->elems;
49742         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
49743         *ret_conv = HTLCDestination_read(ser_ref);
49744         FREE(ser);
49745         return tag_ptr(ret_conv, true);
49746 }
49747
49748 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
49749         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
49750         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
49751         return ret_conv;
49752 }
49753
49754 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
49755         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
49756         return ret_conv;
49757 }
49758
49759 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
49760         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
49761         return ret_conv;
49762 }
49763
49764 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
49765         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
49766         return ret_conv;
49767 }
49768
49769 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
49770         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
49771         return ret_conv;
49772 }
49773
49774 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
49775         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
49776         return ret_conv;
49777 }
49778
49779 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
49780         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
49781         return ret_conv;
49782 }
49783
49784 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
49785         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
49786         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
49787         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
49788         return ret_conv;
49789 }
49790
49791 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
49792         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
49793         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
49794         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49795         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49796         CVec_u8Z_free(ret_var);
49797         return ret_arr;
49798 }
49799
49800 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
49801         LDKu8slice ser_ref;
49802         ser_ref.datalen = ser->arr_len;
49803         ser_ref.data = ser->elems;
49804         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
49805         *ret_conv = PaymentFailureReason_read(ser_ref);
49806         FREE(ser);
49807         return tag_ptr(ret_conv, true);
49808 }
49809
49810 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
49811         if (!ptr_is_owned(this_ptr)) return;
49812         void* this_ptr_ptr = untag_ptr(this_ptr);
49813         CHECK_ACCESS(this_ptr_ptr);
49814         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
49815         FREE(untag_ptr(this_ptr));
49816         Event_free(this_ptr_conv);
49817 }
49818
49819 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
49820         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49821         *ret_copy = Event_clone(arg);
49822         uint64_t ret_ref = tag_ptr(ret_copy, true);
49823         return ret_ref;
49824 }
49825 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
49826         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
49827         int64_t ret_conv = Event_clone_ptr(arg_conv);
49828         return ret_conv;
49829 }
49830
49831 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
49832         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
49833         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49834         *ret_copy = Event_clone(orig_conv);
49835         uint64_t ret_ref = tag_ptr(ret_copy, true);
49836         return ret_ref;
49837 }
49838
49839 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) {
49840         LDKThirtyTwoBytes temporary_channel_id_ref;
49841         CHECK(temporary_channel_id->arr_len == 32);
49842         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
49843         LDKPublicKey counterparty_node_id_ref;
49844         CHECK(counterparty_node_id->arr_len == 33);
49845         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
49846         LDKCVec_u8Z output_script_ref;
49847         output_script_ref.datalen = output_script->arr_len;
49848         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
49849         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
49850         LDKU128 user_channel_id_ref;
49851         CHECK(user_channel_id->arr_len == 16);
49852         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
49853         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49854         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
49855         uint64_t ret_ref = tag_ptr(ret_copy, true);
49856         return ret_ref;
49857 }
49858
49859 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) {
49860         LDKPublicKey receiver_node_id_ref;
49861         CHECK(receiver_node_id->arr_len == 33);
49862         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
49863         LDKThirtyTwoBytes payment_hash_ref;
49864         CHECK(payment_hash->arr_len == 32);
49865         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49866         LDKRecipientOnionFields onion_fields_conv;
49867         onion_fields_conv.inner = untag_ptr(onion_fields);
49868         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
49869         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
49870         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
49871         void* purpose_ptr = untag_ptr(purpose);
49872         CHECK_ACCESS(purpose_ptr);
49873         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
49874         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
49875         LDKThirtyTwoBytes via_channel_id_ref;
49876         CHECK(via_channel_id->arr_len == 32);
49877         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
49878         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
49879         CHECK_ACCESS(via_user_channel_id_ptr);
49880         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
49881         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
49882         void* claim_deadline_ptr = untag_ptr(claim_deadline);
49883         CHECK_ACCESS(claim_deadline_ptr);
49884         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
49885         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
49886         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49887         *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);
49888         uint64_t ret_ref = tag_ptr(ret_copy, true);
49889         return ret_ref;
49890 }
49891
49892 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) {
49893         LDKPublicKey receiver_node_id_ref;
49894         CHECK(receiver_node_id->arr_len == 33);
49895         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
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* purpose_ptr = untag_ptr(purpose);
49900         CHECK_ACCESS(purpose_ptr);
49901         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
49902         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
49903         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49904         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_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_sent"))) TS_Event_payment_sent(int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, uint64_t fee_paid_msat) {
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_preimage_ref;
49914         CHECK(payment_preimage->arr_len == 32);
49915         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
49916         LDKThirtyTwoBytes payment_hash_ref;
49917         CHECK(payment_hash->arr_len == 32);
49918         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49919         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
49920         CHECK_ACCESS(fee_paid_msat_ptr);
49921         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
49922         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
49923         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49924         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
49925         uint64_t ret_ref = tag_ptr(ret_copy, true);
49926         return ret_ref;
49927 }
49928
49929 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
49930         LDKThirtyTwoBytes payment_id_ref;
49931         CHECK(payment_id->arr_len == 32);
49932         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49933         LDKThirtyTwoBytes payment_hash_ref;
49934         CHECK(payment_hash->arr_len == 32);
49935         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49936         void* reason_ptr = untag_ptr(reason);
49937         CHECK_ACCESS(reason_ptr);
49938         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
49939         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
49940         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49941         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
49942         uint64_t ret_ref = tag_ptr(ret_copy, true);
49943         return ret_ref;
49944 }
49945
49946 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) {
49947         LDKThirtyTwoBytes payment_id_ref;
49948         CHECK(payment_id->arr_len == 32);
49949         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49950         LDKThirtyTwoBytes payment_hash_ref;
49951         CHECK(payment_hash->arr_len == 32);
49952         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49953         LDKPath path_conv;
49954         path_conv.inner = untag_ptr(path);
49955         path_conv.is_owned = ptr_is_owned(path);
49956         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49957         path_conv = Path_clone(&path_conv);
49958         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49959         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_conv);
49960         uint64_t ret_ref = tag_ptr(ret_copy, true);
49961         return ret_ref;
49962 }
49963
49964 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) {
49965         LDKThirtyTwoBytes payment_id_ref;
49966         CHECK(payment_id->arr_len == 32);
49967         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49968         LDKThirtyTwoBytes payment_hash_ref;
49969         CHECK(payment_hash->arr_len == 32);
49970         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49971         void* failure_ptr = untag_ptr(failure);
49972         CHECK_ACCESS(failure_ptr);
49973         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
49974         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
49975         LDKPath path_conv;
49976         path_conv.inner = untag_ptr(path);
49977         path_conv.is_owned = ptr_is_owned(path);
49978         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49979         path_conv = Path_clone(&path_conv);
49980         void* short_channel_id_ptr = untag_ptr(short_channel_id);
49981         CHECK_ACCESS(short_channel_id_ptr);
49982         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
49983         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
49984         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49985         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
49986         uint64_t ret_ref = tag_ptr(ret_copy, true);
49987         return ret_ref;
49988 }
49989
49990 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
49991         LDKThirtyTwoBytes payment_id_ref;
49992         CHECK(payment_id->arr_len == 32);
49993         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49994         LDKThirtyTwoBytes payment_hash_ref;
49995         CHECK(payment_hash->arr_len == 32);
49996         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49997         LDKPath path_conv;
49998         path_conv.inner = untag_ptr(path);
49999         path_conv.is_owned = ptr_is_owned(path);
50000         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
50001         path_conv = Path_clone(&path_conv);
50002         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50003         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
50004         uint64_t ret_ref = tag_ptr(ret_copy, true);
50005         return ret_ref;
50006 }
50007
50008 uint64_t  __attribute__((export_name("TS_Event_probe_failed"))) TS_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path, uint64_t short_channel_id) {
50009         LDKThirtyTwoBytes payment_id_ref;
50010         CHECK(payment_id->arr_len == 32);
50011         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
50012         LDKThirtyTwoBytes payment_hash_ref;
50013         CHECK(payment_hash->arr_len == 32);
50014         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50015         LDKPath path_conv;
50016         path_conv.inner = untag_ptr(path);
50017         path_conv.is_owned = ptr_is_owned(path);
50018         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
50019         path_conv = Path_clone(&path_conv);
50020         void* short_channel_id_ptr = untag_ptr(short_channel_id);
50021         CHECK_ACCESS(short_channel_id_ptr);
50022         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
50023         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
50024         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50025         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
50026         uint64_t ret_ref = tag_ptr(ret_copy, true);
50027         return ret_ref;
50028 }
50029
50030 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
50031         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50032         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
50033         uint64_t ret_ref = tag_ptr(ret_copy, true);
50034         return ret_ref;
50035 }
50036
50037 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) {
50038         LDKThirtyTwoBytes intercept_id_ref;
50039         CHECK(intercept_id->arr_len == 32);
50040         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
50041         LDKThirtyTwoBytes payment_hash_ref;
50042         CHECK(payment_hash->arr_len == 32);
50043         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50044         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50045         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
50046         uint64_t ret_ref = tag_ptr(ret_copy, true);
50047         return ret_ref;
50048 }
50049
50050 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
50051         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
50052         outputs_constr.datalen = outputs->arr_len;
50053         if (outputs_constr.datalen > 0)
50054                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
50055         else
50056                 outputs_constr.data = NULL;
50057         uint64_t* outputs_vals = outputs->elems;
50058         for (size_t b = 0; b < outputs_constr.datalen; b++) {
50059                 uint64_t outputs_conv_27 = outputs_vals[b];
50060                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
50061                 CHECK_ACCESS(outputs_conv_27_ptr);
50062                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
50063                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
50064                 outputs_constr.data[b] = outputs_conv_27_conv;
50065         }
50066         FREE(outputs);
50067         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50068         *ret_copy = Event_spendable_outputs(outputs_constr);
50069         uint64_t ret_ref = tag_ptr(ret_copy, true);
50070         return ret_ref;
50071 }
50072
50073 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) {
50074         LDKThirtyTwoBytes prev_channel_id_ref;
50075         CHECK(prev_channel_id->arr_len == 32);
50076         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
50077         LDKThirtyTwoBytes next_channel_id_ref;
50078         CHECK(next_channel_id->arr_len == 32);
50079         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
50080         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
50081         CHECK_ACCESS(fee_earned_msat_ptr);
50082         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
50083         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
50084         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
50085         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
50086         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
50087         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
50088         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50089         *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);
50090         uint64_t ret_ref = tag_ptr(ret_copy, true);
50091         return ret_ref;
50092 }
50093
50094 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) {
50095         LDKThirtyTwoBytes channel_id_ref;
50096         CHECK(channel_id->arr_len == 32);
50097         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50098         LDKU128 user_channel_id_ref;
50099         CHECK(user_channel_id->arr_len == 16);
50100         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50101         LDKThirtyTwoBytes former_temporary_channel_id_ref;
50102         CHECK(former_temporary_channel_id->arr_len == 32);
50103         memcpy(former_temporary_channel_id_ref.data, former_temporary_channel_id->elems, 32); FREE(former_temporary_channel_id);
50104         LDKPublicKey counterparty_node_id_ref;
50105         CHECK(counterparty_node_id->arr_len == 33);
50106         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50107         LDKOutPoint funding_txo_conv;
50108         funding_txo_conv.inner = untag_ptr(funding_txo);
50109         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
50110         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
50111         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
50112         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50113         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_ref, counterparty_node_id_ref, funding_txo_conv);
50114         uint64_t ret_ref = tag_ptr(ret_copy, true);
50115         return ret_ref;
50116 }
50117
50118 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) {
50119         LDKThirtyTwoBytes channel_id_ref;
50120         CHECK(channel_id->arr_len == 32);
50121         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50122         LDKU128 user_channel_id_ref;
50123         CHECK(user_channel_id->arr_len == 16);
50124         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50125         LDKPublicKey counterparty_node_id_ref;
50126         CHECK(counterparty_node_id->arr_len == 33);
50127         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50128         LDKChannelTypeFeatures channel_type_conv;
50129         channel_type_conv.inner = untag_ptr(channel_type);
50130         channel_type_conv.is_owned = ptr_is_owned(channel_type);
50131         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
50132         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
50133         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50134         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
50135         uint64_t ret_ref = tag_ptr(ret_copy, true);
50136         return ret_ref;
50137 }
50138
50139 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) {
50140         LDKThirtyTwoBytes channel_id_ref;
50141         CHECK(channel_id->arr_len == 32);
50142         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50143         LDKU128 user_channel_id_ref;
50144         CHECK(user_channel_id->arr_len == 16);
50145         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50146         void* reason_ptr = untag_ptr(reason);
50147         CHECK_ACCESS(reason_ptr);
50148         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
50149         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
50150         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50151         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
50152         uint64_t ret_ref = tag_ptr(ret_copy, true);
50153         return ret_ref;
50154 }
50155
50156 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
50157         LDKThirtyTwoBytes channel_id_ref;
50158         CHECK(channel_id->arr_len == 32);
50159         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50160         LDKTransaction transaction_ref;
50161         transaction_ref.datalen = transaction->arr_len;
50162         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
50163         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
50164         transaction_ref.data_is_owned = true;
50165         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50166         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
50167         uint64_t ret_ref = tag_ptr(ret_copy, true);
50168         return ret_ref;
50169 }
50170
50171 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) {
50172         LDKThirtyTwoBytes temporary_channel_id_ref;
50173         CHECK(temporary_channel_id->arr_len == 32);
50174         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
50175         LDKPublicKey counterparty_node_id_ref;
50176         CHECK(counterparty_node_id->arr_len == 33);
50177         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50178         LDKChannelTypeFeatures channel_type_conv;
50179         channel_type_conv.inner = untag_ptr(channel_type);
50180         channel_type_conv.is_owned = ptr_is_owned(channel_type);
50181         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
50182         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
50183         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50184         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
50185         uint64_t ret_ref = tag_ptr(ret_copy, true);
50186         return ret_ref;
50187 }
50188
50189 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
50190         LDKThirtyTwoBytes prev_channel_id_ref;
50191         CHECK(prev_channel_id->arr_len == 32);
50192         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
50193         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
50194         CHECK_ACCESS(failed_next_destination_ptr);
50195         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
50196         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
50197         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50198         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
50199         uint64_t ret_ref = tag_ptr(ret_copy, true);
50200         return ret_ref;
50201 }
50202
50203 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
50204         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
50205         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
50206         jboolean ret_conv = Event_eq(a_conv, b_conv);
50207         return ret_conv;
50208 }
50209
50210 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
50211         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
50212         LDKCVec_u8Z ret_var = Event_write(obj_conv);
50213         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50214         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50215         CVec_u8Z_free(ret_var);
50216         return ret_arr;
50217 }
50218
50219 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
50220         LDKu8slice ser_ref;
50221         ser_ref.datalen = ser->arr_len;
50222         ser_ref.data = ser->elems;
50223         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
50224         *ret_conv = Event_read(ser_ref);
50225         FREE(ser);
50226         return tag_ptr(ret_conv, true);
50227 }
50228
50229 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
50230         if (!ptr_is_owned(this_ptr)) return;
50231         void* this_ptr_ptr = untag_ptr(this_ptr);
50232         CHECK_ACCESS(this_ptr_ptr);
50233         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
50234         FREE(untag_ptr(this_ptr));
50235         MessageSendEvent_free(this_ptr_conv);
50236 }
50237
50238 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
50239         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50240         *ret_copy = MessageSendEvent_clone(arg);
50241         uint64_t ret_ref = tag_ptr(ret_copy, true);
50242         return ret_ref;
50243 }
50244 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
50245         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
50246         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
50247         return ret_conv;
50248 }
50249
50250 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
50251         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
50252         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50253         *ret_copy = MessageSendEvent_clone(orig_conv);
50254         uint64_t ret_ref = tag_ptr(ret_copy, true);
50255         return ret_ref;
50256 }
50257
50258 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
50259         LDKPublicKey node_id_ref;
50260         CHECK(node_id->arr_len == 33);
50261         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50262         LDKAcceptChannel msg_conv;
50263         msg_conv.inner = untag_ptr(msg);
50264         msg_conv.is_owned = ptr_is_owned(msg);
50265         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50266         msg_conv = AcceptChannel_clone(&msg_conv);
50267         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50268         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
50269         uint64_t ret_ref = tag_ptr(ret_copy, true);
50270         return ret_ref;
50271 }
50272
50273 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
50274         LDKPublicKey node_id_ref;
50275         CHECK(node_id->arr_len == 33);
50276         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50277         LDKOpenChannel msg_conv;
50278         msg_conv.inner = untag_ptr(msg);
50279         msg_conv.is_owned = ptr_is_owned(msg);
50280         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50281         msg_conv = OpenChannel_clone(&msg_conv);
50282         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50283         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
50284         uint64_t ret_ref = tag_ptr(ret_copy, true);
50285         return ret_ref;
50286 }
50287
50288 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
50289         LDKPublicKey node_id_ref;
50290         CHECK(node_id->arr_len == 33);
50291         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50292         LDKFundingCreated msg_conv;
50293         msg_conv.inner = untag_ptr(msg);
50294         msg_conv.is_owned = ptr_is_owned(msg);
50295         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50296         msg_conv = FundingCreated_clone(&msg_conv);
50297         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50298         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
50299         uint64_t ret_ref = tag_ptr(ret_copy, true);
50300         return ret_ref;
50301 }
50302
50303 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
50304         LDKPublicKey node_id_ref;
50305         CHECK(node_id->arr_len == 33);
50306         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50307         LDKFundingSigned msg_conv;
50308         msg_conv.inner = untag_ptr(msg);
50309         msg_conv.is_owned = ptr_is_owned(msg);
50310         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50311         msg_conv = FundingSigned_clone(&msg_conv);
50312         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50313         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
50314         uint64_t ret_ref = tag_ptr(ret_copy, true);
50315         return ret_ref;
50316 }
50317
50318 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
50319         LDKPublicKey node_id_ref;
50320         CHECK(node_id->arr_len == 33);
50321         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50322         LDKChannelReady msg_conv;
50323         msg_conv.inner = untag_ptr(msg);
50324         msg_conv.is_owned = ptr_is_owned(msg);
50325         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50326         msg_conv = ChannelReady_clone(&msg_conv);
50327         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50328         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
50329         uint64_t ret_ref = tag_ptr(ret_copy, true);
50330         return ret_ref;
50331 }
50332
50333 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
50334         LDKPublicKey node_id_ref;
50335         CHECK(node_id->arr_len == 33);
50336         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50337         LDKAnnouncementSignatures msg_conv;
50338         msg_conv.inner = untag_ptr(msg);
50339         msg_conv.is_owned = ptr_is_owned(msg);
50340         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50341         msg_conv = AnnouncementSignatures_clone(&msg_conv);
50342         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50343         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
50344         uint64_t ret_ref = tag_ptr(ret_copy, true);
50345         return ret_ref;
50346 }
50347
50348 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
50349         LDKPublicKey node_id_ref;
50350         CHECK(node_id->arr_len == 33);
50351         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50352         LDKCommitmentUpdate updates_conv;
50353         updates_conv.inner = untag_ptr(updates);
50354         updates_conv.is_owned = ptr_is_owned(updates);
50355         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
50356         updates_conv = CommitmentUpdate_clone(&updates_conv);
50357         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50358         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
50359         uint64_t ret_ref = tag_ptr(ret_copy, true);
50360         return ret_ref;
50361 }
50362
50363 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
50364         LDKPublicKey node_id_ref;
50365         CHECK(node_id->arr_len == 33);
50366         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50367         LDKRevokeAndACK msg_conv;
50368         msg_conv.inner = untag_ptr(msg);
50369         msg_conv.is_owned = ptr_is_owned(msg);
50370         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50371         msg_conv = RevokeAndACK_clone(&msg_conv);
50372         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50373         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
50374         uint64_t ret_ref = tag_ptr(ret_copy, true);
50375         return ret_ref;
50376 }
50377
50378 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
50379         LDKPublicKey node_id_ref;
50380         CHECK(node_id->arr_len == 33);
50381         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50382         LDKClosingSigned msg_conv;
50383         msg_conv.inner = untag_ptr(msg);
50384         msg_conv.is_owned = ptr_is_owned(msg);
50385         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50386         msg_conv = ClosingSigned_clone(&msg_conv);
50387         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50388         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
50389         uint64_t ret_ref = tag_ptr(ret_copy, true);
50390         return ret_ref;
50391 }
50392
50393 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
50394         LDKPublicKey node_id_ref;
50395         CHECK(node_id->arr_len == 33);
50396         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50397         LDKShutdown msg_conv;
50398         msg_conv.inner = untag_ptr(msg);
50399         msg_conv.is_owned = ptr_is_owned(msg);
50400         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50401         msg_conv = Shutdown_clone(&msg_conv);
50402         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50403         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
50404         uint64_t ret_ref = tag_ptr(ret_copy, true);
50405         return ret_ref;
50406 }
50407
50408 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
50409         LDKPublicKey node_id_ref;
50410         CHECK(node_id->arr_len == 33);
50411         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50412         LDKChannelReestablish msg_conv;
50413         msg_conv.inner = untag_ptr(msg);
50414         msg_conv.is_owned = ptr_is_owned(msg);
50415         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50416         msg_conv = ChannelReestablish_clone(&msg_conv);
50417         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50418         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, 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_send_channel_announcement"))) TS_MessageSendEvent_send_channel_announcement(int8_tArray node_id, uint64_t msg, uint64_t update_msg) {
50424         LDKPublicKey node_id_ref;
50425         CHECK(node_id->arr_len == 33);
50426         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50427         LDKChannelAnnouncement msg_conv;
50428         msg_conv.inner = untag_ptr(msg);
50429         msg_conv.is_owned = ptr_is_owned(msg);
50430         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50431         msg_conv = ChannelAnnouncement_clone(&msg_conv);
50432         LDKChannelUpdate update_msg_conv;
50433         update_msg_conv.inner = untag_ptr(update_msg);
50434         update_msg_conv.is_owned = ptr_is_owned(update_msg);
50435         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
50436         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
50437         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50438         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
50439         uint64_t ret_ref = tag_ptr(ret_copy, true);
50440         return ret_ref;
50441 }
50442
50443 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
50444         LDKChannelAnnouncement msg_conv;
50445         msg_conv.inner = untag_ptr(msg);
50446         msg_conv.is_owned = ptr_is_owned(msg);
50447         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50448         msg_conv = ChannelAnnouncement_clone(&msg_conv);
50449         LDKChannelUpdate update_msg_conv;
50450         update_msg_conv.inner = untag_ptr(update_msg);
50451         update_msg_conv.is_owned = ptr_is_owned(update_msg);
50452         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
50453         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
50454         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50455         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
50456         uint64_t ret_ref = tag_ptr(ret_copy, true);
50457         return ret_ref;
50458 }
50459
50460 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
50461         LDKChannelUpdate msg_conv;
50462         msg_conv.inner = untag_ptr(msg);
50463         msg_conv.is_owned = ptr_is_owned(msg);
50464         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50465         msg_conv = ChannelUpdate_clone(&msg_conv);
50466         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50467         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
50468         uint64_t ret_ref = tag_ptr(ret_copy, true);
50469         return ret_ref;
50470 }
50471
50472 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
50473         LDKNodeAnnouncement msg_conv;
50474         msg_conv.inner = untag_ptr(msg);
50475         msg_conv.is_owned = ptr_is_owned(msg);
50476         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50477         msg_conv = NodeAnnouncement_clone(&msg_conv);
50478         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50479         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
50480         uint64_t ret_ref = tag_ptr(ret_copy, true);
50481         return ret_ref;
50482 }
50483
50484 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
50485         LDKPublicKey node_id_ref;
50486         CHECK(node_id->arr_len == 33);
50487         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50488         LDKChannelUpdate msg_conv;
50489         msg_conv.inner = untag_ptr(msg);
50490         msg_conv.is_owned = ptr_is_owned(msg);
50491         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50492         msg_conv = ChannelUpdate_clone(&msg_conv);
50493         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50494         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
50495         uint64_t ret_ref = tag_ptr(ret_copy, true);
50496         return ret_ref;
50497 }
50498
50499 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
50500         LDKPublicKey node_id_ref;
50501         CHECK(node_id->arr_len == 33);
50502         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50503         void* action_ptr = untag_ptr(action);
50504         CHECK_ACCESS(action_ptr);
50505         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
50506         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
50507         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50508         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
50509         uint64_t ret_ref = tag_ptr(ret_copy, true);
50510         return ret_ref;
50511 }
50512
50513 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
50514         LDKPublicKey node_id_ref;
50515         CHECK(node_id->arr_len == 33);
50516         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50517         LDKQueryChannelRange msg_conv;
50518         msg_conv.inner = untag_ptr(msg);
50519         msg_conv.is_owned = ptr_is_owned(msg);
50520         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50521         msg_conv = QueryChannelRange_clone(&msg_conv);
50522         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50523         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
50524         uint64_t ret_ref = tag_ptr(ret_copy, true);
50525         return ret_ref;
50526 }
50527
50528 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
50529         LDKPublicKey node_id_ref;
50530         CHECK(node_id->arr_len == 33);
50531         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50532         LDKQueryShortChannelIds msg_conv;
50533         msg_conv.inner = untag_ptr(msg);
50534         msg_conv.is_owned = ptr_is_owned(msg);
50535         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50536         msg_conv = QueryShortChannelIds_clone(&msg_conv);
50537         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50538         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
50539         uint64_t ret_ref = tag_ptr(ret_copy, true);
50540         return ret_ref;
50541 }
50542
50543 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
50544         LDKPublicKey node_id_ref;
50545         CHECK(node_id->arr_len == 33);
50546         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50547         LDKReplyChannelRange msg_conv;
50548         msg_conv.inner = untag_ptr(msg);
50549         msg_conv.is_owned = ptr_is_owned(msg);
50550         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50551         msg_conv = ReplyChannelRange_clone(&msg_conv);
50552         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50553         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
50554         uint64_t ret_ref = tag_ptr(ret_copy, true);
50555         return ret_ref;
50556 }
50557
50558 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
50559         LDKPublicKey node_id_ref;
50560         CHECK(node_id->arr_len == 33);
50561         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50562         LDKGossipTimestampFilter msg_conv;
50563         msg_conv.inner = untag_ptr(msg);
50564         msg_conv.is_owned = ptr_is_owned(msg);
50565         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50566         msg_conv = GossipTimestampFilter_clone(&msg_conv);
50567         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50568         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
50569         uint64_t ret_ref = tag_ptr(ret_copy, true);
50570         return ret_ref;
50571 }
50572
50573 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
50574         if (!ptr_is_owned(this_ptr)) return;
50575         void* this_ptr_ptr = untag_ptr(this_ptr);
50576         CHECK_ACCESS(this_ptr_ptr);
50577         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
50578         FREE(untag_ptr(this_ptr));
50579         MessageSendEventsProvider_free(this_ptr_conv);
50580 }
50581
50582 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
50583         if (!ptr_is_owned(this_ptr)) return;
50584         void* this_ptr_ptr = untag_ptr(this_ptr);
50585         CHECK_ACCESS(this_ptr_ptr);
50586         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
50587         FREE(untag_ptr(this_ptr));
50588         OnionMessageProvider_free(this_ptr_conv);
50589 }
50590
50591 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
50592         if (!ptr_is_owned(this_ptr)) return;
50593         void* this_ptr_ptr = untag_ptr(this_ptr);
50594         CHECK_ACCESS(this_ptr_ptr);
50595         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
50596         FREE(untag_ptr(this_ptr));
50597         EventsProvider_free(this_ptr_conv);
50598 }
50599
50600 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
50601         if (!ptr_is_owned(this_ptr)) return;
50602         void* this_ptr_ptr = untag_ptr(this_ptr);
50603         CHECK_ACCESS(this_ptr_ptr);
50604         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
50605         FREE(untag_ptr(this_ptr));
50606         EventHandler_free(this_ptr_conv);
50607 }
50608
50609 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
50610         if (!ptr_is_owned(this_ptr)) return;
50611         void* this_ptr_ptr = untag_ptr(this_ptr);
50612         CHECK_ACCESS(this_ptr_ptr);
50613         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
50614         FREE(untag_ptr(this_ptr));
50615         GossipSync_free(this_ptr_conv);
50616 }
50617
50618 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
50619         LDKP2PGossipSync a_conv;
50620         a_conv.inner = untag_ptr(a);
50621         a_conv.is_owned = ptr_is_owned(a);
50622         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50623         a_conv.is_owned = false;
50624         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50625         *ret_copy = GossipSync_p2_p(&a_conv);
50626         uint64_t ret_ref = tag_ptr(ret_copy, true);
50627         return ret_ref;
50628 }
50629
50630 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
50631         LDKRapidGossipSync a_conv;
50632         a_conv.inner = untag_ptr(a);
50633         a_conv.is_owned = ptr_is_owned(a);
50634         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50635         a_conv.is_owned = false;
50636         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50637         *ret_copy = GossipSync_rapid(&a_conv);
50638         uint64_t ret_ref = tag_ptr(ret_copy, true);
50639         return ret_ref;
50640 }
50641
50642 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
50643         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50644         *ret_copy = GossipSync_none();
50645         uint64_t ret_ref = tag_ptr(ret_copy, true);
50646         return ret_ref;
50647 }
50648
50649 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
50650         LDKRapidGossipSync this_obj_conv;
50651         this_obj_conv.inner = untag_ptr(this_obj);
50652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50654         RapidGossipSync_free(this_obj_conv);
50655 }
50656
50657 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
50658         LDKNetworkGraph network_graph_conv;
50659         network_graph_conv.inner = untag_ptr(network_graph);
50660         network_graph_conv.is_owned = ptr_is_owned(network_graph);
50661         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
50662         network_graph_conv.is_owned = false;
50663         void* logger_ptr = untag_ptr(logger);
50664         CHECK_ACCESS(logger_ptr);
50665         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50666         if (logger_conv.free == LDKLogger_JCalls_free) {
50667                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50668                 LDKLogger_JCalls_cloned(&logger_conv);
50669         }
50670         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
50671         uint64_t ret_ref = 0;
50672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50674         return ret_ref;
50675 }
50676
50677 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) {
50678         LDKRapidGossipSync this_arg_conv;
50679         this_arg_conv.inner = untag_ptr(this_arg);
50680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50682         this_arg_conv.is_owned = false;
50683         LDKu8slice update_data_ref;
50684         update_data_ref.datalen = update_data->arr_len;
50685         update_data_ref.data = update_data->elems;
50686         void* current_time_unix_ptr = untag_ptr(current_time_unix);
50687         CHECK_ACCESS(current_time_unix_ptr);
50688         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
50689         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
50690         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
50691         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
50692         FREE(update_data);
50693         return tag_ptr(ret_conv, true);
50694 }
50695
50696 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
50697         LDKRapidGossipSync this_arg_conv;
50698         this_arg_conv.inner = untag_ptr(this_arg);
50699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50701         this_arg_conv.is_owned = false;
50702         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
50703         return ret_conv;
50704 }
50705
50706 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
50707         if (!ptr_is_owned(this_ptr)) return;
50708         void* this_ptr_ptr = untag_ptr(this_ptr);
50709         CHECK_ACCESS(this_ptr_ptr);
50710         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
50711         FREE(untag_ptr(this_ptr));
50712         GraphSyncError_free(this_ptr_conv);
50713 }
50714
50715 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
50716         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50717         *ret_copy = GraphSyncError_clone(arg);
50718         uint64_t ret_ref = tag_ptr(ret_copy, true);
50719         return ret_ref;
50720 }
50721 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
50722         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
50723         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
50724         return ret_conv;
50725 }
50726
50727 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
50728         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
50729         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50730         *ret_copy = GraphSyncError_clone(orig_conv);
50731         uint64_t ret_ref = tag_ptr(ret_copy, true);
50732         return ret_ref;
50733 }
50734
50735 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
50736         void* a_ptr = untag_ptr(a);
50737         CHECK_ACCESS(a_ptr);
50738         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
50739         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
50740         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50741         *ret_copy = GraphSyncError_decode_error(a_conv);
50742         uint64_t ret_ref = tag_ptr(ret_copy, true);
50743         return ret_ref;
50744 }
50745
50746 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
50747         LDKLightningError a_conv;
50748         a_conv.inner = untag_ptr(a);
50749         a_conv.is_owned = ptr_is_owned(a);
50750         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50751         a_conv = LightningError_clone(&a_conv);
50752         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50753         *ret_copy = GraphSyncError_lightning_error(a_conv);
50754         uint64_t ret_ref = tag_ptr(ret_copy, true);
50755         return ret_ref;
50756 }
50757
50758 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
50759         if (!ptr_is_owned(this_ptr)) return;
50760         void* this_ptr_ptr = untag_ptr(this_ptr);
50761         CHECK_ACCESS(this_ptr_ptr);
50762         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
50763         FREE(untag_ptr(this_ptr));
50764         ParseError_free(this_ptr_conv);
50765 }
50766
50767 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
50768         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50769         *ret_copy = ParseError_clone(arg);
50770         uint64_t ret_ref = tag_ptr(ret_copy, true);
50771         return ret_ref;
50772 }
50773 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
50774         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
50775         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
50776         return ret_conv;
50777 }
50778
50779 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
50780         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
50781         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50782         *ret_copy = ParseError_clone(orig_conv);
50783         uint64_t ret_ref = tag_ptr(ret_copy, true);
50784         return ret_ref;
50785 }
50786
50787 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
50788         void* a_ptr = untag_ptr(a);
50789         CHECK_ACCESS(a_ptr);
50790         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
50791         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
50792         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50793         *ret_copy = ParseError_bech32_error(a_conv);
50794         uint64_t ret_ref = tag_ptr(ret_copy, true);
50795         return ret_ref;
50796 }
50797
50798 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
50799         
50800         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50801         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
50802         uint64_t ret_ref = tag_ptr(ret_copy, true);
50803         return ret_ref;
50804 }
50805
50806 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
50807         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
50808         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50809         *ret_copy = ParseError_malformed_signature(a_conv);
50810         uint64_t ret_ref = tag_ptr(ret_copy, true);
50811         return ret_ref;
50812 }
50813
50814 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
50815         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50816         *ret_copy = ParseError_bad_prefix();
50817         uint64_t ret_ref = tag_ptr(ret_copy, true);
50818         return ret_ref;
50819 }
50820
50821 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
50822         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50823         *ret_copy = ParseError_unknown_currency();
50824         uint64_t ret_ref = tag_ptr(ret_copy, true);
50825         return ret_ref;
50826 }
50827
50828 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
50829         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50830         *ret_copy = ParseError_unknown_si_prefix();
50831         uint64_t ret_ref = tag_ptr(ret_copy, true);
50832         return ret_ref;
50833 }
50834
50835 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
50836         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50837         *ret_copy = ParseError_malformed_hrp();
50838         uint64_t ret_ref = tag_ptr(ret_copy, true);
50839         return ret_ref;
50840 }
50841
50842 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
50843         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50844         *ret_copy = ParseError_too_short_data_part();
50845         uint64_t ret_ref = tag_ptr(ret_copy, true);
50846         return ret_ref;
50847 }
50848
50849 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
50850         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50851         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
50852         uint64_t ret_ref = tag_ptr(ret_copy, true);
50853         return ret_ref;
50854 }
50855
50856 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
50857         
50858         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50859         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
50860         uint64_t ret_ref = tag_ptr(ret_copy, true);
50861         return ret_ref;
50862 }
50863
50864 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
50865         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50866         *ret_copy = ParseError_padding_error();
50867         uint64_t ret_ref = tag_ptr(ret_copy, true);
50868         return ret_ref;
50869 }
50870
50871 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
50872         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50873         *ret_copy = ParseError_integer_overflow_error();
50874         uint64_t ret_ref = tag_ptr(ret_copy, true);
50875         return ret_ref;
50876 }
50877
50878 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
50879         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50880         *ret_copy = ParseError_invalid_seg_wit_program_length();
50881         uint64_t ret_ref = tag_ptr(ret_copy, true);
50882         return ret_ref;
50883 }
50884
50885 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
50886         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50887         *ret_copy = ParseError_invalid_pub_key_hash_length();
50888         uint64_t ret_ref = tag_ptr(ret_copy, true);
50889         return ret_ref;
50890 }
50891
50892 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
50893         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50894         *ret_copy = ParseError_invalid_script_hash_length();
50895         uint64_t ret_ref = tag_ptr(ret_copy, true);
50896         return ret_ref;
50897 }
50898
50899 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
50900         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50901         *ret_copy = ParseError_invalid_recovery_id();
50902         uint64_t ret_ref = tag_ptr(ret_copy, true);
50903         return ret_ref;
50904 }
50905
50906 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
50907         LDKStr a_conv = str_ref_to_owned_c(a);
50908         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50909         *ret_copy = ParseError_invalid_slice_length(a_conv);
50910         uint64_t ret_ref = tag_ptr(ret_copy, true);
50911         return ret_ref;
50912 }
50913
50914 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
50915         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50916         *ret_copy = ParseError_skip();
50917         uint64_t ret_ref = tag_ptr(ret_copy, true);
50918         return ret_ref;
50919 }
50920
50921 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
50922         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
50923         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
50924         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
50925         return ret_conv;
50926 }
50927
50928 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
50929         if (!ptr_is_owned(this_ptr)) return;
50930         void* this_ptr_ptr = untag_ptr(this_ptr);
50931         CHECK_ACCESS(this_ptr_ptr);
50932         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
50933         FREE(untag_ptr(this_ptr));
50934         ParseOrSemanticError_free(this_ptr_conv);
50935 }
50936
50937 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
50938         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50939         *ret_copy = ParseOrSemanticError_clone(arg);
50940         uint64_t ret_ref = tag_ptr(ret_copy, true);
50941         return ret_ref;
50942 }
50943 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
50944         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
50945         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
50946         return ret_conv;
50947 }
50948
50949 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
50950         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
50951         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50952         *ret_copy = ParseOrSemanticError_clone(orig_conv);
50953         uint64_t ret_ref = tag_ptr(ret_copy, true);
50954         return ret_ref;
50955 }
50956
50957 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
50958         void* a_ptr = untag_ptr(a);
50959         CHECK_ACCESS(a_ptr);
50960         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
50961         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
50962         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50963         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
50964         uint64_t ret_ref = tag_ptr(ret_copy, true);
50965         return ret_ref;
50966 }
50967
50968 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
50969         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
50970         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50971         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
50972         uint64_t ret_ref = tag_ptr(ret_copy, true);
50973         return ret_ref;
50974 }
50975
50976 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
50977         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
50978         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
50979         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
50980         return ret_conv;
50981 }
50982
50983 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
50984         LDKInvoice this_obj_conv;
50985         this_obj_conv.inner = untag_ptr(this_obj);
50986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50988         Invoice_free(this_obj_conv);
50989 }
50990
50991 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
50992         LDKInvoice a_conv;
50993         a_conv.inner = untag_ptr(a);
50994         a_conv.is_owned = ptr_is_owned(a);
50995         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50996         a_conv.is_owned = false;
50997         LDKInvoice b_conv;
50998         b_conv.inner = untag_ptr(b);
50999         b_conv.is_owned = ptr_is_owned(b);
51000         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51001         b_conv.is_owned = false;
51002         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
51003         return ret_conv;
51004 }
51005
51006 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
51007         LDKInvoice ret_var = Invoice_clone(arg);
51008         uint64_t ret_ref = 0;
51009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51011         return ret_ref;
51012 }
51013 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
51014         LDKInvoice arg_conv;
51015         arg_conv.inner = untag_ptr(arg);
51016         arg_conv.is_owned = ptr_is_owned(arg);
51017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51018         arg_conv.is_owned = false;
51019         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
51020         return ret_conv;
51021 }
51022
51023 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
51024         LDKInvoice orig_conv;
51025         orig_conv.inner = untag_ptr(orig);
51026         orig_conv.is_owned = ptr_is_owned(orig);
51027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51028         orig_conv.is_owned = false;
51029         LDKInvoice ret_var = Invoice_clone(&orig_conv);
51030         uint64_t ret_ref = 0;
51031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51033         return ret_ref;
51034 }
51035
51036 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
51037         LDKInvoice o_conv;
51038         o_conv.inner = untag_ptr(o);
51039         o_conv.is_owned = ptr_is_owned(o);
51040         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51041         o_conv.is_owned = false;
51042         int64_t ret_conv = Invoice_hash(&o_conv);
51043         return ret_conv;
51044 }
51045
51046 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
51047         LDKSignedRawInvoice this_obj_conv;
51048         this_obj_conv.inner = untag_ptr(this_obj);
51049         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51051         SignedRawInvoice_free(this_obj_conv);
51052 }
51053
51054 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
51055         LDKSignedRawInvoice a_conv;
51056         a_conv.inner = untag_ptr(a);
51057         a_conv.is_owned = ptr_is_owned(a);
51058         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51059         a_conv.is_owned = false;
51060         LDKSignedRawInvoice b_conv;
51061         b_conv.inner = untag_ptr(b);
51062         b_conv.is_owned = ptr_is_owned(b);
51063         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51064         b_conv.is_owned = false;
51065         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
51066         return ret_conv;
51067 }
51068
51069 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
51070         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
51071         uint64_t ret_ref = 0;
51072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51074         return ret_ref;
51075 }
51076 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
51077         LDKSignedRawInvoice arg_conv;
51078         arg_conv.inner = untag_ptr(arg);
51079         arg_conv.is_owned = ptr_is_owned(arg);
51080         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51081         arg_conv.is_owned = false;
51082         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
51083         return ret_conv;
51084 }
51085
51086 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
51087         LDKSignedRawInvoice orig_conv;
51088         orig_conv.inner = untag_ptr(orig);
51089         orig_conv.is_owned = ptr_is_owned(orig);
51090         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51091         orig_conv.is_owned = false;
51092         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
51093         uint64_t ret_ref = 0;
51094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51096         return ret_ref;
51097 }
51098
51099 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
51100         LDKSignedRawInvoice o_conv;
51101         o_conv.inner = untag_ptr(o);
51102         o_conv.is_owned = ptr_is_owned(o);
51103         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51104         o_conv.is_owned = false;
51105         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
51106         return ret_conv;
51107 }
51108
51109 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
51110         LDKRawInvoice this_obj_conv;
51111         this_obj_conv.inner = untag_ptr(this_obj);
51112         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51114         RawInvoice_free(this_obj_conv);
51115 }
51116
51117 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
51118         LDKRawInvoice this_ptr_conv;
51119         this_ptr_conv.inner = untag_ptr(this_ptr);
51120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51122         this_ptr_conv.is_owned = false;
51123         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
51124         uint64_t ret_ref = 0;
51125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51127         return ret_ref;
51128 }
51129
51130 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
51131         LDKRawInvoice this_ptr_conv;
51132         this_ptr_conv.inner = untag_ptr(this_ptr);
51133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51135         this_ptr_conv.is_owned = false;
51136         LDKRawDataPart val_conv;
51137         val_conv.inner = untag_ptr(val);
51138         val_conv.is_owned = ptr_is_owned(val);
51139         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51140         val_conv = RawDataPart_clone(&val_conv);
51141         RawInvoice_set_data(&this_ptr_conv, val_conv);
51142 }
51143
51144 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
51145         LDKRawInvoice a_conv;
51146         a_conv.inner = untag_ptr(a);
51147         a_conv.is_owned = ptr_is_owned(a);
51148         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51149         a_conv.is_owned = false;
51150         LDKRawInvoice b_conv;
51151         b_conv.inner = untag_ptr(b);
51152         b_conv.is_owned = ptr_is_owned(b);
51153         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51154         b_conv.is_owned = false;
51155         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
51156         return ret_conv;
51157 }
51158
51159 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
51160         LDKRawInvoice ret_var = RawInvoice_clone(arg);
51161         uint64_t ret_ref = 0;
51162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51164         return ret_ref;
51165 }
51166 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
51167         LDKRawInvoice arg_conv;
51168         arg_conv.inner = untag_ptr(arg);
51169         arg_conv.is_owned = ptr_is_owned(arg);
51170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51171         arg_conv.is_owned = false;
51172         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
51173         return ret_conv;
51174 }
51175
51176 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
51177         LDKRawInvoice orig_conv;
51178         orig_conv.inner = untag_ptr(orig);
51179         orig_conv.is_owned = ptr_is_owned(orig);
51180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51181         orig_conv.is_owned = false;
51182         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
51183         uint64_t ret_ref = 0;
51184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51186         return ret_ref;
51187 }
51188
51189 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
51190         LDKRawInvoice o_conv;
51191         o_conv.inner = untag_ptr(o);
51192         o_conv.is_owned = ptr_is_owned(o);
51193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51194         o_conv.is_owned = false;
51195         int64_t ret_conv = RawInvoice_hash(&o_conv);
51196         return ret_conv;
51197 }
51198
51199 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
51200         LDKRawDataPart this_obj_conv;
51201         this_obj_conv.inner = untag_ptr(this_obj);
51202         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51204         RawDataPart_free(this_obj_conv);
51205 }
51206
51207 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
51208         LDKRawDataPart this_ptr_conv;
51209         this_ptr_conv.inner = untag_ptr(this_ptr);
51210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51212         this_ptr_conv.is_owned = false;
51213         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
51214         uint64_t ret_ref = 0;
51215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51217         return ret_ref;
51218 }
51219
51220 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
51221         LDKRawDataPart this_ptr_conv;
51222         this_ptr_conv.inner = untag_ptr(this_ptr);
51223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51225         this_ptr_conv.is_owned = false;
51226         LDKPositiveTimestamp val_conv;
51227         val_conv.inner = untag_ptr(val);
51228         val_conv.is_owned = ptr_is_owned(val);
51229         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51230         val_conv = PositiveTimestamp_clone(&val_conv);
51231         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
51232 }
51233
51234 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
51235         LDKRawDataPart a_conv;
51236         a_conv.inner = untag_ptr(a);
51237         a_conv.is_owned = ptr_is_owned(a);
51238         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51239         a_conv.is_owned = false;
51240         LDKRawDataPart b_conv;
51241         b_conv.inner = untag_ptr(b);
51242         b_conv.is_owned = ptr_is_owned(b);
51243         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51244         b_conv.is_owned = false;
51245         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
51246         return ret_conv;
51247 }
51248
51249 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
51250         LDKRawDataPart ret_var = RawDataPart_clone(arg);
51251         uint64_t ret_ref = 0;
51252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51254         return ret_ref;
51255 }
51256 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
51257         LDKRawDataPart arg_conv;
51258         arg_conv.inner = untag_ptr(arg);
51259         arg_conv.is_owned = ptr_is_owned(arg);
51260         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51261         arg_conv.is_owned = false;
51262         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
51263         return ret_conv;
51264 }
51265
51266 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
51267         LDKRawDataPart orig_conv;
51268         orig_conv.inner = untag_ptr(orig);
51269         orig_conv.is_owned = ptr_is_owned(orig);
51270         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51271         orig_conv.is_owned = false;
51272         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
51273         uint64_t ret_ref = 0;
51274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51276         return ret_ref;
51277 }
51278
51279 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
51280         LDKRawDataPart o_conv;
51281         o_conv.inner = untag_ptr(o);
51282         o_conv.is_owned = ptr_is_owned(o);
51283         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51284         o_conv.is_owned = false;
51285         int64_t ret_conv = RawDataPart_hash(&o_conv);
51286         return ret_conv;
51287 }
51288
51289 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
51290         LDKPositiveTimestamp this_obj_conv;
51291         this_obj_conv.inner = untag_ptr(this_obj);
51292         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51294         PositiveTimestamp_free(this_obj_conv);
51295 }
51296
51297 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
51298         LDKPositiveTimestamp a_conv;
51299         a_conv.inner = untag_ptr(a);
51300         a_conv.is_owned = ptr_is_owned(a);
51301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51302         a_conv.is_owned = false;
51303         LDKPositiveTimestamp b_conv;
51304         b_conv.inner = untag_ptr(b);
51305         b_conv.is_owned = ptr_is_owned(b);
51306         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51307         b_conv.is_owned = false;
51308         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
51309         return ret_conv;
51310 }
51311
51312 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
51313         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
51314         uint64_t ret_ref = 0;
51315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51317         return ret_ref;
51318 }
51319 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
51320         LDKPositiveTimestamp arg_conv;
51321         arg_conv.inner = untag_ptr(arg);
51322         arg_conv.is_owned = ptr_is_owned(arg);
51323         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51324         arg_conv.is_owned = false;
51325         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
51326         return ret_conv;
51327 }
51328
51329 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
51330         LDKPositiveTimestamp orig_conv;
51331         orig_conv.inner = untag_ptr(orig);
51332         orig_conv.is_owned = ptr_is_owned(orig);
51333         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51334         orig_conv.is_owned = false;
51335         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
51336         uint64_t ret_ref = 0;
51337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51339         return ret_ref;
51340 }
51341
51342 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
51343         LDKPositiveTimestamp o_conv;
51344         o_conv.inner = untag_ptr(o);
51345         o_conv.is_owned = ptr_is_owned(o);
51346         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51347         o_conv.is_owned = false;
51348         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
51349         return ret_conv;
51350 }
51351
51352 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
51353         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
51354         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
51355         return ret_conv;
51356 }
51357
51358 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
51359         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
51360         return ret_conv;
51361 }
51362
51363 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
51364         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
51365         return ret_conv;
51366 }
51367
51368 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
51369         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
51370         return ret_conv;
51371 }
51372
51373 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
51374         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
51375         return ret_conv;
51376 }
51377
51378 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
51379         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
51380         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
51381         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
51382         return ret_conv;
51383 }
51384
51385 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
51386         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
51387         int64_t ret_conv = SiPrefix_hash(o_conv);
51388         return ret_conv;
51389 }
51390
51391 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
51392         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
51393         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
51394         return ret_conv;
51395 }
51396
51397 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
51398         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
51399         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
51400         return ret_conv;
51401 }
51402
51403 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
51404         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
51405         return ret_conv;
51406 }
51407
51408 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
51409         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
51410         return ret_conv;
51411 }
51412
51413 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
51414         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
51415         return ret_conv;
51416 }
51417
51418 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
51419         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
51420         return ret_conv;
51421 }
51422
51423 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
51424         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
51425         return ret_conv;
51426 }
51427
51428 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
51429         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
51430         int64_t ret_conv = Currency_hash(o_conv);
51431         return ret_conv;
51432 }
51433
51434 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
51435         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
51436         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
51437         jboolean ret_conv = Currency_eq(a_conv, b_conv);
51438         return ret_conv;
51439 }
51440
51441 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
51442         LDKSha256 this_obj_conv;
51443         this_obj_conv.inner = untag_ptr(this_obj);
51444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51446         Sha256_free(this_obj_conv);
51447 }
51448
51449 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
51450         LDKSha256 ret_var = Sha256_clone(arg);
51451         uint64_t ret_ref = 0;
51452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51454         return ret_ref;
51455 }
51456 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
51457         LDKSha256 arg_conv;
51458         arg_conv.inner = untag_ptr(arg);
51459         arg_conv.is_owned = ptr_is_owned(arg);
51460         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51461         arg_conv.is_owned = false;
51462         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
51463         return ret_conv;
51464 }
51465
51466 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
51467         LDKSha256 orig_conv;
51468         orig_conv.inner = untag_ptr(orig);
51469         orig_conv.is_owned = ptr_is_owned(orig);
51470         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51471         orig_conv.is_owned = false;
51472         LDKSha256 ret_var = Sha256_clone(&orig_conv);
51473         uint64_t ret_ref = 0;
51474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51476         return ret_ref;
51477 }
51478
51479 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
51480         LDKSha256 o_conv;
51481         o_conv.inner = untag_ptr(o);
51482         o_conv.is_owned = ptr_is_owned(o);
51483         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51484         o_conv.is_owned = false;
51485         int64_t ret_conv = Sha256_hash(&o_conv);
51486         return ret_conv;
51487 }
51488
51489 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
51490         LDKSha256 a_conv;
51491         a_conv.inner = untag_ptr(a);
51492         a_conv.is_owned = ptr_is_owned(a);
51493         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51494         a_conv.is_owned = false;
51495         LDKSha256 b_conv;
51496         b_conv.inner = untag_ptr(b);
51497         b_conv.is_owned = ptr_is_owned(b);
51498         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51499         b_conv.is_owned = false;
51500         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
51501         return ret_conv;
51502 }
51503
51504 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
51505         uint8_t bytes_arr[32];
51506         CHECK(bytes->arr_len == 32);
51507         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
51508         uint8_t (*bytes_ref)[32] = &bytes_arr;
51509         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
51510         uint64_t ret_ref = 0;
51511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51513         return ret_ref;
51514 }
51515
51516 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
51517         LDKDescription this_obj_conv;
51518         this_obj_conv.inner = untag_ptr(this_obj);
51519         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51521         Description_free(this_obj_conv);
51522 }
51523
51524 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
51525         LDKDescription ret_var = Description_clone(arg);
51526         uint64_t ret_ref = 0;
51527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51529         return ret_ref;
51530 }
51531 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
51532         LDKDescription arg_conv;
51533         arg_conv.inner = untag_ptr(arg);
51534         arg_conv.is_owned = ptr_is_owned(arg);
51535         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51536         arg_conv.is_owned = false;
51537         int64_t ret_conv = Description_clone_ptr(&arg_conv);
51538         return ret_conv;
51539 }
51540
51541 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
51542         LDKDescription orig_conv;
51543         orig_conv.inner = untag_ptr(orig);
51544         orig_conv.is_owned = ptr_is_owned(orig);
51545         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51546         orig_conv.is_owned = false;
51547         LDKDescription ret_var = Description_clone(&orig_conv);
51548         uint64_t ret_ref = 0;
51549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51551         return ret_ref;
51552 }
51553
51554 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
51555         LDKDescription o_conv;
51556         o_conv.inner = untag_ptr(o);
51557         o_conv.is_owned = ptr_is_owned(o);
51558         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51559         o_conv.is_owned = false;
51560         int64_t ret_conv = Description_hash(&o_conv);
51561         return ret_conv;
51562 }
51563
51564 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
51565         LDKDescription a_conv;
51566         a_conv.inner = untag_ptr(a);
51567         a_conv.is_owned = ptr_is_owned(a);
51568         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51569         a_conv.is_owned = false;
51570         LDKDescription b_conv;
51571         b_conv.inner = untag_ptr(b);
51572         b_conv.is_owned = ptr_is_owned(b);
51573         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51574         b_conv.is_owned = false;
51575         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
51576         return ret_conv;
51577 }
51578
51579 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
51580         LDKPayeePubKey this_obj_conv;
51581         this_obj_conv.inner = untag_ptr(this_obj);
51582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51584         PayeePubKey_free(this_obj_conv);
51585 }
51586
51587 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
51588         LDKPayeePubKey this_ptr_conv;
51589         this_ptr_conv.inner = untag_ptr(this_ptr);
51590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51592         this_ptr_conv.is_owned = false;
51593         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51594         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
51595         return ret_arr;
51596 }
51597
51598 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
51599         LDKPayeePubKey this_ptr_conv;
51600         this_ptr_conv.inner = untag_ptr(this_ptr);
51601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51603         this_ptr_conv.is_owned = false;
51604         LDKPublicKey val_ref;
51605         CHECK(val->arr_len == 33);
51606         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51607         PayeePubKey_set_a(&this_ptr_conv, val_ref);
51608 }
51609
51610 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
51611         LDKPublicKey a_arg_ref;
51612         CHECK(a_arg->arr_len == 33);
51613         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
51614         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
51615         uint64_t ret_ref = 0;
51616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51618         return ret_ref;
51619 }
51620
51621 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
51622         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
51623         uint64_t ret_ref = 0;
51624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51626         return ret_ref;
51627 }
51628 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
51629         LDKPayeePubKey arg_conv;
51630         arg_conv.inner = untag_ptr(arg);
51631         arg_conv.is_owned = ptr_is_owned(arg);
51632         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51633         arg_conv.is_owned = false;
51634         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
51635         return ret_conv;
51636 }
51637
51638 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
51639         LDKPayeePubKey orig_conv;
51640         orig_conv.inner = untag_ptr(orig);
51641         orig_conv.is_owned = ptr_is_owned(orig);
51642         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51643         orig_conv.is_owned = false;
51644         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
51645         uint64_t ret_ref = 0;
51646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51648         return ret_ref;
51649 }
51650
51651 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
51652         LDKPayeePubKey o_conv;
51653         o_conv.inner = untag_ptr(o);
51654         o_conv.is_owned = ptr_is_owned(o);
51655         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51656         o_conv.is_owned = false;
51657         int64_t ret_conv = PayeePubKey_hash(&o_conv);
51658         return ret_conv;
51659 }
51660
51661 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
51662         LDKPayeePubKey a_conv;
51663         a_conv.inner = untag_ptr(a);
51664         a_conv.is_owned = ptr_is_owned(a);
51665         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51666         a_conv.is_owned = false;
51667         LDKPayeePubKey b_conv;
51668         b_conv.inner = untag_ptr(b);
51669         b_conv.is_owned = ptr_is_owned(b);
51670         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51671         b_conv.is_owned = false;
51672         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
51673         return ret_conv;
51674 }
51675
51676 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
51677         LDKExpiryTime this_obj_conv;
51678         this_obj_conv.inner = untag_ptr(this_obj);
51679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51681         ExpiryTime_free(this_obj_conv);
51682 }
51683
51684 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
51685         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
51686         uint64_t ret_ref = 0;
51687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51689         return ret_ref;
51690 }
51691 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
51692         LDKExpiryTime arg_conv;
51693         arg_conv.inner = untag_ptr(arg);
51694         arg_conv.is_owned = ptr_is_owned(arg);
51695         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51696         arg_conv.is_owned = false;
51697         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
51698         return ret_conv;
51699 }
51700
51701 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
51702         LDKExpiryTime orig_conv;
51703         orig_conv.inner = untag_ptr(orig);
51704         orig_conv.is_owned = ptr_is_owned(orig);
51705         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51706         orig_conv.is_owned = false;
51707         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
51708         uint64_t ret_ref = 0;
51709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51711         return ret_ref;
51712 }
51713
51714 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
51715         LDKExpiryTime o_conv;
51716         o_conv.inner = untag_ptr(o);
51717         o_conv.is_owned = ptr_is_owned(o);
51718         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51719         o_conv.is_owned = false;
51720         int64_t ret_conv = ExpiryTime_hash(&o_conv);
51721         return ret_conv;
51722 }
51723
51724 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
51725         LDKExpiryTime a_conv;
51726         a_conv.inner = untag_ptr(a);
51727         a_conv.is_owned = ptr_is_owned(a);
51728         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51729         a_conv.is_owned = false;
51730         LDKExpiryTime b_conv;
51731         b_conv.inner = untag_ptr(b);
51732         b_conv.is_owned = ptr_is_owned(b);
51733         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51734         b_conv.is_owned = false;
51735         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
51736         return ret_conv;
51737 }
51738
51739 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
51740         LDKMinFinalCltvExpiryDelta this_obj_conv;
51741         this_obj_conv.inner = untag_ptr(this_obj);
51742         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51744         MinFinalCltvExpiryDelta_free(this_obj_conv);
51745 }
51746
51747 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
51748         LDKMinFinalCltvExpiryDelta this_ptr_conv;
51749         this_ptr_conv.inner = untag_ptr(this_ptr);
51750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51752         this_ptr_conv.is_owned = false;
51753         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
51754         return ret_conv;
51755 }
51756
51757 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
51758         LDKMinFinalCltvExpiryDelta this_ptr_conv;
51759         this_ptr_conv.inner = untag_ptr(this_ptr);
51760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51762         this_ptr_conv.is_owned = false;
51763         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
51764 }
51765
51766 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
51767         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
51768         uint64_t ret_ref = 0;
51769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51771         return ret_ref;
51772 }
51773
51774 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
51775         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
51776         uint64_t ret_ref = 0;
51777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51779         return ret_ref;
51780 }
51781 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
51782         LDKMinFinalCltvExpiryDelta arg_conv;
51783         arg_conv.inner = untag_ptr(arg);
51784         arg_conv.is_owned = ptr_is_owned(arg);
51785         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51786         arg_conv.is_owned = false;
51787         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
51788         return ret_conv;
51789 }
51790
51791 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
51792         LDKMinFinalCltvExpiryDelta orig_conv;
51793         orig_conv.inner = untag_ptr(orig);
51794         orig_conv.is_owned = ptr_is_owned(orig);
51795         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51796         orig_conv.is_owned = false;
51797         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
51798         uint64_t ret_ref = 0;
51799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51801         return ret_ref;
51802 }
51803
51804 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
51805         LDKMinFinalCltvExpiryDelta o_conv;
51806         o_conv.inner = untag_ptr(o);
51807         o_conv.is_owned = ptr_is_owned(o);
51808         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51809         o_conv.is_owned = false;
51810         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
51811         return ret_conv;
51812 }
51813
51814 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
51815         LDKMinFinalCltvExpiryDelta a_conv;
51816         a_conv.inner = untag_ptr(a);
51817         a_conv.is_owned = ptr_is_owned(a);
51818         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51819         a_conv.is_owned = false;
51820         LDKMinFinalCltvExpiryDelta b_conv;
51821         b_conv.inner = untag_ptr(b);
51822         b_conv.is_owned = ptr_is_owned(b);
51823         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51824         b_conv.is_owned = false;
51825         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
51826         return ret_conv;
51827 }
51828
51829 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
51830         if (!ptr_is_owned(this_ptr)) return;
51831         void* this_ptr_ptr = untag_ptr(this_ptr);
51832         CHECK_ACCESS(this_ptr_ptr);
51833         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
51834         FREE(untag_ptr(this_ptr));
51835         Fallback_free(this_ptr_conv);
51836 }
51837
51838 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
51839         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51840         *ret_copy = Fallback_clone(arg);
51841         uint64_t ret_ref = tag_ptr(ret_copy, true);
51842         return ret_ref;
51843 }
51844 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
51845         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
51846         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
51847         return ret_conv;
51848 }
51849
51850 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
51851         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
51852         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51853         *ret_copy = Fallback_clone(orig_conv);
51854         uint64_t ret_ref = tag_ptr(ret_copy, true);
51855         return ret_ref;
51856 }
51857
51858 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
51859         
51860         LDKCVec_u8Z program_ref;
51861         program_ref.datalen = program->arr_len;
51862         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
51863         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
51864         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51865         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
51866         uint64_t ret_ref = tag_ptr(ret_copy, true);
51867         return ret_ref;
51868 }
51869
51870 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
51871         LDKTwentyBytes a_ref;
51872         CHECK(a->arr_len == 20);
51873         memcpy(a_ref.data, a->elems, 20); FREE(a);
51874         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51875         *ret_copy = Fallback_pub_key_hash(a_ref);
51876         uint64_t ret_ref = tag_ptr(ret_copy, true);
51877         return ret_ref;
51878 }
51879
51880 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
51881         LDKTwentyBytes a_ref;
51882         CHECK(a->arr_len == 20);
51883         memcpy(a_ref.data, a->elems, 20); FREE(a);
51884         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51885         *ret_copy = Fallback_script_hash(a_ref);
51886         uint64_t ret_ref = tag_ptr(ret_copy, true);
51887         return ret_ref;
51888 }
51889
51890 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
51891         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
51892         int64_t ret_conv = Fallback_hash(o_conv);
51893         return ret_conv;
51894 }
51895
51896 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
51897         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
51898         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
51899         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
51900         return ret_conv;
51901 }
51902
51903 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
51904         LDKInvoiceSignature this_obj_conv;
51905         this_obj_conv.inner = untag_ptr(this_obj);
51906         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51908         InvoiceSignature_free(this_obj_conv);
51909 }
51910
51911 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
51912         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
51913         uint64_t ret_ref = 0;
51914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51916         return ret_ref;
51917 }
51918 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
51919         LDKInvoiceSignature arg_conv;
51920         arg_conv.inner = untag_ptr(arg);
51921         arg_conv.is_owned = ptr_is_owned(arg);
51922         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51923         arg_conv.is_owned = false;
51924         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
51925         return ret_conv;
51926 }
51927
51928 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
51929         LDKInvoiceSignature orig_conv;
51930         orig_conv.inner = untag_ptr(orig);
51931         orig_conv.is_owned = ptr_is_owned(orig);
51932         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51933         orig_conv.is_owned = false;
51934         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
51935         uint64_t ret_ref = 0;
51936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51938         return ret_ref;
51939 }
51940
51941 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
51942         LDKInvoiceSignature o_conv;
51943         o_conv.inner = untag_ptr(o);
51944         o_conv.is_owned = ptr_is_owned(o);
51945         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51946         o_conv.is_owned = false;
51947         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
51948         return ret_conv;
51949 }
51950
51951 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
51952         LDKInvoiceSignature a_conv;
51953         a_conv.inner = untag_ptr(a);
51954         a_conv.is_owned = ptr_is_owned(a);
51955         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51956         a_conv.is_owned = false;
51957         LDKInvoiceSignature b_conv;
51958         b_conv.inner = untag_ptr(b);
51959         b_conv.is_owned = ptr_is_owned(b);
51960         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51961         b_conv.is_owned = false;
51962         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
51963         return ret_conv;
51964 }
51965
51966 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
51967         LDKPrivateRoute this_obj_conv;
51968         this_obj_conv.inner = untag_ptr(this_obj);
51969         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51971         PrivateRoute_free(this_obj_conv);
51972 }
51973
51974 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
51975         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
51976         uint64_t ret_ref = 0;
51977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51979         return ret_ref;
51980 }
51981 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
51982         LDKPrivateRoute arg_conv;
51983         arg_conv.inner = untag_ptr(arg);
51984         arg_conv.is_owned = ptr_is_owned(arg);
51985         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51986         arg_conv.is_owned = false;
51987         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
51988         return ret_conv;
51989 }
51990
51991 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
51992         LDKPrivateRoute orig_conv;
51993         orig_conv.inner = untag_ptr(orig);
51994         orig_conv.is_owned = ptr_is_owned(orig);
51995         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51996         orig_conv.is_owned = false;
51997         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
51998         uint64_t ret_ref = 0;
51999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52001         return ret_ref;
52002 }
52003
52004 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
52005         LDKPrivateRoute o_conv;
52006         o_conv.inner = untag_ptr(o);
52007         o_conv.is_owned = ptr_is_owned(o);
52008         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52009         o_conv.is_owned = false;
52010         int64_t ret_conv = PrivateRoute_hash(&o_conv);
52011         return ret_conv;
52012 }
52013
52014 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
52015         LDKPrivateRoute a_conv;
52016         a_conv.inner = untag_ptr(a);
52017         a_conv.is_owned = ptr_is_owned(a);
52018         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52019         a_conv.is_owned = false;
52020         LDKPrivateRoute b_conv;
52021         b_conv.inner = untag_ptr(b);
52022         b_conv.is_owned = ptr_is_owned(b);
52023         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52024         b_conv.is_owned = false;
52025         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
52026         return ret_conv;
52027 }
52028
52029 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
52030         LDKSignedRawInvoice this_arg_conv;
52031         this_arg_conv.inner = untag_ptr(this_arg);
52032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52034         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
52035         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
52036         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
52037         return tag_ptr(ret_conv, true);
52038 }
52039
52040 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
52041         LDKSignedRawInvoice this_arg_conv;
52042         this_arg_conv.inner = untag_ptr(this_arg);
52043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52045         this_arg_conv.is_owned = false;
52046         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
52047         uint64_t ret_ref = 0;
52048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52050         return ret_ref;
52051 }
52052
52053 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
52054         LDKSignedRawInvoice this_arg_conv;
52055         this_arg_conv.inner = untag_ptr(this_arg);
52056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52058         this_arg_conv.is_owned = false;
52059         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52060         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
52061         return ret_arr;
52062 }
52063
52064 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
52065         LDKSignedRawInvoice this_arg_conv;
52066         this_arg_conv.inner = untag_ptr(this_arg);
52067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52069         this_arg_conv.is_owned = false;
52070         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
52071         uint64_t ret_ref = 0;
52072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52074         return ret_ref;
52075 }
52076
52077 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
52078         LDKSignedRawInvoice this_arg_conv;
52079         this_arg_conv.inner = untag_ptr(this_arg);
52080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52082         this_arg_conv.is_owned = false;
52083         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
52084         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
52085         return tag_ptr(ret_conv, true);
52086 }
52087
52088 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
52089         LDKSignedRawInvoice this_arg_conv;
52090         this_arg_conv.inner = untag_ptr(this_arg);
52091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52093         this_arg_conv.is_owned = false;
52094         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
52095         return ret_conv;
52096 }
52097
52098 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
52099         LDKRawInvoice this_arg_conv;
52100         this_arg_conv.inner = untag_ptr(this_arg);
52101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52103         this_arg_conv.is_owned = false;
52104         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52105         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
52106         return ret_arr;
52107 }
52108
52109 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
52110         LDKRawInvoice this_arg_conv;
52111         this_arg_conv.inner = untag_ptr(this_arg);
52112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52114         this_arg_conv.is_owned = false;
52115         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
52116         uint64_t ret_ref = 0;
52117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52119         return ret_ref;
52120 }
52121
52122 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
52123         LDKRawInvoice this_arg_conv;
52124         this_arg_conv.inner = untag_ptr(this_arg);
52125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52127         this_arg_conv.is_owned = false;
52128         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
52129         uint64_t ret_ref = 0;
52130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52132         return ret_ref;
52133 }
52134
52135 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
52136         LDKRawInvoice this_arg_conv;
52137         this_arg_conv.inner = untag_ptr(this_arg);
52138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52140         this_arg_conv.is_owned = false;
52141         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
52142         uint64_t ret_ref = 0;
52143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52145         return ret_ref;
52146 }
52147
52148 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
52149         LDKRawInvoice this_arg_conv;
52150         this_arg_conv.inner = untag_ptr(this_arg);
52151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52153         this_arg_conv.is_owned = false;
52154         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
52155         uint64_t ret_ref = 0;
52156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52158         return ret_ref;
52159 }
52160
52161 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
52162         LDKRawInvoice this_arg_conv;
52163         this_arg_conv.inner = untag_ptr(this_arg);
52164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52166         this_arg_conv.is_owned = false;
52167         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
52168         uint64_t ret_ref = 0;
52169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52171         return ret_ref;
52172 }
52173
52174 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry_delta"))) TS_RawInvoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
52175         LDKRawInvoice this_arg_conv;
52176         this_arg_conv.inner = untag_ptr(this_arg);
52177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52179         this_arg_conv.is_owned = false;
52180         LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&this_arg_conv);
52181         uint64_t ret_ref = 0;
52182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52184         return ret_ref;
52185 }
52186
52187 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
52188         LDKRawInvoice this_arg_conv;
52189         this_arg_conv.inner = untag_ptr(this_arg);
52190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52192         this_arg_conv.is_owned = false;
52193         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52194         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
52195         return ret_arr;
52196 }
52197
52198 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_metadata"))) TS_RawInvoice_payment_metadata(uint64_t this_arg) {
52199         LDKRawInvoice this_arg_conv;
52200         this_arg_conv.inner = untag_ptr(this_arg);
52201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52203         this_arg_conv.is_owned = false;
52204         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52205         *ret_copy = RawInvoice_payment_metadata(&this_arg_conv);
52206         uint64_t ret_ref = tag_ptr(ret_copy, true);
52207         return ret_ref;
52208 }
52209
52210 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
52211         LDKRawInvoice this_arg_conv;
52212         this_arg_conv.inner = untag_ptr(this_arg);
52213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52215         this_arg_conv.is_owned = false;
52216         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
52217         uint64_t ret_ref = 0;
52218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52220         return ret_ref;
52221 }
52222
52223 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
52224         LDKRawInvoice this_arg_conv;
52225         this_arg_conv.inner = untag_ptr(this_arg);
52226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52228         this_arg_conv.is_owned = false;
52229         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
52230         uint64_tArray ret_arr = NULL;
52231         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52232         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52233         for (size_t o = 0; o < ret_var.datalen; o++) {
52234                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
52235                 uint64_t ret_conv_14_ref = 0;
52236                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
52237                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
52238                 ret_arr_ptr[o] = ret_conv_14_ref;
52239         }
52240         
52241         FREE(ret_var.data);
52242         return ret_arr;
52243 }
52244
52245 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
52246         LDKRawInvoice this_arg_conv;
52247         this_arg_conv.inner = untag_ptr(this_arg);
52248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52250         this_arg_conv.is_owned = false;
52251         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52252         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
52253         uint64_t ret_ref = tag_ptr(ret_copy, true);
52254         return ret_ref;
52255 }
52256
52257 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
52258         LDKRawInvoice this_arg_conv;
52259         this_arg_conv.inner = untag_ptr(this_arg);
52260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52262         this_arg_conv.is_owned = false;
52263         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
52264         return ret_conv;
52265 }
52266
52267 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
52268         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
52269         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
52270         return tag_ptr(ret_conv, true);
52271 }
52272
52273 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
52274         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
52275         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
52276         return tag_ptr(ret_conv, true);
52277 }
52278
52279 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
52280         LDKPositiveTimestamp 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         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
52286         return ret_conv;
52287 }
52288
52289 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
52290         LDKPositiveTimestamp this_arg_conv;
52291         this_arg_conv.inner = untag_ptr(this_arg);
52292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52294         this_arg_conv.is_owned = false;
52295         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
52296         return ret_conv;
52297 }
52298
52299 int8_tArray  __attribute__((export_name("TS_Invoice_signable_hash"))) TS_Invoice_signable_hash(uint64_t this_arg) {
52300         LDKInvoice this_arg_conv;
52301         this_arg_conv.inner = untag_ptr(this_arg);
52302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52304         this_arg_conv.is_owned = false;
52305         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52306         memcpy(ret_arr->elems, Invoice_signable_hash(&this_arg_conv).data, 32);
52307         return ret_arr;
52308 }
52309
52310 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
52311         LDKInvoice this_arg_conv;
52312         this_arg_conv.inner = untag_ptr(this_arg);
52313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52315         this_arg_conv = Invoice_clone(&this_arg_conv);
52316         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
52317         uint64_t ret_ref = 0;
52318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52320         return ret_ref;
52321 }
52322
52323 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
52324         LDKInvoice this_arg_conv;
52325         this_arg_conv.inner = untag_ptr(this_arg);
52326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52328         this_arg_conv.is_owned = false;
52329         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
52330         *ret_conv = Invoice_check_signature(&this_arg_conv);
52331         return tag_ptr(ret_conv, true);
52332 }
52333
52334 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
52335         LDKSignedRawInvoice signed_invoice_conv;
52336         signed_invoice_conv.inner = untag_ptr(signed_invoice);
52337         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
52338         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
52339         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
52340         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
52341         *ret_conv = Invoice_from_signed(signed_invoice_conv);
52342         return tag_ptr(ret_conv, true);
52343 }
52344
52345 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
52346         LDKInvoice this_arg_conv;
52347         this_arg_conv.inner = untag_ptr(this_arg);
52348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52350         this_arg_conv.is_owned = false;
52351         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
52352         return ret_conv;
52353 }
52354
52355 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
52356         LDKInvoice this_arg_conv;
52357         this_arg_conv.inner = untag_ptr(this_arg);
52358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52360         this_arg_conv.is_owned = false;
52361         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52362         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
52363         return ret_arr;
52364 }
52365
52366 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
52367         LDKInvoice this_arg_conv;
52368         this_arg_conv.inner = untag_ptr(this_arg);
52369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52371         this_arg_conv.is_owned = false;
52372         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52373         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
52374         return ret_arr;
52375 }
52376
52377 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
52378         LDKInvoice this_arg_conv;
52379         this_arg_conv.inner = untag_ptr(this_arg);
52380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52382         this_arg_conv.is_owned = false;
52383         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52384         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
52385         return ret_arr;
52386 }
52387
52388 uint64_t  __attribute__((export_name("TS_Invoice_payment_metadata"))) TS_Invoice_payment_metadata(uint64_t this_arg) {
52389         LDKInvoice this_arg_conv;
52390         this_arg_conv.inner = untag_ptr(this_arg);
52391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52393         this_arg_conv.is_owned = false;
52394         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52395         *ret_copy = Invoice_payment_metadata(&this_arg_conv);
52396         uint64_t ret_ref = tag_ptr(ret_copy, true);
52397         return ret_ref;
52398 }
52399
52400 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
52401         LDKInvoice this_arg_conv;
52402         this_arg_conv.inner = untag_ptr(this_arg);
52403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52405         this_arg_conv.is_owned = false;
52406         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
52407         uint64_t ret_ref = 0;
52408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52410         return ret_ref;
52411 }
52412
52413 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
52414         LDKInvoice this_arg_conv;
52415         this_arg_conv.inner = untag_ptr(this_arg);
52416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52418         this_arg_conv.is_owned = false;
52419         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52420         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
52421         return ret_arr;
52422 }
52423
52424 uint64_t  __attribute__((export_name("TS_Invoice_expires_at"))) TS_Invoice_expires_at(uint64_t this_arg) {
52425         LDKInvoice this_arg_conv;
52426         this_arg_conv.inner = untag_ptr(this_arg);
52427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52429         this_arg_conv.is_owned = false;
52430         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
52431         *ret_copy = Invoice_expires_at(&this_arg_conv);
52432         uint64_t ret_ref = tag_ptr(ret_copy, true);
52433         return ret_ref;
52434 }
52435
52436 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
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         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
52443         return ret_conv;
52444 }
52445
52446 int64_t  __attribute__((export_name("TS_Invoice_expiration_remaining_from_epoch"))) TS_Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
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_expiration_remaining_from_epoch(&this_arg_conv, time);
52453         return ret_conv;
52454 }
52455
52456 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
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         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
52463         return ret_conv;
52464 }
52465
52466 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry_delta"))) TS_Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
52467         LDKInvoice this_arg_conv;
52468         this_arg_conv.inner = untag_ptr(this_arg);
52469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52471         this_arg_conv.is_owned = false;
52472         int64_t ret_conv = Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
52473         return ret_conv;
52474 }
52475
52476 ptrArray  __attribute__((export_name("TS_Invoice_fallback_addresses"))) TS_Invoice_fallback_addresses(uint64_t this_arg) {
52477         LDKInvoice this_arg_conv;
52478         this_arg_conv.inner = untag_ptr(this_arg);
52479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52481         this_arg_conv.is_owned = false;
52482         LDKCVec_AddressZ ret_var = Invoice_fallback_addresses(&this_arg_conv);
52483         ptrArray ret_arr = NULL;
52484         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
52485         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
52486         for (size_t i = 0; i < ret_var.datalen; i++) {
52487                 LDKStr ret_conv_8_str = ret_var.data[i];
52488                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
52489                 Str_free(ret_conv_8_str);
52490                 ret_arr_ptr[i] = ret_conv_8_conv;
52491         }
52492         
52493         FREE(ret_var.data);
52494         return ret_arr;
52495 }
52496
52497 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
52498         LDKInvoice this_arg_conv;
52499         this_arg_conv.inner = untag_ptr(this_arg);
52500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52502         this_arg_conv.is_owned = false;
52503         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
52504         uint64_tArray ret_arr = NULL;
52505         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52506         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52507         for (size_t o = 0; o < ret_var.datalen; o++) {
52508                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
52509                 uint64_t ret_conv_14_ref = 0;
52510                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
52511                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
52512                 ret_arr_ptr[o] = ret_conv_14_ref;
52513         }
52514         
52515         FREE(ret_var.data);
52516         return ret_arr;
52517 }
52518
52519 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
52520         LDKInvoice this_arg_conv;
52521         this_arg_conv.inner = untag_ptr(this_arg);
52522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52524         this_arg_conv.is_owned = false;
52525         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
52526         uint64_tArray ret_arr = NULL;
52527         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52528         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52529         for (size_t l = 0; l < ret_var.datalen; l++) {
52530                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
52531                 uint64_t ret_conv_11_ref = 0;
52532                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
52533                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
52534                 ret_arr_ptr[l] = ret_conv_11_ref;
52535         }
52536         
52537         FREE(ret_var.data);
52538         return ret_arr;
52539 }
52540
52541 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
52542         LDKInvoice this_arg_conv;
52543         this_arg_conv.inner = untag_ptr(this_arg);
52544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52546         this_arg_conv.is_owned = false;
52547         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
52548         return ret_conv;
52549 }
52550
52551 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
52552         LDKInvoice this_arg_conv;
52553         this_arg_conv.inner = untag_ptr(this_arg);
52554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52556         this_arg_conv.is_owned = false;
52557         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52558         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
52559         uint64_t ret_ref = tag_ptr(ret_copy, true);
52560         return ret_ref;
52561 }
52562
52563 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
52564         LDKStr description_conv = str_ref_to_owned_c(description);
52565         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
52566         *ret_conv = Description_new(description_conv);
52567         return tag_ptr(ret_conv, true);
52568 }
52569
52570 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
52571         LDKDescription this_arg_conv;
52572         this_arg_conv.inner = untag_ptr(this_arg);
52573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52575         this_arg_conv = Description_clone(&this_arg_conv);
52576         LDKStr ret_str = Description_into_inner(this_arg_conv);
52577         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52578         Str_free(ret_str);
52579         return ret_conv;
52580 }
52581
52582 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
52583         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
52584         uint64_t ret_ref = 0;
52585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52587         return ret_ref;
52588 }
52589
52590 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
52591         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
52592         uint64_t ret_ref = 0;
52593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52595         return ret_ref;
52596 }
52597
52598 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
52599         LDKExpiryTime this_arg_conv;
52600         this_arg_conv.inner = untag_ptr(this_arg);
52601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52603         this_arg_conv.is_owned = false;
52604         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
52605         return ret_conv;
52606 }
52607
52608 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
52609         LDKExpiryTime this_arg_conv;
52610         this_arg_conv.inner = untag_ptr(this_arg);
52611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52613         this_arg_conv.is_owned = false;
52614         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
52615         return ret_conv;
52616 }
52617
52618 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
52619         LDKRouteHint hops_conv;
52620         hops_conv.inner = untag_ptr(hops);
52621         hops_conv.is_owned = ptr_is_owned(hops);
52622         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
52623         hops_conv = RouteHint_clone(&hops_conv);
52624         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
52625         *ret_conv = PrivateRoute_new(hops_conv);
52626         return tag_ptr(ret_conv, true);
52627 }
52628
52629 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
52630         LDKPrivateRoute this_arg_conv;
52631         this_arg_conv.inner = untag_ptr(this_arg);
52632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52634         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
52635         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
52636         uint64_t ret_ref = 0;
52637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52639         return ret_ref;
52640 }
52641
52642 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
52643         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
52644         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
52645         return ret_conv;
52646 }
52647
52648 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
52649         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
52650         return ret_conv;
52651 }
52652
52653 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
52654         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
52655         return ret_conv;
52656 }
52657
52658 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
52659         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
52660         return ret_conv;
52661 }
52662
52663 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
52664         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
52665         return ret_conv;
52666 }
52667
52668 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
52669         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
52670         return ret_conv;
52671 }
52672
52673 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
52674         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
52675         return ret_conv;
52676 }
52677
52678 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
52679         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
52680         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
52681         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
52682         return ret_conv;
52683 }
52684
52685 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
52686         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
52687         LDKStr ret_str = CreationError_to_str(o_conv);
52688         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52689         Str_free(ret_str);
52690         return ret_conv;
52691 }
52692
52693 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
52694         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
52695         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
52696         return ret_conv;
52697 }
52698
52699 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
52700         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
52701         return ret_conv;
52702 }
52703
52704 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
52705         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
52706         return ret_conv;
52707 }
52708
52709 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
52710         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
52711         return ret_conv;
52712 }
52713
52714 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
52715         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
52716         return ret_conv;
52717 }
52718
52719 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
52720         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
52721         return ret_conv;
52722 }
52723
52724 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
52725         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
52726         return ret_conv;
52727 }
52728
52729 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
52730         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
52731         return ret_conv;
52732 }
52733
52734 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
52735         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
52736         return ret_conv;
52737 }
52738
52739 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
52740         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
52741         return ret_conv;
52742 }
52743
52744 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
52745         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
52746         return ret_conv;
52747 }
52748
52749 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
52750         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
52751         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
52752         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
52753         return ret_conv;
52754 }
52755
52756 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
52757         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
52758         LDKStr ret_str = SemanticError_to_str(o_conv);
52759         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52760         Str_free(ret_str);
52761         return ret_conv;
52762 }
52763
52764 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
52765         if (!ptr_is_owned(this_ptr)) return;
52766         void* this_ptr_ptr = untag_ptr(this_ptr);
52767         CHECK_ACCESS(this_ptr_ptr);
52768         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
52769         FREE(untag_ptr(this_ptr));
52770         SignOrCreationError_free(this_ptr_conv);
52771 }
52772
52773 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
52774         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52775         *ret_copy = SignOrCreationError_clone(arg);
52776         uint64_t ret_ref = tag_ptr(ret_copy, true);
52777         return ret_ref;
52778 }
52779 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
52780         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
52781         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
52782         return ret_conv;
52783 }
52784
52785 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
52786         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
52787         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52788         *ret_copy = SignOrCreationError_clone(orig_conv);
52789         uint64_t ret_ref = tag_ptr(ret_copy, true);
52790         return ret_ref;
52791 }
52792
52793 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
52794         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52795         *ret_copy = SignOrCreationError_sign_error();
52796         uint64_t ret_ref = tag_ptr(ret_copy, true);
52797         return ret_ref;
52798 }
52799
52800 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
52801         LDKCreationError a_conv = LDKCreationError_from_js(a);
52802         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52803         *ret_copy = SignOrCreationError_creation_error(a_conv);
52804         uint64_t ret_ref = tag_ptr(ret_copy, true);
52805         return ret_ref;
52806 }
52807
52808 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
52809         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
52810         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
52811         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
52812         return ret_conv;
52813 }
52814
52815 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
52816         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
52817         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
52818         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52819         Str_free(ret_str);
52820         return ret_conv;
52821 }
52822
52823 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, 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         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52830         CHECK_ACCESS(retry_strategy_ptr);
52831         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52832         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52833         LDKChannelManager channelmanager_conv;
52834         channelmanager_conv.inner = untag_ptr(channelmanager);
52835         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52836         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52837         channelmanager_conv.is_owned = false;
52838         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
52839         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
52840         return tag_ptr(ret_conv, true);
52841 }
52842
52843 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) {
52844         LDKInvoice invoice_conv;
52845         invoice_conv.inner = untag_ptr(invoice);
52846         invoice_conv.is_owned = ptr_is_owned(invoice);
52847         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52848         invoice_conv.is_owned = false;
52849         LDKThirtyTwoBytes payment_id_ref;
52850         CHECK(payment_id->arr_len == 32);
52851         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
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_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
52862         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, 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"))) TS_pay_zero_value_invoice(uint64_t invoice, int64_t amount_msats, 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         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52873         CHECK_ACCESS(retry_strategy_ptr);
52874         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52875         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52876         LDKChannelManager channelmanager_conv;
52877         channelmanager_conv.inner = untag_ptr(channelmanager);
52878         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52879         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52880         channelmanager_conv.is_owned = false;
52881         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
52882         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
52883         return tag_ptr(ret_conv, true);
52884 }
52885
52886 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) {
52887         LDKInvoice invoice_conv;
52888         invoice_conv.inner = untag_ptr(invoice);
52889         invoice_conv.is_owned = ptr_is_owned(invoice);
52890         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52891         invoice_conv.is_owned = false;
52892         LDKThirtyTwoBytes payment_id_ref;
52893         CHECK(payment_id->arr_len == 32);
52894         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
52895         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52896         CHECK_ACCESS(retry_strategy_ptr);
52897         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52898         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52899         LDKChannelManager channelmanager_conv;
52900         channelmanager_conv.inner = untag_ptr(channelmanager);
52901         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52902         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52903         channelmanager_conv.is_owned = false;
52904         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
52905         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
52906         return tag_ptr(ret_conv, true);
52907 }
52908
52909 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
52910         if (!ptr_is_owned(this_ptr)) return;
52911         void* this_ptr_ptr = untag_ptr(this_ptr);
52912         CHECK_ACCESS(this_ptr_ptr);
52913         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
52914         FREE(untag_ptr(this_ptr));
52915         PaymentError_free(this_ptr_conv);
52916 }
52917
52918 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
52919         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52920         *ret_copy = PaymentError_clone(arg);
52921         uint64_t ret_ref = tag_ptr(ret_copy, true);
52922         return ret_ref;
52923 }
52924 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
52925         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
52926         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
52927         return ret_conv;
52928 }
52929
52930 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
52931         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
52932         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52933         *ret_copy = PaymentError_clone(orig_conv);
52934         uint64_t ret_ref = tag_ptr(ret_copy, true);
52935         return ret_ref;
52936 }
52937
52938 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
52939         LDKStr a_conv = str_ref_to_owned_c(a);
52940         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52941         *ret_copy = PaymentError_invoice(a_conv);
52942         uint64_t ret_ref = tag_ptr(ret_copy, true);
52943         return ret_ref;
52944 }
52945
52946 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
52947         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
52948         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52949         *ret_copy = PaymentError_sending(a_conv);
52950         uint64_t ret_ref = tag_ptr(ret_copy, true);
52951         return ret_ref;
52952 }
52953
52954 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) {
52955         void* amt_msat_ptr = untag_ptr(amt_msat);
52956         CHECK_ACCESS(amt_msat_ptr);
52957         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
52958         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
52959         LDKThirtyTwoBytes payment_hash_ref;
52960         CHECK(payment_hash->arr_len == 32);
52961         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
52962         LDKStr description_conv = str_ref_to_owned_c(description);
52963         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
52964         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
52965         if (phantom_route_hints_constr.datalen > 0)
52966                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
52967         else
52968                 phantom_route_hints_constr.data = NULL;
52969         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
52970         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
52971                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
52972                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
52973                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
52974                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
52975                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
52976                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
52977                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
52978         }
52979         FREE(phantom_route_hints);
52980         void* entropy_source_ptr = untag_ptr(entropy_source);
52981         CHECK_ACCESS(entropy_source_ptr);
52982         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
52983         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
52984                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52985                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
52986         }
52987         void* node_signer_ptr = untag_ptr(node_signer);
52988         CHECK_ACCESS(node_signer_ptr);
52989         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52990         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52991                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52992                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52993         }
52994         void* logger_ptr = untag_ptr(logger);
52995         CHECK_ACCESS(logger_ptr);
52996         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52997         if (logger_conv.free == LDKLogger_JCalls_free) {
52998                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52999                 LDKLogger_JCalls_cloned(&logger_conv);
53000         }
53001         LDKCurrency network_conv = LDKCurrency_from_js(network);
53002         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53003         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53004         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53005         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53006         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53007         *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);
53008         return tag_ptr(ret_conv, true);
53009 }
53010
53011 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) {
53012         void* amt_msat_ptr = untag_ptr(amt_msat);
53013         CHECK_ACCESS(amt_msat_ptr);
53014         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53015         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53016         LDKThirtyTwoBytes payment_hash_ref;
53017         CHECK(payment_hash->arr_len == 32);
53018         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
53019         LDKSha256 description_hash_conv;
53020         description_hash_conv.inner = untag_ptr(description_hash);
53021         description_hash_conv.is_owned = ptr_is_owned(description_hash);
53022         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
53023         description_hash_conv = Sha256_clone(&description_hash_conv);
53024         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
53025         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
53026         if (phantom_route_hints_constr.datalen > 0)
53027                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
53028         else
53029                 phantom_route_hints_constr.data = NULL;
53030         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
53031         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
53032                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
53033                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
53034                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
53035                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
53036                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
53037                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
53038                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
53039         }
53040         FREE(phantom_route_hints);
53041         void* entropy_source_ptr = untag_ptr(entropy_source);
53042         CHECK_ACCESS(entropy_source_ptr);
53043         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
53044         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
53045                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53046                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
53047         }
53048         void* node_signer_ptr = untag_ptr(node_signer);
53049         CHECK_ACCESS(node_signer_ptr);
53050         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53051         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53052                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53053                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53054         }
53055         void* logger_ptr = untag_ptr(logger);
53056         CHECK_ACCESS(logger_ptr);
53057         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53058         if (logger_conv.free == LDKLogger_JCalls_free) {
53059                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53060                 LDKLogger_JCalls_cloned(&logger_conv);
53061         }
53062         LDKCurrency network_conv = LDKCurrency_from_js(network);
53063         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53064         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53065         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53066         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53067         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53068         *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);
53069         return tag_ptr(ret_conv, true);
53070 }
53071
53072 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) {
53073         LDKChannelManager channelmanager_conv;
53074         channelmanager_conv.inner = untag_ptr(channelmanager);
53075         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53076         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53077         channelmanager_conv.is_owned = false;
53078         void* node_signer_ptr = untag_ptr(node_signer);
53079         CHECK_ACCESS(node_signer_ptr);
53080         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53081         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53082                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53083                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53084         }
53085         void* logger_ptr = untag_ptr(logger);
53086         CHECK_ACCESS(logger_ptr);
53087         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53088         if (logger_conv.free == LDKLogger_JCalls_free) {
53089                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53090                 LDKLogger_JCalls_cloned(&logger_conv);
53091         }
53092         LDKCurrency network_conv = LDKCurrency_from_js(network);
53093         void* amt_msat_ptr = untag_ptr(amt_msat);
53094         CHECK_ACCESS(amt_msat_ptr);
53095         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53096         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53097         LDKSha256 description_hash_conv;
53098         description_hash_conv.inner = untag_ptr(description_hash);
53099         description_hash_conv.is_owned = ptr_is_owned(description_hash);
53100         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
53101         description_hash_conv = Sha256_clone(&description_hash_conv);
53102         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53103         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53104         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53105         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53106         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53107         *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);
53108         return tag_ptr(ret_conv, true);
53109 }
53110
53111 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) {
53112         LDKChannelManager channelmanager_conv;
53113         channelmanager_conv.inner = untag_ptr(channelmanager);
53114         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53115         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53116         channelmanager_conv.is_owned = false;
53117         void* node_signer_ptr = untag_ptr(node_signer);
53118         CHECK_ACCESS(node_signer_ptr);
53119         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53120         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53121                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53122                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53123         }
53124         void* logger_ptr = untag_ptr(logger);
53125         CHECK_ACCESS(logger_ptr);
53126         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53127         if (logger_conv.free == LDKLogger_JCalls_free) {
53128                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53129                 LDKLogger_JCalls_cloned(&logger_conv);
53130         }
53131         LDKCurrency network_conv = LDKCurrency_from_js(network);
53132         void* amt_msat_ptr = untag_ptr(amt_msat);
53133         CHECK_ACCESS(amt_msat_ptr);
53134         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53135         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53136         LDKStr description_conv = str_ref_to_owned_c(description);
53137         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53138         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53139         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53140         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53141         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53142         *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);
53143         return tag_ptr(ret_conv, true);
53144 }
53145
53146 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) {
53147         LDKChannelManager channelmanager_conv;
53148         channelmanager_conv.inner = untag_ptr(channelmanager);
53149         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53150         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53151         channelmanager_conv.is_owned = false;
53152         void* node_signer_ptr = untag_ptr(node_signer);
53153         CHECK_ACCESS(node_signer_ptr);
53154         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53155         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53156                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53157                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53158         }
53159         void* logger_ptr = untag_ptr(logger);
53160         CHECK_ACCESS(logger_ptr);
53161         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53162         if (logger_conv.free == LDKLogger_JCalls_free) {
53163                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53164                 LDKLogger_JCalls_cloned(&logger_conv);
53165         }
53166         LDKCurrency network_conv = LDKCurrency_from_js(network);
53167         void* amt_msat_ptr = untag_ptr(amt_msat);
53168         CHECK_ACCESS(amt_msat_ptr);
53169         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53170         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53171         LDKStr description_conv = str_ref_to_owned_c(description);
53172         LDKThirtyTwoBytes payment_hash_ref;
53173         CHECK(payment_hash->arr_len == 32);
53174         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
53175         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53176         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53177         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53178         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53179         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53180         *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);
53181         return tag_ptr(ret_conv, true);
53182 }
53183
53184 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
53185         LDKStr s_conv = str_ref_to_owned_c(s);
53186         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
53187         *ret_conv = SiPrefix_from_str(s_conv);
53188         return tag_ptr(ret_conv, true);
53189 }
53190
53191 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
53192         LDKStr s_conv = str_ref_to_owned_c(s);
53193         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
53194         *ret_conv = Invoice_from_str(s_conv);
53195         return tag_ptr(ret_conv, true);
53196 }
53197
53198 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
53199         LDKStr s_conv = str_ref_to_owned_c(s);
53200         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
53201         *ret_conv = SignedRawInvoice_from_str(s_conv);
53202         return tag_ptr(ret_conv, true);
53203 }
53204
53205 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
53206         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
53207         LDKStr ret_str = ParseError_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_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
53214         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
53215         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
53216         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53217         Str_free(ret_str);
53218         return ret_conv;
53219 }
53220
53221 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
53222         LDKInvoice o_conv;
53223         o_conv.inner = untag_ptr(o);
53224         o_conv.is_owned = ptr_is_owned(o);
53225         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53226         o_conv.is_owned = false;
53227         LDKStr ret_str = Invoice_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_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
53234         LDKSignedRawInvoice o_conv;
53235         o_conv.inner = untag_ptr(o);
53236         o_conv.is_owned = ptr_is_owned(o);
53237         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53238         o_conv.is_owned = false;
53239         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
53240         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53241         Str_free(ret_str);
53242         return ret_conv;
53243 }
53244
53245 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
53246         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
53247         LDKStr ret_str = Currency_to_str(o_conv);
53248         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53249         Str_free(ret_str);
53250         return ret_conv;
53251 }
53252
53253 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
53254         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
53255         LDKStr ret_str = SiPrefix_to_str(o_conv);
53256         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53257         Str_free(ret_str);
53258         return ret_conv;
53259 }
53260