[TS] Update auto-generated TS 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 LDKRecipient LDKRecipient_from_js(int32_t ord) {
366         switch (ord) {
367                 case 0: return LDKRecipient_Node;
368                 case 1: return LDKRecipient_PhantomNode;
369         }
370         abort();
371 }
372 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
373         switch (val) {
374                 case LDKRecipient_Node: return 0;
375                 case LDKRecipient_PhantomNode: return 1;
376                 default: abort();
377         }
378 }
379 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
380         switch (ord) {
381                 case 0: return LDKRetryableSendFailure_PaymentExpired;
382                 case 1: return LDKRetryableSendFailure_RouteNotFound;
383                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
384         }
385         abort();
386 }
387 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
388         switch (val) {
389                 case LDKRetryableSendFailure_PaymentExpired: return 0;
390                 case LDKRetryableSendFailure_RouteNotFound: return 1;
391                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
392                 default: abort();
393         }
394 }
395 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
396         switch (ord) {
397                 case 0: return LDKSecp256k1Error_IncorrectSignature;
398                 case 1: return LDKSecp256k1Error_InvalidMessage;
399                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
400                 case 3: return LDKSecp256k1Error_InvalidSignature;
401                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
402                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
403                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
404                 case 7: return LDKSecp256k1Error_InvalidTweak;
405                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
406                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
407                 case 10: return LDKSecp256k1Error_InvalidParityValue;
408         }
409         abort();
410 }
411 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
412         switch (val) {
413                 case LDKSecp256k1Error_IncorrectSignature: return 0;
414                 case LDKSecp256k1Error_InvalidMessage: return 1;
415                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
416                 case LDKSecp256k1Error_InvalidSignature: return 3;
417                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
418                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
419                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
420                 case LDKSecp256k1Error_InvalidTweak: return 7;
421                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
422                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
423                 case LDKSecp256k1Error_InvalidParityValue: return 10;
424                 default: abort();
425         }
426 }
427 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
428         switch (ord) {
429                 case 0: return LDKSemanticError_NoPaymentHash;
430                 case 1: return LDKSemanticError_MultiplePaymentHashes;
431                 case 2: return LDKSemanticError_NoDescription;
432                 case 3: return LDKSemanticError_MultipleDescriptions;
433                 case 4: return LDKSemanticError_NoPaymentSecret;
434                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
435                 case 6: return LDKSemanticError_InvalidFeatures;
436                 case 7: return LDKSemanticError_InvalidRecoveryId;
437                 case 8: return LDKSemanticError_InvalidSignature;
438                 case 9: return LDKSemanticError_ImpreciseAmount;
439         }
440         abort();
441 }
442 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
443         switch (val) {
444                 case LDKSemanticError_NoPaymentHash: return 0;
445                 case LDKSemanticError_MultiplePaymentHashes: return 1;
446                 case LDKSemanticError_NoDescription: return 2;
447                 case LDKSemanticError_MultipleDescriptions: return 3;
448                 case LDKSemanticError_NoPaymentSecret: return 4;
449                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
450                 case LDKSemanticError_InvalidFeatures: return 6;
451                 case LDKSemanticError_InvalidRecoveryId: return 7;
452                 case LDKSemanticError_InvalidSignature: return 8;
453                 case LDKSemanticError_ImpreciseAmount: return 9;
454                 default: abort();
455         }
456 }
457 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
458         switch (ord) {
459                 case 0: return LDKSiPrefix_Milli;
460                 case 1: return LDKSiPrefix_Micro;
461                 case 2: return LDKSiPrefix_Nano;
462                 case 3: return LDKSiPrefix_Pico;
463         }
464         abort();
465 }
466 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
467         switch (val) {
468                 case LDKSiPrefix_Milli: return 0;
469                 case LDKSiPrefix_Micro: return 1;
470                 case LDKSiPrefix_Nano: return 2;
471                 case LDKSiPrefix_Pico: return 3;
472                 default: abort();
473         }
474 }
475 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
476         switch (ord) {
477                 case 0: return LDKUtxoLookupError_UnknownChain;
478                 case 1: return LDKUtxoLookupError_UnknownTx;
479         }
480         abort();
481 }
482 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
483         switch (val) {
484                 case LDKUtxoLookupError_UnknownChain: return 0;
485                 case LDKUtxoLookupError_UnknownTx: return 1;
486                 default: abort();
487         }
488 }
489 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
490         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
491         return ret;
492 }
493 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
494         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
495         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
496         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
497         return ret_arr;
498 }
499
500 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
501 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
502         if (!ptr_is_owned(thing)) return;
503         void* thing_ptr = untag_ptr(thing);
504         CHECK_ACCESS(thing_ptr);
505         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
506         FREE(untag_ptr(thing));
507         BigEndianScalar_free(thing_conv);
508 }
509
510 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
511         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
512         switch(obj->tag) {
513                 case LDKBech32Error_MissingSeparator: return 0;
514                 case LDKBech32Error_InvalidChecksum: return 1;
515                 case LDKBech32Error_InvalidLength: return 2;
516                 case LDKBech32Error_InvalidChar: return 3;
517                 case LDKBech32Error_InvalidData: return 4;
518                 case LDKBech32Error_InvalidPadding: return 5;
519                 case LDKBech32Error_MixedCase: return 6;
520                 default: abort();
521         }
522 }
523 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
524         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
525         assert(obj->tag == LDKBech32Error_InvalidChar);
526                         int32_t invalid_char_conv = obj->invalid_char;
527         return invalid_char_conv;
528 }
529 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
530         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
531         assert(obj->tag == LDKBech32Error_InvalidData);
532                         int8_t invalid_data_conv = obj->invalid_data;
533         return invalid_data_conv;
534 }
535 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
536         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
537         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
538         return ret;
539 }
540 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) {
541         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
542         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
543         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
544         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
545         CVec_u8Z_free(ret_var);
546         return ret_arr;
547 }
548
549 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) {
550         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
551         int64_t ret_conv = TxOut_get_value(thing_conv);
552         return ret_conv;
553 }
554
555 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
556         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
557         switch(obj->tag) {
558                 case LDKAPIError_APIMisuseError: return 0;
559                 case LDKAPIError_FeeRateTooHigh: return 1;
560                 case LDKAPIError_InvalidRoute: return 2;
561                 case LDKAPIError_ChannelUnavailable: return 3;
562                 case LDKAPIError_MonitorUpdateInProgress: return 4;
563                 case LDKAPIError_IncompatibleShutdownScript: return 5;
564                 default: abort();
565         }
566 }
567 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
568         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
569         assert(obj->tag == LDKAPIError_APIMisuseError);
570                         LDKStr err_str = obj->api_misuse_error.err;
571                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
572         return err_conv;
573 }
574 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
575         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
576         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
577                         LDKStr err_str = obj->fee_rate_too_high.err;
578                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
579         return err_conv;
580 }
581 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
582         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
583         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
584                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
585         return feerate_conv;
586 }
587 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
588         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
589         assert(obj->tag == LDKAPIError_InvalidRoute);
590                         LDKStr err_str = obj->invalid_route.err;
591                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
592         return err_conv;
593 }
594 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
595         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
596         assert(obj->tag == LDKAPIError_ChannelUnavailable);
597                         LDKStr err_str = obj->channel_unavailable.err;
598                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
599         return err_conv;
600 }
601 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
602         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
603         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
604                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
605                         uint64_t script_ref = 0;
606                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
607                         script_ref = tag_ptr(script_var.inner, false);
608         return script_ref;
609 }
610 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
611 CHECK(owner->result_ok);
612         return *owner->contents.result;
613 }
614 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
615         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
616         CResult_NoneAPIErrorZ_get_ok(owner_conv);
617 }
618
619 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
620 CHECK(!owner->result_ok);
621         return APIError_clone(&*owner->contents.err);
622 }
623 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
624         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
625         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
626         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
627         uint64_t ret_ref = tag_ptr(ret_copy, true);
628         return ret_ref;
629 }
630
631 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
632         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
633         for (size_t i = 0; i < ret.datalen; i++) {
634                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
635         }
636         return ret;
637 }
638 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
639         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
640         for (size_t i = 0; i < ret.datalen; i++) {
641                 ret.data[i] = APIError_clone(&orig->data[i]);
642         }
643         return ret;
644 }
645 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
646         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
647         switch(obj->tag) {
648                 case LDKCOption_HTLCClaimZ_Some: return 0;
649                 case LDKCOption_HTLCClaimZ_None: return 1;
650                 default: abort();
651         }
652 }
653 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
654         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
655         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
656                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
657         return some_conv;
658 }
659 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
660 CHECK(owner->result_ok);
661         return *owner->contents.result;
662 }
663 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
664         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
665         CResult_NoneNoneZ_get_ok(owner_conv);
666 }
667
668 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
669 CHECK(!owner->result_ok);
670         return *owner->contents.err;
671 }
672 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
673         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
674         CResult_NoneNoneZ_get_err(owner_conv);
675 }
676
677 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
678         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
679         switch(obj->tag) {
680                 case LDKDecodeError_UnknownVersion: return 0;
681                 case LDKDecodeError_UnknownRequiredFeature: return 1;
682                 case LDKDecodeError_InvalidValue: return 2;
683                 case LDKDecodeError_ShortRead: return 3;
684                 case LDKDecodeError_BadLengthDescriptor: return 4;
685                 case LDKDecodeError_Io: return 5;
686                 case LDKDecodeError_UnsupportedCompression: return 6;
687                 default: abort();
688         }
689 }
690 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
691         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
692         assert(obj->tag == LDKDecodeError_Io);
693                         uint32_t io_conv = LDKIOError_to_js(obj->io);
694         return io_conv;
695 }
696 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
697         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
698         ret.is_owned = false;
699         return ret;
700 }
701 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
702         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
703         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
704         uint64_t ret_ref = 0;
705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
707         return ret_ref;
708 }
709
710 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
711 CHECK(!owner->result_ok);
712         return DecodeError_clone(&*owner->contents.err);
713 }
714 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
715         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
717         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
718         uint64_t ret_ref = tag_ptr(ret_copy, true);
719         return ret_ref;
720 }
721
722 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
723         LDKTxCreationKeys ret = *owner->contents.result;
724         ret.is_owned = false;
725         return ret;
726 }
727 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
728         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
729         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
730         uint64_t ret_ref = 0;
731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
733         return ret_ref;
734 }
735
736 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
737 CHECK(!owner->result_ok);
738         return DecodeError_clone(&*owner->contents.err);
739 }
740 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
741         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
743         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
744         uint64_t ret_ref = tag_ptr(ret_copy, true);
745         return ret_ref;
746 }
747
748 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
749         LDKChannelPublicKeys ret = *owner->contents.result;
750         ret.is_owned = false;
751         return ret;
752 }
753 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
754         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
755         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
756         uint64_t ret_ref = 0;
757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
759         return ret_ref;
760 }
761
762 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
763 CHECK(!owner->result_ok);
764         return DecodeError_clone(&*owner->contents.err);
765 }
766 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
767         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
768         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
769         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
770         uint64_t ret_ref = tag_ptr(ret_copy, true);
771         return ret_ref;
772 }
773
774 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
775         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
776         switch(obj->tag) {
777                 case LDKCOption_u32Z_Some: return 0;
778                 case LDKCOption_u32Z_None: return 1;
779                 default: abort();
780         }
781 }
782 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
783         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
784         assert(obj->tag == LDKCOption_u32Z_Some);
785                         int32_t some_conv = obj->some;
786         return some_conv;
787 }
788 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
789         LDKHTLCOutputInCommitment ret = *owner->contents.result;
790         ret.is_owned = false;
791         return ret;
792 }
793 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
794         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
795         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
796         uint64_t ret_ref = 0;
797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
799         return ret_ref;
800 }
801
802 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
803 CHECK(!owner->result_ok);
804         return DecodeError_clone(&*owner->contents.err);
805 }
806 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
807         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
808         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
809         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
810         uint64_t ret_ref = tag_ptr(ret_copy, true);
811         return ret_ref;
812 }
813
814 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
815         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
816         ret.is_owned = false;
817         return ret;
818 }
819 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
820         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
821         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
822         uint64_t ret_ref = 0;
823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
825         return ret_ref;
826 }
827
828 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
829 CHECK(!owner->result_ok);
830         return DecodeError_clone(&*owner->contents.err);
831 }
832 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
833         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
834         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
835         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
836         uint64_t ret_ref = tag_ptr(ret_copy, true);
837         return ret_ref;
838 }
839
840 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
841         LDKChannelTransactionParameters ret = *owner->contents.result;
842         ret.is_owned = false;
843         return ret;
844 }
845 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
846         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
847         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
848         uint64_t ret_ref = 0;
849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
851         return ret_ref;
852 }
853
854 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
855 CHECK(!owner->result_ok);
856         return DecodeError_clone(&*owner->contents.err);
857 }
858 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
859         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
860         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
861         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
862         uint64_t ret_ref = tag_ptr(ret_copy, true);
863         return ret_ref;
864 }
865
866 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
867         LDKHolderCommitmentTransaction ret = *owner->contents.result;
868         ret.is_owned = false;
869         return ret;
870 }
871 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
872         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
873         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
874         uint64_t ret_ref = 0;
875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
877         return ret_ref;
878 }
879
880 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
881 CHECK(!owner->result_ok);
882         return DecodeError_clone(&*owner->contents.err);
883 }
884 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
885         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
886         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
887         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
888         uint64_t ret_ref = tag_ptr(ret_copy, true);
889         return ret_ref;
890 }
891
892 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
893         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
894         ret.is_owned = false;
895         return ret;
896 }
897 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
898         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
899         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
900         uint64_t ret_ref = 0;
901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
903         return ret_ref;
904 }
905
906 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
907 CHECK(!owner->result_ok);
908         return DecodeError_clone(&*owner->contents.err);
909 }
910 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
911         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
912         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
913         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
914         uint64_t ret_ref = tag_ptr(ret_copy, true);
915         return ret_ref;
916 }
917
918 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
919         LDKTrustedClosingTransaction ret = *owner->contents.result;
920         ret.is_owned = false;
921         return ret;
922 }
923 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
924         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
925         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
926         uint64_t ret_ref = 0;
927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
929         return ret_ref;
930 }
931
932 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
933 CHECK(!owner->result_ok);
934         return *owner->contents.err;
935 }
936 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
937         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
938         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
939 }
940
941 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
942         LDKCommitmentTransaction ret = *owner->contents.result;
943         ret.is_owned = false;
944         return ret;
945 }
946 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
947         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
948         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
949         uint64_t ret_ref = 0;
950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
952         return ret_ref;
953 }
954
955 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
956 CHECK(!owner->result_ok);
957         return DecodeError_clone(&*owner->contents.err);
958 }
959 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
960         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
961         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
962         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
963         uint64_t ret_ref = tag_ptr(ret_copy, true);
964         return ret_ref;
965 }
966
967 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
968         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
969         ret.is_owned = false;
970         return ret;
971 }
972 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
973         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
974         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
975         uint64_t ret_ref = 0;
976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
978         return ret_ref;
979 }
980
981 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
982 CHECK(!owner->result_ok);
983         return *owner->contents.err;
984 }
985 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
986         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
987         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
988 }
989
990 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
991 CHECK(owner->result_ok);
992         return *owner->contents.result;
993 }
994 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
995         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
996         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
997         ptrArray ret_arr = NULL;
998         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
999         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1000         for (size_t m = 0; m < ret_var.datalen; m++) {
1001                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1002                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1003                 ret_arr_ptr[m] = ret_conv_12_arr;
1004         }
1005         
1006         return ret_arr;
1007 }
1008
1009 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1010 CHECK(!owner->result_ok);
1011         return *owner->contents.err;
1012 }
1013 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
1014         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1015         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1016 }
1017
1018 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1019         LDKShutdownScript ret = *owner->contents.result;
1020         ret.is_owned = false;
1021         return ret;
1022 }
1023 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1024         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1025         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1026         uint64_t ret_ref = 0;
1027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1029         return ret_ref;
1030 }
1031
1032 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1033 CHECK(!owner->result_ok);
1034         return DecodeError_clone(&*owner->contents.err);
1035 }
1036 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1037         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1038         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1039         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1040         uint64_t ret_ref = tag_ptr(ret_copy, true);
1041         return ret_ref;
1042 }
1043
1044 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1045         LDKShutdownScript ret = *owner->contents.result;
1046         ret.is_owned = false;
1047         return ret;
1048 }
1049 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1050         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1051         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1052         uint64_t ret_ref = 0;
1053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1055         return ret_ref;
1056 }
1057
1058 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1059         LDKInvalidShutdownScript ret = *owner->contents.err;
1060         ret.is_owned = false;
1061         return ret;
1062 }
1063 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1064         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1065         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1066         uint64_t ret_ref = 0;
1067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1069         return ret_ref;
1070 }
1071
1072 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
1073         LDKBlindedPath ret = *owner->contents.result;
1074         ret.is_owned = false;
1075         return ret;
1076 }
1077 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
1078         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
1079         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
1080         uint64_t ret_ref = 0;
1081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1083         return ret_ref;
1084 }
1085
1086 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
1087 CHECK(!owner->result_ok);
1088         return *owner->contents.err;
1089 }
1090 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
1091         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
1092         CResult_BlindedPathNoneZ_get_err(owner_conv);
1093 }
1094
1095 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
1096         LDKBlindedPath ret = *owner->contents.result;
1097         ret.is_owned = false;
1098         return ret;
1099 }
1100 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
1101         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
1102         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
1103         uint64_t ret_ref = 0;
1104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1106         return ret_ref;
1107 }
1108
1109 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
1110 CHECK(!owner->result_ok);
1111         return DecodeError_clone(&*owner->contents.err);
1112 }
1113 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
1114         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
1115         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1116         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
1117         uint64_t ret_ref = tag_ptr(ret_copy, true);
1118         return ret_ref;
1119 }
1120
1121 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1122         LDKBlindedHop ret = *owner->contents.result;
1123         ret.is_owned = false;
1124         return ret;
1125 }
1126 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
1127         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1128         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
1129         uint64_t ret_ref = 0;
1130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1132         return ret_ref;
1133 }
1134
1135 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1136 CHECK(!owner->result_ok);
1137         return DecodeError_clone(&*owner->contents.err);
1138 }
1139 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
1140         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1141         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1142         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
1143         uint64_t ret_ref = tag_ptr(ret_copy, true);
1144         return ret_ref;
1145 }
1146
1147 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1148         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1149         for (size_t i = 0; i < ret.datalen; i++) {
1150                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1151         }
1152         return ret;
1153 }
1154 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1155         LDKRoute ret = *owner->contents.result;
1156         ret.is_owned = false;
1157         return ret;
1158 }
1159 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1160         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1161         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1162         uint64_t ret_ref = 0;
1163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1165         return ret_ref;
1166 }
1167
1168 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1169         LDKLightningError ret = *owner->contents.err;
1170         ret.is_owned = false;
1171         return ret;
1172 }
1173 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1174         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1175         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1176         uint64_t ret_ref = 0;
1177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1179         return ret_ref;
1180 }
1181
1182 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1183         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1184         for (size_t i = 0; i < ret.datalen; i++) {
1185                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1186         }
1187         return ret;
1188 }
1189 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1190         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1191         switch(obj->tag) {
1192                 case LDKCOption_u64Z_Some: return 0;
1193                 case LDKCOption_u64Z_None: return 1;
1194                 default: abort();
1195         }
1196 }
1197 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1198         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1199         assert(obj->tag == LDKCOption_u64Z_Some);
1200                         int64_t some_conv = obj->some;
1201         return some_conv;
1202 }
1203 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1204         LDKInFlightHtlcs ret = *owner->contents.result;
1205         ret.is_owned = false;
1206         return ret;
1207 }
1208 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
1209         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1210         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
1211         uint64_t ret_ref = 0;
1212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1214         return ret_ref;
1215 }
1216
1217 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1218 CHECK(!owner->result_ok);
1219         return DecodeError_clone(&*owner->contents.err);
1220 }
1221 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
1222         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1223         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1224         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
1225         uint64_t ret_ref = tag_ptr(ret_copy, true);
1226         return ret_ref;
1227 }
1228
1229 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1230         LDKRouteHop ret = *owner->contents.result;
1231         ret.is_owned = false;
1232         return ret;
1233 }
1234 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1235         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1236         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1237         uint64_t ret_ref = 0;
1238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1240         return ret_ref;
1241 }
1242
1243 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1244 CHECK(!owner->result_ok);
1245         return DecodeError_clone(&*owner->contents.err);
1246 }
1247 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1248         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1249         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1250         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1251         uint64_t ret_ref = tag_ptr(ret_copy, true);
1252         return ret_ref;
1253 }
1254
1255 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1256         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1257         for (size_t i = 0; i < ret.datalen; i++) {
1258                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1259         }
1260         return ret;
1261 }
1262 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1263         LDKRoute ret = *owner->contents.result;
1264         ret.is_owned = false;
1265         return ret;
1266 }
1267 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1268         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1269         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1270         uint64_t ret_ref = 0;
1271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1273         return ret_ref;
1274 }
1275
1276 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1277 CHECK(!owner->result_ok);
1278         return DecodeError_clone(&*owner->contents.err);
1279 }
1280 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1281         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1282         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1283         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1284         uint64_t ret_ref = tag_ptr(ret_copy, true);
1285         return ret_ref;
1286 }
1287
1288 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1289         LDKRouteParameters ret = *owner->contents.result;
1290         ret.is_owned = false;
1291         return ret;
1292 }
1293 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1294         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1295         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1296         uint64_t ret_ref = 0;
1297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1299         return ret_ref;
1300 }
1301
1302 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1303 CHECK(!owner->result_ok);
1304         return DecodeError_clone(&*owner->contents.err);
1305 }
1306 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1307         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1308         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1309         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1310         uint64_t ret_ref = tag_ptr(ret_copy, true);
1311         return ret_ref;
1312 }
1313
1314 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1315         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1316         for (size_t i = 0; i < ret.datalen; i++) {
1317                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1318         }
1319         return ret;
1320 }
1321 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1322         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1323         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1324         return ret;
1325 }
1326 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1327         LDKPaymentParameters ret = *owner->contents.result;
1328         ret.is_owned = false;
1329         return ret;
1330 }
1331 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1332         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1333         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1334         uint64_t ret_ref = 0;
1335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1337         return ret_ref;
1338 }
1339
1340 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1341 CHECK(!owner->result_ok);
1342         return DecodeError_clone(&*owner->contents.err);
1343 }
1344 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1345         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1346         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1347         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1348         uint64_t ret_ref = tag_ptr(ret_copy, true);
1349         return ret_ref;
1350 }
1351
1352 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1353         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1354         for (size_t i = 0; i < ret.datalen; i++) {
1355                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1356         }
1357         return ret;
1358 }
1359 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1360         LDKRouteHint ret = *owner->contents.result;
1361         ret.is_owned = false;
1362         return ret;
1363 }
1364 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1365         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1366         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1367         uint64_t ret_ref = 0;
1368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1370         return ret_ref;
1371 }
1372
1373 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1374 CHECK(!owner->result_ok);
1375         return DecodeError_clone(&*owner->contents.err);
1376 }
1377 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1378         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1379         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1380         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1381         uint64_t ret_ref = tag_ptr(ret_copy, true);
1382         return ret_ref;
1383 }
1384
1385 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1386         LDKRouteHintHop ret = *owner->contents.result;
1387         ret.is_owned = false;
1388         return ret;
1389 }
1390 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1391         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1392         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1393         uint64_t ret_ref = 0;
1394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1396         return ret_ref;
1397 }
1398
1399 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1400 CHECK(!owner->result_ok);
1401         return DecodeError_clone(&*owner->contents.err);
1402 }
1403 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1404         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1405         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1406         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1407         uint64_t ret_ref = tag_ptr(ret_copy, true);
1408         return ret_ref;
1409 }
1410
1411 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1412         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1413         switch(obj->tag) {
1414                 case LDKPaymentPurpose_InvoicePayment: return 0;
1415                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1416                 default: abort();
1417         }
1418 }
1419 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1420         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1421         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1422                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1423                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1424         return payment_preimage_arr;
1425 }
1426 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1427         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1428         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1429                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1430                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1431         return payment_secret_arr;
1432 }
1433 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1434         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1435         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1436                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1437                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1438         return spontaneous_payment_arr;
1439 }
1440 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1441 CHECK(owner->result_ok);
1442         return PaymentPurpose_clone(&*owner->contents.result);
1443 }
1444 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1445         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1446         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1447         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1448         uint64_t ret_ref = tag_ptr(ret_copy, true);
1449         return ret_ref;
1450 }
1451
1452 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1453 CHECK(!owner->result_ok);
1454         return DecodeError_clone(&*owner->contents.err);
1455 }
1456 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1457         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1458         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1459         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1460         uint64_t ret_ref = tag_ptr(ret_copy, true);
1461         return ret_ref;
1462 }
1463
1464 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1465         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1466         switch(obj->tag) {
1467                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1468                 case LDKNetworkUpdate_ChannelFailure: return 1;
1469                 case LDKNetworkUpdate_NodeFailure: return 2;
1470                 default: abort();
1471         }
1472 }
1473 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1474         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1475         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1476                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1477                         uint64_t msg_ref = 0;
1478                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1479                         msg_ref = tag_ptr(msg_var.inner, false);
1480         return msg_ref;
1481 }
1482 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1483         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1484         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1485                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1486         return short_channel_id_conv;
1487 }
1488 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1489         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1490         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1491                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1492         return is_permanent_conv;
1493 }
1494 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1495         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1496         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1497                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1498                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1499         return node_id_arr;
1500 }
1501 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1502         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1503         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1504                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1505         return is_permanent_conv;
1506 }
1507 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1508         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1509         switch(obj->tag) {
1510                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1511                 case LDKCOption_NetworkUpdateZ_None: return 1;
1512                 default: abort();
1513         }
1514 }
1515 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1516         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1517         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1518                         uint64_t some_ref = tag_ptr(&obj->some, false);
1519         return some_ref;
1520 }
1521 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
1522         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
1523         switch(obj->tag) {
1524                 case LDKPathFailure_InitialSend: return 0;
1525                 case LDKPathFailure_OnPath: return 1;
1526                 default: abort();
1527         }
1528 }
1529 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
1530         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
1531         assert(obj->tag == LDKPathFailure_InitialSend);
1532                         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
1533         return err_ref;
1534 }
1535 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
1536         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
1537         assert(obj->tag == LDKPathFailure_OnPath);
1538                         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
1539         return network_update_ref;
1540 }
1541 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
1542         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
1543         switch(obj->tag) {
1544                 case LDKCOption_PathFailureZ_Some: return 0;
1545                 case LDKCOption_PathFailureZ_None: return 1;
1546                 default: abort();
1547         }
1548 }
1549 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
1550         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
1551         assert(obj->tag == LDKCOption_PathFailureZ_Some);
1552                         uint64_t some_ref = tag_ptr(&obj->some, false);
1553         return some_ref;
1554 }
1555 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
1556 CHECK(owner->result_ok);
1557         return COption_PathFailureZ_clone(&*owner->contents.result);
1558 }
1559 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
1560         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
1561         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
1562         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
1563         uint64_t ret_ref = tag_ptr(ret_copy, true);
1564         return ret_ref;
1565 }
1566
1567 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
1568 CHECK(!owner->result_ok);
1569         return DecodeError_clone(&*owner->contents.err);
1570 }
1571 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
1572         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
1573         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1574         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
1575         uint64_t ret_ref = tag_ptr(ret_copy, true);
1576         return ret_ref;
1577 }
1578
1579 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1580         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1581         switch(obj->tag) {
1582                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1583                 case LDKClosureReason_HolderForceClosed: return 1;
1584                 case LDKClosureReason_CooperativeClosure: return 2;
1585                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1586                 case LDKClosureReason_FundingTimedOut: return 4;
1587                 case LDKClosureReason_ProcessingError: return 5;
1588                 case LDKClosureReason_DisconnectedPeer: return 6;
1589                 case LDKClosureReason_OutdatedChannelManager: return 7;
1590                 default: abort();
1591         }
1592 }
1593 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1594         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1595         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1596                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1597                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1598         return peer_msg_conv;
1599 }
1600 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1601         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1602         assert(obj->tag == LDKClosureReason_ProcessingError);
1603                         LDKStr err_str = obj->processing_error.err;
1604                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1605         return err_conv;
1606 }
1607 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1608         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1609         switch(obj->tag) {
1610                 case LDKCOption_ClosureReasonZ_Some: return 0;
1611                 case LDKCOption_ClosureReasonZ_None: return 1;
1612                 default: abort();
1613         }
1614 }
1615 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1616         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1617         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1618                         uint64_t some_ref = tag_ptr(&obj->some, false);
1619         return some_ref;
1620 }
1621 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1622 CHECK(owner->result_ok);
1623         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1624 }
1625 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1626         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1627         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1628         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1629         uint64_t ret_ref = tag_ptr(ret_copy, true);
1630         return ret_ref;
1631 }
1632
1633 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1634 CHECK(!owner->result_ok);
1635         return DecodeError_clone(&*owner->contents.err);
1636 }
1637 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1638         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1639         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1640         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1641         uint64_t ret_ref = tag_ptr(ret_copy, true);
1642         return ret_ref;
1643 }
1644
1645 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1646         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1647         switch(obj->tag) {
1648                 case LDKHTLCDestination_NextHopChannel: return 0;
1649                 case LDKHTLCDestination_UnknownNextHop: return 1;
1650                 case LDKHTLCDestination_InvalidForward: return 2;
1651                 case LDKHTLCDestination_FailedPayment: return 3;
1652                 default: abort();
1653         }
1654 }
1655 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1656         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1657         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1658                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1659                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1660         return node_id_arr;
1661 }
1662 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1663         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1664         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1665                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1666                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1667         return channel_id_arr;
1668 }
1669 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1670         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1671         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1672                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1673         return requested_forward_scid_conv;
1674 }
1675 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
1676         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1677         assert(obj->tag == LDKHTLCDestination_InvalidForward);
1678                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
1679         return requested_forward_scid_conv;
1680 }
1681 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1682         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1683         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1684                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1685                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1686         return payment_hash_arr;
1687 }
1688 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1689         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1690         switch(obj->tag) {
1691                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1692                 case LDKCOption_HTLCDestinationZ_None: return 1;
1693                 default: abort();
1694         }
1695 }
1696 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1697         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1698         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1699                         uint64_t some_ref = tag_ptr(&obj->some, false);
1700         return some_ref;
1701 }
1702 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1703 CHECK(owner->result_ok);
1704         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1705 }
1706 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1707         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1708         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1709         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1710         uint64_t ret_ref = tag_ptr(ret_copy, true);
1711         return ret_ref;
1712 }
1713
1714 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1715 CHECK(!owner->result_ok);
1716         return DecodeError_clone(&*owner->contents.err);
1717 }
1718 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1719         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1720         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1721         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1722         uint64_t ret_ref = tag_ptr(ret_copy, true);
1723         return ret_ref;
1724 }
1725
1726 uint32_t __attribute__((export_name("TS_LDKCOption_u128Z_ty_from_ptr"))) TS_LDKCOption_u128Z_ty_from_ptr(uint64_t ptr) {
1727         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
1728         switch(obj->tag) {
1729                 case LDKCOption_u128Z_Some: return 0;
1730                 case LDKCOption_u128Z_None: return 1;
1731                 default: abort();
1732         }
1733 }
1734 int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS_LDKCOption_u128Z_Some_get_some(uint64_t ptr) {
1735         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
1736         assert(obj->tag == LDKCOption_u128Z_Some);
1737                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
1738                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
1739         return some_arr;
1740 }
1741 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1742         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1743         switch(obj->tag) {
1744                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1745                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1746                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1747                 default: abort();
1748         }
1749 }
1750 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1751         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1752         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1753                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1754                         uint64_t outpoint_ref = 0;
1755                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1756                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1757         return outpoint_ref;
1758 }
1759 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1760         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1761         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1762                         LDKTxOut* output_ref = &obj->static_output.output;
1763         return tag_ptr(output_ref, false);
1764 }
1765 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1766         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1767         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1768                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1769                         uint64_t delayed_payment_output_ref = 0;
1770                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1771                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1772         return delayed_payment_output_ref;
1773 }
1774 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1775         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1776         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1777                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1778                         uint64_t static_payment_output_ref = 0;
1779                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1780                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1781         return static_payment_output_ref;
1782 }
1783 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1784         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1785         for (size_t i = 0; i < ret.datalen; i++) {
1786                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1787         }
1788         return ret;
1789 }
1790 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1791         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1792         switch(obj->tag) {
1793                 case LDKEvent_FundingGenerationReady: return 0;
1794                 case LDKEvent_PaymentClaimable: return 1;
1795                 case LDKEvent_PaymentClaimed: return 2;
1796                 case LDKEvent_PaymentSent: return 3;
1797                 case LDKEvent_PaymentFailed: return 4;
1798                 case LDKEvent_PaymentPathSuccessful: return 5;
1799                 case LDKEvent_PaymentPathFailed: return 6;
1800                 case LDKEvent_ProbeSuccessful: return 7;
1801                 case LDKEvent_ProbeFailed: return 8;
1802                 case LDKEvent_PendingHTLCsForwardable: return 9;
1803                 case LDKEvent_HTLCIntercepted: return 10;
1804                 case LDKEvent_SpendableOutputs: return 11;
1805                 case LDKEvent_PaymentForwarded: return 12;
1806                 case LDKEvent_ChannelReady: return 13;
1807                 case LDKEvent_ChannelClosed: return 14;
1808                 case LDKEvent_DiscardFunding: return 15;
1809                 case LDKEvent_OpenChannelRequest: return 16;
1810                 case LDKEvent_HTLCHandlingFailed: return 17;
1811                 default: abort();
1812         }
1813 }
1814 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1815         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1816         assert(obj->tag == LDKEvent_FundingGenerationReady);
1817                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1818                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1819         return temporary_channel_id_arr;
1820 }
1821 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1822         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1823         assert(obj->tag == LDKEvent_FundingGenerationReady);
1824                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1825                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1826         return counterparty_node_id_arr;
1827 }
1828 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1829         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1830         assert(obj->tag == LDKEvent_FundingGenerationReady);
1831                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1832         return channel_value_satoshis_conv;
1833 }
1834 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1835         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1836         assert(obj->tag == LDKEvent_FundingGenerationReady);
1837                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1838                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1839                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1840         return output_script_arr;
1841 }
1842 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1843         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1844         assert(obj->tag == LDKEvent_FundingGenerationReady);
1845                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
1846                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
1847         return user_channel_id_arr;
1848 }
1849 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
1850         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1851         assert(obj->tag == LDKEvent_PaymentClaimable);
1852                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
1853                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
1854         return receiver_node_id_arr;
1855 }
1856 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
1857         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1858         assert(obj->tag == LDKEvent_PaymentClaimable);
1859                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1860                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
1861         return payment_hash_arr;
1862 }
1863 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
1864         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1865         assert(obj->tag == LDKEvent_PaymentClaimable);
1866                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
1867         return amount_msat_conv;
1868 }
1869 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
1870         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1871         assert(obj->tag == LDKEvent_PaymentClaimable);
1872                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
1873         return purpose_ref;
1874 }
1875 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
1876         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1877         assert(obj->tag == LDKEvent_PaymentClaimable);
1878                         int8_tArray via_channel_id_arr = init_int8_tArray(32, __LINE__);
1879                         memcpy(via_channel_id_arr->elems, obj->payment_claimable.via_channel_id.data, 32);
1880         return via_channel_id_arr;
1881 }
1882 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
1883         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1884         assert(obj->tag == LDKEvent_PaymentClaimable);
1885                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
1886         return via_user_channel_id_ref;
1887 }
1888 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
1889         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1890         assert(obj->tag == LDKEvent_PaymentClaimed);
1891                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
1892                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
1893         return receiver_node_id_arr;
1894 }
1895 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1896         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1897         assert(obj->tag == LDKEvent_PaymentClaimed);
1898                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1899                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1900         return payment_hash_arr;
1901 }
1902 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1903         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1904         assert(obj->tag == LDKEvent_PaymentClaimed);
1905                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1906         return amount_msat_conv;
1907 }
1908 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1909         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1910         assert(obj->tag == LDKEvent_PaymentClaimed);
1911                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1912         return purpose_ref;
1913 }
1914 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1915         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1916         assert(obj->tag == LDKEvent_PaymentSent);
1917                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1918                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1919         return payment_id_arr;
1920 }
1921 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1922         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1923         assert(obj->tag == LDKEvent_PaymentSent);
1924                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1925                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1926         return payment_preimage_arr;
1927 }
1928 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1929         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1930         assert(obj->tag == LDKEvent_PaymentSent);
1931                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1932                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1933         return payment_hash_arr;
1934 }
1935 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1936         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1937         assert(obj->tag == LDKEvent_PaymentSent);
1938                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1939         return fee_paid_msat_ref;
1940 }
1941 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1942         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1943         assert(obj->tag == LDKEvent_PaymentFailed);
1944                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1945                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1946         return payment_id_arr;
1947 }
1948 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1949         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1950         assert(obj->tag == LDKEvent_PaymentFailed);
1951                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1952                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1953         return payment_hash_arr;
1954 }
1955 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1956         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1957         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1958                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1959                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1960         return payment_id_arr;
1961 }
1962 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1963         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1964         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1965                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1966                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1967         return payment_hash_arr;
1968 }
1969 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1970         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1971         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1972                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1973                         uint64_tArray path_arr = NULL;
1974                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1975                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1976                         for (size_t k = 0; k < path_var.datalen; k++) {
1977                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1978                                 uint64_t path_conv_10_ref = 0;
1979                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1980                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1981                                 path_arr_ptr[k] = path_conv_10_ref;
1982                         }
1983                         
1984         return path_arr;
1985 }
1986 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1987         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1988         assert(obj->tag == LDKEvent_PaymentPathFailed);
1989                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1990                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1991         return payment_id_arr;
1992 }
1993 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1994         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1995         assert(obj->tag == LDKEvent_PaymentPathFailed);
1996                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1997                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1998         return payment_hash_arr;
1999 }
2000 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
2001         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2002         assert(obj->tag == LDKEvent_PaymentPathFailed);
2003                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
2004         return payment_failed_permanently_conv;
2005 }
2006 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
2007         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2008         assert(obj->tag == LDKEvent_PaymentPathFailed);
2009                         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
2010         return failure_ref;
2011 }
2012 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
2013         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2014         assert(obj->tag == LDKEvent_PaymentPathFailed);
2015                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2016                         uint64_tArray path_arr = NULL;
2017                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
2018                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
2019                         for (size_t k = 0; k < path_var.datalen; k++) {
2020                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2021                                 uint64_t path_conv_10_ref = 0;
2022                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2023                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2024                                 path_arr_ptr[k] = path_conv_10_ref;
2025                         }
2026                         
2027         return path_arr;
2028 }
2029 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
2030         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2031         assert(obj->tag == LDKEvent_PaymentPathFailed);
2032                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
2033         return short_channel_id_ref;
2034 }
2035 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
2036         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2037         assert(obj->tag == LDKEvent_PaymentPathFailed);
2038                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2039                         uint64_t retry_ref = 0;
2040                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2041                         retry_ref = tag_ptr(retry_var.inner, false);
2042         return retry_ref;
2043 }
2044 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
2045         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2046         assert(obj->tag == LDKEvent_ProbeSuccessful);
2047                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2048                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
2049         return payment_id_arr;
2050 }
2051 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
2052         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2053         assert(obj->tag == LDKEvent_ProbeSuccessful);
2054                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2055                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
2056         return payment_hash_arr;
2057 }
2058 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
2059         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2060         assert(obj->tag == LDKEvent_ProbeSuccessful);
2061                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
2062                         uint64_tArray path_arr = NULL;
2063                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
2064                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
2065                         for (size_t k = 0; k < path_var.datalen; k++) {
2066                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2067                                 uint64_t path_conv_10_ref = 0;
2068                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2069                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2070                                 path_arr_ptr[k] = path_conv_10_ref;
2071                         }
2072                         
2073         return path_arr;
2074 }
2075 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
2076         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2077         assert(obj->tag == LDKEvent_ProbeFailed);
2078                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2079                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
2080         return payment_id_arr;
2081 }
2082 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
2083         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2084         assert(obj->tag == LDKEvent_ProbeFailed);
2085                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2086                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
2087         return payment_hash_arr;
2088 }
2089 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
2090         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2091         assert(obj->tag == LDKEvent_ProbeFailed);
2092                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
2093                         uint64_tArray path_arr = NULL;
2094                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
2095                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
2096                         for (size_t k = 0; k < path_var.datalen; k++) {
2097                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2098                                 uint64_t path_conv_10_ref = 0;
2099                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2100                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2101                                 path_arr_ptr[k] = path_conv_10_ref;
2102                         }
2103                         
2104         return path_arr;
2105 }
2106 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
2107         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2108         assert(obj->tag == LDKEvent_ProbeFailed);
2109                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
2110         return short_channel_id_ref;
2111 }
2112 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
2113         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2114         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
2115                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2116         return time_forwardable_conv;
2117 }
2118 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
2119         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2120         assert(obj->tag == LDKEvent_HTLCIntercepted);
2121                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
2122                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
2123         return intercept_id_arr;
2124 }
2125 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
2126         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2127         assert(obj->tag == LDKEvent_HTLCIntercepted);
2128                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
2129         return requested_next_hop_scid_conv;
2130 }
2131 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
2132         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2133         assert(obj->tag == LDKEvent_HTLCIntercepted);
2134                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2135                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
2136         return payment_hash_arr;
2137 }
2138 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
2139         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2140         assert(obj->tag == LDKEvent_HTLCIntercepted);
2141                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
2142         return inbound_amount_msat_conv;
2143 }
2144 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
2145         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2146         assert(obj->tag == LDKEvent_HTLCIntercepted);
2147                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
2148         return expected_outbound_amount_msat_conv;
2149 }
2150 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
2151         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2152         assert(obj->tag == LDKEvent_SpendableOutputs);
2153                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2154                         uint64_tArray outputs_arr = NULL;
2155                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
2156                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
2157                         for (size_t b = 0; b < outputs_var.datalen; b++) {
2158                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
2159                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
2160                         }
2161                         
2162         return outputs_arr;
2163 }
2164 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
2165         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2166         assert(obj->tag == LDKEvent_PaymentForwarded);
2167                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2168                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
2169         return prev_channel_id_arr;
2170 }
2171 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
2172         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2173         assert(obj->tag == LDKEvent_PaymentForwarded);
2174                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
2175                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
2176         return next_channel_id_arr;
2177 }
2178 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
2179         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2180         assert(obj->tag == LDKEvent_PaymentForwarded);
2181                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
2182         return fee_earned_msat_ref;
2183 }
2184 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
2185         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2186         assert(obj->tag == LDKEvent_PaymentForwarded);
2187                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2188         return claim_from_onchain_tx_conv;
2189 }
2190 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
2191         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2192         assert(obj->tag == LDKEvent_ChannelReady);
2193                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2194                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
2195         return channel_id_arr;
2196 }
2197 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
2198         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2199         assert(obj->tag == LDKEvent_ChannelReady);
2200                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2201                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
2202         return user_channel_id_arr;
2203 }
2204 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
2205         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2206         assert(obj->tag == LDKEvent_ChannelReady);
2207                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2208                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
2209         return counterparty_node_id_arr;
2210 }
2211 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
2212         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2213         assert(obj->tag == LDKEvent_ChannelReady);
2214                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
2215                         uint64_t channel_type_ref = 0;
2216                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2217                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2218         return channel_type_ref;
2219 }
2220 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
2221         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2222         assert(obj->tag == LDKEvent_ChannelClosed);
2223                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2224                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
2225         return channel_id_arr;
2226 }
2227 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
2228         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2229         assert(obj->tag == LDKEvent_ChannelClosed);
2230                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2231                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
2232         return user_channel_id_arr;
2233 }
2234 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
2235         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2236         assert(obj->tag == LDKEvent_ChannelClosed);
2237                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
2238         return reason_ref;
2239 }
2240 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
2241         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2242         assert(obj->tag == LDKEvent_DiscardFunding);
2243                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2244                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
2245         return channel_id_arr;
2246 }
2247 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
2248         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2249         assert(obj->tag == LDKEvent_DiscardFunding);
2250                         LDKTransaction transaction_var = obj->discard_funding.transaction;
2251                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
2252                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
2253         return transaction_arr;
2254 }
2255 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
2256         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2257         assert(obj->tag == LDKEvent_OpenChannelRequest);
2258                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2259                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
2260         return temporary_channel_id_arr;
2261 }
2262 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
2263         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2264         assert(obj->tag == LDKEvent_OpenChannelRequest);
2265                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2266                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
2267         return counterparty_node_id_arr;
2268 }
2269 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
2270         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2271         assert(obj->tag == LDKEvent_OpenChannelRequest);
2272                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2273         return funding_satoshis_conv;
2274 }
2275 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
2276         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2277         assert(obj->tag == LDKEvent_OpenChannelRequest);
2278                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2279         return push_msat_conv;
2280 }
2281 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
2282         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2283         assert(obj->tag == LDKEvent_OpenChannelRequest);
2284                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2285                         uint64_t channel_type_ref = 0;
2286                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2287                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2288         return channel_type_ref;
2289 }
2290 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2291         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2292         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2293                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2294                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2295         return prev_channel_id_arr;
2296 }
2297 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2298         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2299         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2300                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2301         return failed_next_destination_ref;
2302 }
2303 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2304         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2305         switch(obj->tag) {
2306                 case LDKCOption_EventZ_Some: return 0;
2307                 case LDKCOption_EventZ_None: return 1;
2308                 default: abort();
2309         }
2310 }
2311 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2312         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2313         assert(obj->tag == LDKCOption_EventZ_Some);
2314                         uint64_t some_ref = tag_ptr(&obj->some, false);
2315         return some_ref;
2316 }
2317 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2318 CHECK(owner->result_ok);
2319         return COption_EventZ_clone(&*owner->contents.result);
2320 }
2321 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2322         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2323         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2324         *ret_copy = CResult_COption_EventZDecodeErrorZ_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_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *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_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
2334         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2335         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2336         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2337         uint64_t ret_ref = tag_ptr(ret_copy, true);
2338         return ret_ref;
2339 }
2340
2341 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
2342         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2343         switch(obj->tag) {
2344                 case LDKErrorAction_DisconnectPeer: return 0;
2345                 case LDKErrorAction_IgnoreError: return 1;
2346                 case LDKErrorAction_IgnoreAndLog: return 2;
2347                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2348                 case LDKErrorAction_SendErrorMessage: return 4;
2349                 case LDKErrorAction_SendWarningMessage: return 5;
2350                 default: abort();
2351         }
2352 }
2353 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
2354         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2355         assert(obj->tag == LDKErrorAction_DisconnectPeer);
2356                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2357                         uint64_t msg_ref = 0;
2358                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2359                         msg_ref = tag_ptr(msg_var.inner, false);
2360         return msg_ref;
2361 }
2362 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
2363         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2364         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2365                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2366         return ignore_and_log_conv;
2367 }
2368 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
2369         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2370         assert(obj->tag == LDKErrorAction_SendErrorMessage);
2371                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2372                         uint64_t msg_ref = 0;
2373                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2374                         msg_ref = tag_ptr(msg_var.inner, false);
2375         return msg_ref;
2376 }
2377 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
2378         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2379         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2380                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2381                         uint64_t msg_ref = 0;
2382                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2383                         msg_ref = tag_ptr(msg_var.inner, false);
2384         return msg_ref;
2385 }
2386 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
2387         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2388         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2389                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2390         return log_level_conv;
2391 }
2392 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
2393         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2394         switch(obj->tag) {
2395                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2396                 case LDKMessageSendEvent_SendOpenChannel: return 1;
2397                 case LDKMessageSendEvent_SendFundingCreated: return 2;
2398                 case LDKMessageSendEvent_SendFundingSigned: return 3;
2399                 case LDKMessageSendEvent_SendChannelReady: return 4;
2400                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2401                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2402                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2403                 case LDKMessageSendEvent_SendClosingSigned: return 8;
2404                 case LDKMessageSendEvent_SendShutdown: return 9;
2405                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2406                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
2407                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
2408                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2409                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 14;
2410                 case LDKMessageSendEvent_SendChannelUpdate: return 15;
2411                 case LDKMessageSendEvent_HandleError: return 16;
2412                 case LDKMessageSendEvent_SendChannelRangeQuery: return 17;
2413                 case LDKMessageSendEvent_SendShortIdsQuery: return 18;
2414                 case LDKMessageSendEvent_SendReplyChannelRange: return 19;
2415                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 20;
2416                 default: abort();
2417         }
2418 }
2419 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2420         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2421         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2422                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2423                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2424         return node_id_arr;
2425 }
2426 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2427         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2428         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2429                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2430                         uint64_t msg_ref = 0;
2431                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2432                         msg_ref = tag_ptr(msg_var.inner, false);
2433         return msg_ref;
2434 }
2435 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2436         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2437         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2438                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2439                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2440         return node_id_arr;
2441 }
2442 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2443         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2444         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2445                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2446                         uint64_t msg_ref = 0;
2447                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2448                         msg_ref = tag_ptr(msg_var.inner, false);
2449         return msg_ref;
2450 }
2451 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2452         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2453         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2454                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2455                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2456         return node_id_arr;
2457 }
2458 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2459         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2460         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2461                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2462                         uint64_t msg_ref = 0;
2463                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2464                         msg_ref = tag_ptr(msg_var.inner, false);
2465         return msg_ref;
2466 }
2467 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2468         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2469         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2470                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2471                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2472         return node_id_arr;
2473 }
2474 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2475         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2476         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2477                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2478                         uint64_t msg_ref = 0;
2479                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2480                         msg_ref = tag_ptr(msg_var.inner, false);
2481         return msg_ref;
2482 }
2483 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2484         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2485         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2486                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2487                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2488         return node_id_arr;
2489 }
2490 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2491         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2492         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2493                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2494                         uint64_t msg_ref = 0;
2495                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2496                         msg_ref = tag_ptr(msg_var.inner, false);
2497         return msg_ref;
2498 }
2499 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2500         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2501         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2502                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2503                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2504         return node_id_arr;
2505 }
2506 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2507         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2508         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2509                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2510                         uint64_t msg_ref = 0;
2511                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2512                         msg_ref = tag_ptr(msg_var.inner, false);
2513         return msg_ref;
2514 }
2515 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2516         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2517         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2518                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2519                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2520         return node_id_arr;
2521 }
2522 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2523         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2524         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2525                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2526                         uint64_t updates_ref = 0;
2527                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2528                         updates_ref = tag_ptr(updates_var.inner, false);
2529         return updates_ref;
2530 }
2531 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2532         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2533         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2534                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2535                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2536         return node_id_arr;
2537 }
2538 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2539         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2540         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2541                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2542                         uint64_t msg_ref = 0;
2543                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2544                         msg_ref = tag_ptr(msg_var.inner, false);
2545         return msg_ref;
2546 }
2547 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2548         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2549         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2550                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2551                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2552         return node_id_arr;
2553 }
2554 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2555         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2556         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2557                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2558                         uint64_t msg_ref = 0;
2559                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2560                         msg_ref = tag_ptr(msg_var.inner, false);
2561         return msg_ref;
2562 }
2563 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2564         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2565         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2566                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2567                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2568         return node_id_arr;
2569 }
2570 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2571         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2572         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2573                         LDKShutdown msg_var = obj->send_shutdown.msg;
2574                         uint64_t msg_ref = 0;
2575                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2576                         msg_ref = tag_ptr(msg_var.inner, false);
2577         return msg_ref;
2578 }
2579 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2580         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2581         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2582                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2583                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2584         return node_id_arr;
2585 }
2586 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2587         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2588         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2589                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2590                         uint64_t msg_ref = 0;
2591                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2592                         msg_ref = tag_ptr(msg_var.inner, false);
2593         return msg_ref;
2594 }
2595 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
2596         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2597         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2598                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2599                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
2600         return node_id_arr;
2601 }
2602 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
2603         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2604         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2605                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
2606                         uint64_t msg_ref = 0;
2607                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2608                         msg_ref = tag_ptr(msg_var.inner, false);
2609         return msg_ref;
2610 }
2611 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
2612         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2613         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2614                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
2615                         uint64_t update_msg_ref = 0;
2616                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2617                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2618         return update_msg_ref;
2619 }
2620 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2621         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2622         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2623                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2624                         uint64_t msg_ref = 0;
2625                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2626                         msg_ref = tag_ptr(msg_var.inner, false);
2627         return msg_ref;
2628 }
2629 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2630         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2631         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2632                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2633                         uint64_t update_msg_ref = 0;
2634                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2635                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2636         return update_msg_ref;
2637 }
2638 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2639         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2640         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2641                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2642                         uint64_t msg_ref = 0;
2643                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2644                         msg_ref = tag_ptr(msg_var.inner, false);
2645         return msg_ref;
2646 }
2647 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
2648         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2649         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
2650                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2651                         uint64_t msg_ref = 0;
2652                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2653                         msg_ref = tag_ptr(msg_var.inner, false);
2654         return msg_ref;
2655 }
2656 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2657         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2658         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2659                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2660                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2661         return node_id_arr;
2662 }
2663 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2664         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2665         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2666                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2667                         uint64_t msg_ref = 0;
2668                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2669                         msg_ref = tag_ptr(msg_var.inner, false);
2670         return msg_ref;
2671 }
2672 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2673         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2674         assert(obj->tag == LDKMessageSendEvent_HandleError);
2675                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2676                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2677         return node_id_arr;
2678 }
2679 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2680         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2681         assert(obj->tag == LDKMessageSendEvent_HandleError);
2682                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2683         return action_ref;
2684 }
2685 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2686         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2687         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2688                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2689                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2690         return node_id_arr;
2691 }
2692 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2693         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2694         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2695                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2696                         uint64_t msg_ref = 0;
2697                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2698                         msg_ref = tag_ptr(msg_var.inner, false);
2699         return msg_ref;
2700 }
2701 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2702         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2703         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2704                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2705                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2706         return node_id_arr;
2707 }
2708 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2709         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2710         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2711                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2712                         uint64_t msg_ref = 0;
2713                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2714                         msg_ref = tag_ptr(msg_var.inner, false);
2715         return msg_ref;
2716 }
2717 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2718         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2719         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2720                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2721                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2722         return node_id_arr;
2723 }
2724 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2725         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2726         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2727                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2728                         uint64_t msg_ref = 0;
2729                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2730                         msg_ref = tag_ptr(msg_var.inner, false);
2731         return msg_ref;
2732 }
2733 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2734         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2735         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2736                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2737                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2738         return node_id_arr;
2739 }
2740 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2741         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2742         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2743                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2744                         uint64_t msg_ref = 0;
2745                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2746                         msg_ref = tag_ptr(msg_var.inner, false);
2747         return msg_ref;
2748 }
2749 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2750         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2751         for (size_t i = 0; i < ret.datalen; i++) {
2752                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2753         }
2754         return ret;
2755 }
2756 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2757         return owner->a;
2758 }
2759 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2760         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2761         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2762         return ret_conv;
2763 }
2764
2765 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2766         return owner->b;
2767 }
2768 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2769         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2770         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2771         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2772         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2773         return ret_arr;
2774 }
2775
2776 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2777         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2778         for (size_t i = 0; i < ret.datalen; i++) {
2779                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2780         }
2781         return ret;
2782 }
2783 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_a(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
2784         return ThirtyTwoBytes_clone(&owner->a);
2785 }
2786 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_a"))) TS_C2Tuple_TxidBlockHashZ_get_a(uint64_t owner) {
2787         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
2788         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2789         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_a(owner_conv).data, 32);
2790         return ret_arr;
2791 }
2792
2793 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_b(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
2794         return ThirtyTwoBytes_clone(&owner->b);
2795 }
2796 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_b"))) TS_C2Tuple_TxidBlockHashZ_get_b(uint64_t owner) {
2797         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
2798         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2799         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_b(owner_conv).data, 32);
2800         return ret_arr;
2801 }
2802
2803 static inline LDKCVec_C2Tuple_TxidBlockHashZZ CVec_C2Tuple_TxidBlockHashZZ_clone(const LDKCVec_C2Tuple_TxidBlockHashZZ *orig) {
2804         LDKCVec_C2Tuple_TxidBlockHashZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ) * orig->datalen, "LDKCVec_C2Tuple_TxidBlockHashZZ clone bytes"), .datalen = orig->datalen };
2805         for (size_t i = 0; i < ret.datalen; i++) {
2806                 ret.data[i] = C2Tuple_TxidBlockHashZ_clone(&orig->data[i]);
2807         }
2808         return ret;
2809 }
2810 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2811         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2812         switch(obj->tag) {
2813                 case LDKMonitorEvent_HTLCEvent: return 0;
2814                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2815                 case LDKMonitorEvent_Completed: return 2;
2816                 case LDKMonitorEvent_UpdateFailed: return 3;
2817                 default: abort();
2818         }
2819 }
2820 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2821         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2822         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2823                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2824                         uint64_t htlc_event_ref = 0;
2825                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2826                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2827         return htlc_event_ref;
2828 }
2829 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2830         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2831         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2832                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2833                         uint64_t commitment_tx_confirmed_ref = 0;
2834                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2835                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2836         return commitment_tx_confirmed_ref;
2837 }
2838 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2839         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2840         assert(obj->tag == LDKMonitorEvent_Completed);
2841                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2842                         uint64_t funding_txo_ref = 0;
2843                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2844                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2845         return funding_txo_ref;
2846 }
2847 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2848         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2849         assert(obj->tag == LDKMonitorEvent_Completed);
2850                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2851         return monitor_update_id_conv;
2852 }
2853 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2854         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2855         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2856                         LDKOutPoint update_failed_var = obj->update_failed;
2857                         uint64_t update_failed_ref = 0;
2858                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2859                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2860         return update_failed_ref;
2861 }
2862 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2863         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2864         for (size_t i = 0; i < ret.datalen; i++) {
2865                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2866         }
2867         return ret;
2868 }
2869 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2870         LDKOutPoint ret = owner->a;
2871         ret.is_owned = false;
2872         return ret;
2873 }
2874 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2875         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2876         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2877         uint64_t ret_ref = 0;
2878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2880         return ret_ref;
2881 }
2882
2883 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2884         return CVec_MonitorEventZ_clone(&owner->b);
2885 }
2886 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2887         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2888         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2889         uint64_tArray ret_arr = NULL;
2890         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2891         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2892         for (size_t o = 0; o < ret_var.datalen; o++) {
2893                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2894                 *ret_conv_14_copy = ret_var.data[o];
2895                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2896                 ret_arr_ptr[o] = ret_conv_14_ref;
2897         }
2898         
2899         FREE(ret_var.data);
2900         return ret_arr;
2901 }
2902
2903 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2904         return owner->c;
2905 }
2906 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2907         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2908         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2909         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2910         return ret_arr;
2911 }
2912
2913 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2914         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2915         for (size_t i = 0; i < ret.datalen; i++) {
2916                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2917         }
2918         return ret;
2919 }
2920 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2921         LDKFixedPenaltyScorer ret = *owner->contents.result;
2922         ret.is_owned = false;
2923         return ret;
2924 }
2925 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2926         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2927         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2928         uint64_t ret_ref = 0;
2929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2931         return ret_ref;
2932 }
2933
2934 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2935 CHECK(!owner->result_ok);
2936         return DecodeError_clone(&*owner->contents.err);
2937 }
2938 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2939         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2940         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2941         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2942         uint64_t ret_ref = tag_ptr(ret_copy, true);
2943         return ret_ref;
2944 }
2945
2946 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2947         return owner->a;
2948 }
2949 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2950         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2951         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2952         return ret_conv;
2953 }
2954
2955 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2956         return owner->b;
2957 }
2958 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2959         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2960         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2961         return ret_conv;
2962 }
2963
2964 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2965         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2966         switch(obj->tag) {
2967                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2968                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2969                 default: abort();
2970         }
2971 }
2972 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2973         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2974         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2975                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2976                         *some_conv = obj->some;
2977                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2978         return tag_ptr(some_conv, true);
2979 }
2980 static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2981         return owner->a;
2982 }
2983 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2984         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2985         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
2986         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 8 * 2);
2987         return ret_arr;
2988 }
2989
2990 static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2991         return owner->b;
2992 }
2993 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2994         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2995         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
2996         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 8 * 2);
2997         return ret_arr;
2998 }
2999
3000 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
3001         return owner->a;
3002 }
3003 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_a"))) TS_C2Tuple__u168_u168Z_get_a(uint64_t owner) {
3004         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
3005         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3006         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_a(owner_conv).data, 8 * 2);
3007         return ret_arr;
3008 }
3009
3010 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
3011         return owner->b;
3012 }
3013 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_b"))) TS_C2Tuple__u168_u168Z_get_b(uint64_t owner) {
3014         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
3015         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3016         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_b(owner_conv).data, 8 * 2);
3017         return ret_arr;
3018 }
3019
3020 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr(uint64_t ptr) {
3021         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
3022         switch(obj->tag) {
3023                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: return 0;
3024                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: return 1;
3025                 default: abort();
3026         }
3027 }
3028 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some(uint64_t ptr) {
3029         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
3030         assert(obj->tag == LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some);
3031                         LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
3032                         *some_conv = obj->some;
3033                         *some_conv = C2Tuple__u168_u168Z_clone(some_conv);
3034         return tag_ptr(some_conv, true);
3035 }
3036 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3037         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3038         for (size_t i = 0; i < ret.datalen; i++) {
3039                 ret.data[i] = NodeId_clone(&orig->data[i]);
3040         }
3041         return ret;
3042 }
3043 typedef struct LDKLogger_JCalls {
3044         atomic_size_t refcnt;
3045         uint32_t instance_ptr;
3046 } LDKLogger_JCalls;
3047 static void LDKLogger_JCalls_free(void* this_arg) {
3048         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3049         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3050                 FREE(j_calls);
3051         }
3052 }
3053 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3054         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3055         LDKRecord record_var = *record;
3056         uint64_t record_ref = 0;
3057         record_var = Record_clone(&record_var);
3058         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3059         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3060         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
3061 }
3062 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3063         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3064         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3065 }
3066 static inline LDKLogger LDKLogger_init (JSValue o) {
3067         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3068         atomic_init(&calls->refcnt, 1);
3069         calls->instance_ptr = o;
3070
3071         LDKLogger ret = {
3072                 .this_arg = (void*) calls,
3073                 .log = log_LDKLogger_jcall,
3074                 .free = LDKLogger_JCalls_free,
3075         };
3076         return ret;
3077 }
3078 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
3079         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3080         *res_ptr = LDKLogger_init(o);
3081         return tag_ptr(res_ptr, true);
3082 }
3083 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3084         LDKProbabilisticScorer ret = *owner->contents.result;
3085         ret.is_owned = false;
3086         return ret;
3087 }
3088 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
3089         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3090         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3091         uint64_t ret_ref = 0;
3092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3094         return ret_ref;
3095 }
3096
3097 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3098 CHECK(!owner->result_ok);
3099         return DecodeError_clone(&*owner->contents.err);
3100 }
3101 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
3102         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3103         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3104         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3105         uint64_t ret_ref = tag_ptr(ret_copy, true);
3106         return ret_ref;
3107 }
3108
3109 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3110         LDKInitFeatures ret = *owner->contents.result;
3111         ret.is_owned = false;
3112         return ret;
3113 }
3114 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3115         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3116         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3117         uint64_t ret_ref = 0;
3118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3120         return ret_ref;
3121 }
3122
3123 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3124 CHECK(!owner->result_ok);
3125         return DecodeError_clone(&*owner->contents.err);
3126 }
3127 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3128         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3129         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3130         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3131         uint64_t ret_ref = tag_ptr(ret_copy, true);
3132         return ret_ref;
3133 }
3134
3135 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3136         LDKChannelFeatures ret = *owner->contents.result;
3137         ret.is_owned = false;
3138         return ret;
3139 }
3140 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3141         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3142         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3143         uint64_t ret_ref = 0;
3144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3146         return ret_ref;
3147 }
3148
3149 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3150 CHECK(!owner->result_ok);
3151         return DecodeError_clone(&*owner->contents.err);
3152 }
3153 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3154         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3155         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3156         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3157         uint64_t ret_ref = tag_ptr(ret_copy, true);
3158         return ret_ref;
3159 }
3160
3161 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3162         LDKNodeFeatures ret = *owner->contents.result;
3163         ret.is_owned = false;
3164         return ret;
3165 }
3166 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3167         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3168         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3169         uint64_t ret_ref = 0;
3170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3172         return ret_ref;
3173 }
3174
3175 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3176 CHECK(!owner->result_ok);
3177         return DecodeError_clone(&*owner->contents.err);
3178 }
3179 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3180         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3181         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3182         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3183         uint64_t ret_ref = tag_ptr(ret_copy, true);
3184         return ret_ref;
3185 }
3186
3187 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3188         LDKInvoiceFeatures ret = *owner->contents.result;
3189         ret.is_owned = false;
3190         return ret;
3191 }
3192 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3193         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3194         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3195         uint64_t ret_ref = 0;
3196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3198         return ret_ref;
3199 }
3200
3201 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3202 CHECK(!owner->result_ok);
3203         return DecodeError_clone(&*owner->contents.err);
3204 }
3205 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3206         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3207         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3208         *ret_copy = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3209         uint64_t ret_ref = tag_ptr(ret_copy, true);
3210         return ret_ref;
3211 }
3212
3213 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3214         LDKBlindedHopFeatures ret = *owner->contents.result;
3215         ret.is_owned = false;
3216         return ret;
3217 }
3218 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3219         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3220         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3221         uint64_t ret_ref = 0;
3222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3224         return ret_ref;
3225 }
3226
3227 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3228 CHECK(!owner->result_ok);
3229         return DecodeError_clone(&*owner->contents.err);
3230 }
3231 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3232         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3233         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3234         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3235         uint64_t ret_ref = tag_ptr(ret_copy, true);
3236         return ret_ref;
3237 }
3238
3239 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3240         LDKChannelTypeFeatures ret = *owner->contents.result;
3241         ret.is_owned = false;
3242         return ret;
3243 }
3244 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3245         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3246         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3247         uint64_t ret_ref = 0;
3248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3250         return ret_ref;
3251 }
3252
3253 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3254 CHECK(!owner->result_ok);
3255         return DecodeError_clone(&*owner->contents.err);
3256 }
3257 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3258         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3259         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3260         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3261         uint64_t ret_ref = tag_ptr(ret_copy, true);
3262         return ret_ref;
3263 }
3264
3265 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3266         LDKNodeId ret = *owner->contents.result;
3267         ret.is_owned = false;
3268         return ret;
3269 }
3270 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3271         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3272         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3273         uint64_t ret_ref = 0;
3274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3276         return ret_ref;
3277 }
3278
3279 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3280 CHECK(!owner->result_ok);
3281         return DecodeError_clone(&*owner->contents.err);
3282 }
3283 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3284         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3285         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3286         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3287         uint64_t ret_ref = tag_ptr(ret_copy, true);
3288         return ret_ref;
3289 }
3290
3291 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3292 CHECK(owner->result_ok);
3293         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3294 }
3295 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3296         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3297         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3298         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3299         uint64_t ret_ref = tag_ptr(ret_copy, true);
3300         return ret_ref;
3301 }
3302
3303 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3304 CHECK(!owner->result_ok);
3305         return DecodeError_clone(&*owner->contents.err);
3306 }
3307 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3308         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3309         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3310         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3311         uint64_t ret_ref = tag_ptr(ret_copy, true);
3312         return ret_ref;
3313 }
3314
3315 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3316 CHECK(owner->result_ok);
3317         return TxOut_clone(&*owner->contents.result);
3318 }
3319 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3320         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3321         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3322         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3323         return tag_ptr(ret_ref, true);
3324 }
3325
3326 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3327 CHECK(!owner->result_ok);
3328         return UtxoLookupError_clone(&*owner->contents.err);
3329 }
3330 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3331         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3332         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3333         return ret_conv;
3334 }
3335
3336 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3337         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3338         switch(obj->tag) {
3339                 case LDKUtxoResult_Sync: return 0;
3340                 case LDKUtxoResult_Async: return 1;
3341                 default: abort();
3342         }
3343 }
3344 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3345         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3346         assert(obj->tag == LDKUtxoResult_Sync);
3347                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3348                         *sync_conv = obj->sync;
3349                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3350         return tag_ptr(sync_conv, true);
3351 }
3352 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3353         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3354         assert(obj->tag == LDKUtxoResult_Async);
3355                         LDKUtxoFuture async_var = obj->async;
3356                         uint64_t async_ref = 0;
3357                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3358                         async_ref = tag_ptr(async_var.inner, false);
3359         return async_ref;
3360 }
3361 typedef struct LDKUtxoLookup_JCalls {
3362         atomic_size_t refcnt;
3363         uint32_t instance_ptr;
3364 } LDKUtxoLookup_JCalls;
3365 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3366         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3367         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3368                 FREE(j_calls);
3369         }
3370 }
3371 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3372         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3373         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3374         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3375         int64_t short_channel_id_conv = short_channel_id;
3376         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);
3377         void* ret_ptr = untag_ptr(ret);
3378         CHECK_ACCESS(ret_ptr);
3379         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3380         FREE(untag_ptr(ret));
3381         return ret_conv;
3382 }
3383 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3384         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3385         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3386 }
3387 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3388         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3389         atomic_init(&calls->refcnt, 1);
3390         calls->instance_ptr = o;
3391
3392         LDKUtxoLookup ret = {
3393                 .this_arg = (void*) calls,
3394                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3395                 .free = LDKUtxoLookup_JCalls_free,
3396         };
3397         return ret;
3398 }
3399 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3400         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3401         *res_ptr = LDKUtxoLookup_init(o);
3402         return tag_ptr(res_ptr, true);
3403 }
3404 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) {
3405         void* this_arg_ptr = untag_ptr(this_arg);
3406         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3407         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3408         uint8_t genesis_hash_arr[32];
3409         CHECK(genesis_hash->arr_len == 32);
3410         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3411         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
3412         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3413         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3414         uint64_t ret_ref = tag_ptr(ret_copy, true);
3415         return ret_ref;
3416 }
3417
3418 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3419         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3420         switch(obj->tag) {
3421                 case LDKCOption_UtxoLookupZ_Some: return 0;
3422                 case LDKCOption_UtxoLookupZ_None: return 1;
3423                 default: abort();
3424         }
3425 }
3426 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3427         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3428         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3429                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3430                         *some_ret = obj->some;
3431                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3432                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3433                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3434                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3435                         }
3436         return tag_ptr(some_ret, true);
3437 }
3438 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3439 CHECK(owner->result_ok);
3440         return *owner->contents.result;
3441 }
3442 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3443         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3444         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3445         return ret_conv;
3446 }
3447
3448 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3449         LDKLightningError ret = *owner->contents.err;
3450         ret.is_owned = false;
3451         return ret;
3452 }
3453 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3454         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3455         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3456         uint64_t ret_ref = 0;
3457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3459         return ret_ref;
3460 }
3461
3462 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3463         LDKChannelAnnouncement ret = owner->a;
3464         ret.is_owned = false;
3465         return ret;
3466 }
3467 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3468         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3469         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3470         uint64_t ret_ref = 0;
3471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3473         return ret_ref;
3474 }
3475
3476 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3477         LDKChannelUpdate ret = owner->b;
3478         ret.is_owned = false;
3479         return ret;
3480 }
3481 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3482         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3483         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3484         uint64_t ret_ref = 0;
3485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3487         return ret_ref;
3488 }
3489
3490 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3491         LDKChannelUpdate ret = owner->c;
3492         ret.is_owned = false;
3493         return ret;
3494 }
3495 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3496         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3497         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3498         uint64_t ret_ref = 0;
3499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3501         return ret_ref;
3502 }
3503
3504 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3505         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3506         switch(obj->tag) {
3507                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3508                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3509                 default: abort();
3510         }
3511 }
3512 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3513         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3514         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3515                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3516                         *some_conv = obj->some;
3517                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3518         return tag_ptr(some_conv, true);
3519 }
3520 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3521 CHECK(owner->result_ok);
3522         return *owner->contents.result;
3523 }
3524 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3525         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3526         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3527 }
3528
3529 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3530         LDKLightningError ret = *owner->contents.err;
3531         ret.is_owned = false;
3532         return ret;
3533 }
3534 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3535         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3536         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3537         uint64_t ret_ref = 0;
3538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3540         return ret_ref;
3541 }
3542
3543 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3544         LDKChannelUpdateInfo ret = *owner->contents.result;
3545         ret.is_owned = false;
3546         return ret;
3547 }
3548 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3549         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3550         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3551         uint64_t ret_ref = 0;
3552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3554         return ret_ref;
3555 }
3556
3557 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3558 CHECK(!owner->result_ok);
3559         return DecodeError_clone(&*owner->contents.err);
3560 }
3561 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3562         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3563         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3564         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3565         uint64_t ret_ref = tag_ptr(ret_copy, true);
3566         return ret_ref;
3567 }
3568
3569 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3570         LDKChannelInfo ret = *owner->contents.result;
3571         ret.is_owned = false;
3572         return ret;
3573 }
3574 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3575         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3576         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3577         uint64_t ret_ref = 0;
3578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3580         return ret_ref;
3581 }
3582
3583 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3584 CHECK(!owner->result_ok);
3585         return DecodeError_clone(&*owner->contents.err);
3586 }
3587 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3588         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3589         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3590         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3591         uint64_t ret_ref = tag_ptr(ret_copy, true);
3592         return ret_ref;
3593 }
3594
3595 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3596         LDKRoutingFees ret = *owner->contents.result;
3597         ret.is_owned = false;
3598         return ret;
3599 }
3600 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3601         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3602         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3603         uint64_t ret_ref = 0;
3604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3606         return ret_ref;
3607 }
3608
3609 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3610 CHECK(!owner->result_ok);
3611         return DecodeError_clone(&*owner->contents.err);
3612 }
3613 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3614         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3615         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3616         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3617         uint64_t ret_ref = tag_ptr(ret_copy, true);
3618         return ret_ref;
3619 }
3620
3621 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3622         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3623         switch(obj->tag) {
3624                 case LDKNetAddress_IPv4: return 0;
3625                 case LDKNetAddress_IPv6: return 1;
3626                 case LDKNetAddress_OnionV2: return 2;
3627                 case LDKNetAddress_OnionV3: return 3;
3628                 case LDKNetAddress_Hostname: return 4;
3629                 default: abort();
3630         }
3631 }
3632 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3633         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3634         assert(obj->tag == LDKNetAddress_IPv4);
3635                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3636                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3637         return addr_arr;
3638 }
3639 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3640         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3641         assert(obj->tag == LDKNetAddress_IPv4);
3642                         int16_t port_conv = obj->i_pv4.port;
3643         return port_conv;
3644 }
3645 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3646         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3647         assert(obj->tag == LDKNetAddress_IPv6);
3648                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3649                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3650         return addr_arr;
3651 }
3652 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3653         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3654         assert(obj->tag == LDKNetAddress_IPv6);
3655                         int16_t port_conv = obj->i_pv6.port;
3656         return port_conv;
3657 }
3658 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3659         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3660         assert(obj->tag == LDKNetAddress_OnionV2);
3661                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3662                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3663         return onion_v2_arr;
3664 }
3665 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3666         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3667         assert(obj->tag == LDKNetAddress_OnionV3);
3668                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3669                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3670         return ed25519_pubkey_arr;
3671 }
3672 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3673         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3674         assert(obj->tag == LDKNetAddress_OnionV3);
3675                         int16_t checksum_conv = obj->onion_v3.checksum;
3676         return checksum_conv;
3677 }
3678 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3679         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3680         assert(obj->tag == LDKNetAddress_OnionV3);
3681                         int8_t version_conv = obj->onion_v3.version;
3682         return version_conv;
3683 }
3684 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3685         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3686         assert(obj->tag == LDKNetAddress_OnionV3);
3687                         int16_t port_conv = obj->onion_v3.port;
3688         return port_conv;
3689 }
3690 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3691         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3692         assert(obj->tag == LDKNetAddress_Hostname);
3693                         LDKHostname hostname_var = obj->hostname.hostname;
3694                         uint64_t hostname_ref = 0;
3695                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3696                         hostname_ref = tag_ptr(hostname_var.inner, false);
3697         return hostname_ref;
3698 }
3699 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3700         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3701         assert(obj->tag == LDKNetAddress_Hostname);
3702                         int16_t port_conv = obj->hostname.port;
3703         return port_conv;
3704 }
3705 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3706         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3707         for (size_t i = 0; i < ret.datalen; i++) {
3708                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3709         }
3710         return ret;
3711 }
3712 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3713         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3714         ret.is_owned = false;
3715         return ret;
3716 }
3717 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3718         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3719         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3720         uint64_t ret_ref = 0;
3721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3723         return ret_ref;
3724 }
3725
3726 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3727 CHECK(!owner->result_ok);
3728         return DecodeError_clone(&*owner->contents.err);
3729 }
3730 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3731         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3732         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3733         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3734         uint64_t ret_ref = tag_ptr(ret_copy, true);
3735         return ret_ref;
3736 }
3737
3738 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3739         LDKNodeAlias ret = *owner->contents.result;
3740         ret.is_owned = false;
3741         return ret;
3742 }
3743 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3744         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3745         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3746         uint64_t ret_ref = 0;
3747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3749         return ret_ref;
3750 }
3751
3752 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3753 CHECK(!owner->result_ok);
3754         return DecodeError_clone(&*owner->contents.err);
3755 }
3756 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3757         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3758         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3759         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3760         uint64_t ret_ref = tag_ptr(ret_copy, true);
3761         return ret_ref;
3762 }
3763
3764 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3765         LDKNodeInfo ret = *owner->contents.result;
3766         ret.is_owned = false;
3767         return ret;
3768 }
3769 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3770         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3771         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3772         uint64_t ret_ref = 0;
3773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3775         return ret_ref;
3776 }
3777
3778 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3779 CHECK(!owner->result_ok);
3780         return DecodeError_clone(&*owner->contents.err);
3781 }
3782 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3783         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3784         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3785         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3786         uint64_t ret_ref = tag_ptr(ret_copy, true);
3787         return ret_ref;
3788 }
3789
3790 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3791         LDKNetworkGraph ret = *owner->contents.result;
3792         ret.is_owned = false;
3793         return ret;
3794 }
3795 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3796         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3797         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3798         uint64_t ret_ref = 0;
3799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3801         return ret_ref;
3802 }
3803
3804 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3805 CHECK(!owner->result_ok);
3806         return DecodeError_clone(&*owner->contents.err);
3807 }
3808 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3809         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3810         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3811         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3812         uint64_t ret_ref = tag_ptr(ret_copy, true);
3813         return ret_ref;
3814 }
3815
3816 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3817         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3818         switch(obj->tag) {
3819                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3820                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3821                 default: abort();
3822         }
3823 }
3824 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3825         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3826         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3827                         LDKCVec_NetAddressZ some_var = obj->some;
3828                         uint64_tArray some_arr = NULL;
3829                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3830                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3831                         for (size_t m = 0; m < some_var.datalen; m++) {
3832                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3833                                 some_arr_ptr[m] = some_conv_12_ref;
3834                         }
3835                         
3836         return some_arr;
3837 }
3838 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3839         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
3840         ret.is_owned = false;
3841         return ret;
3842 }
3843 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3844         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3845         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3846         uint64_t ret_ref = 0;
3847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3849         return ret_ref;
3850 }
3851
3852 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3853 CHECK(!owner->result_ok);
3854         return DecodeError_clone(&*owner->contents.err);
3855 }
3856 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3857         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3858         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3859         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3860         uint64_t ret_ref = tag_ptr(ret_copy, true);
3861         return ret_ref;
3862 }
3863
3864 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3865         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
3866         ret.is_owned = false;
3867         return ret;
3868 }
3869 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3870         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3871         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3872         uint64_t ret_ref = 0;
3873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3875         return ret_ref;
3876 }
3877
3878 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3879 CHECK(!owner->result_ok);
3880         return DecodeError_clone(&*owner->contents.err);
3881 }
3882 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3883         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3884         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3885         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3886         uint64_t ret_ref = tag_ptr(ret_copy, true);
3887         return ret_ref;
3888 }
3889
3890 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3891 CHECK(owner->result_ok);
3892         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3893 }
3894 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3895         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3896         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3897         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3898         uint64_t ret_ref = tag_ptr(ret_copy, true);
3899         return ret_ref;
3900 }
3901
3902 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3903 CHECK(!owner->result_ok);
3904         return DecodeError_clone(&*owner->contents.err);
3905 }
3906 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3907         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3908         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3909         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3910         uint64_t ret_ref = tag_ptr(ret_copy, true);
3911         return ret_ref;
3912 }
3913
3914 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3915         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3916         for (size_t i = 0; i < ret.datalen; i++) {
3917                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3918         }
3919         return ret;
3920 }
3921 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3922         return owner->a;
3923 }
3924 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3925         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3926         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3927         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3928         return ret_arr;
3929 }
3930
3931 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3932         return owner->b;
3933 }
3934 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3935         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3936         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3937         ptrArray ret_arr = NULL;
3938         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3939         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3940         for (size_t m = 0; m < ret_var.datalen; m++) {
3941                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3942                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3943                 ret_arr_ptr[m] = ret_conv_12_arr;
3944         }
3945         
3946         return ret_arr;
3947 }
3948
3949 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3950 CHECK(owner->result_ok);
3951         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3952 }
3953 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3954         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3955         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3956         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3957         return tag_ptr(ret_conv, true);
3958 }
3959
3960 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3961 CHECK(!owner->result_ok);
3962         return *owner->contents.err;
3963 }
3964 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3965         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3966         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3967 }
3968
3969 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3970 CHECK(owner->result_ok);
3971         return *owner->contents.result;
3972 }
3973 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3974         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3975         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3976         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3977         return ret_arr;
3978 }
3979
3980 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3981 CHECK(!owner->result_ok);
3982         return *owner->contents.err;
3983 }
3984 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3985         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3986         CResult_SignatureNoneZ_get_err(owner_conv);
3987 }
3988
3989 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3990 CHECK(owner->result_ok);
3991         return *owner->contents.result;
3992 }
3993 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
3994         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3995         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3996         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
3997         return ret_arr;
3998 }
3999
4000 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
4001 CHECK(!owner->result_ok);
4002         return *owner->contents.err;
4003 }
4004 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
4005         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
4006         CResult_PublicKeyNoneZ_get_err(owner_conv);
4007 }
4008
4009 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
4010         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
4011         switch(obj->tag) {
4012                 case LDKCOption_ScalarZ_Some: return 0;
4013                 case LDKCOption_ScalarZ_None: return 1;
4014                 default: abort();
4015         }
4016 }
4017 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
4018         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
4019         assert(obj->tag == LDKCOption_ScalarZ_Some);
4020                         LDKBigEndianScalar* some_ref = &obj->some;
4021         return tag_ptr(some_ref, false);
4022 }
4023 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
4024 CHECK(owner->result_ok);
4025         return ThirtyTwoBytes_clone(&*owner->contents.result);
4026 }
4027 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
4028         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
4029         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4030         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
4031         return ret_arr;
4032 }
4033
4034 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
4035 CHECK(!owner->result_ok);
4036         return *owner->contents.err;
4037 }
4038 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
4039         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
4040         CResult_SharedSecretNoneZ_get_err(owner_conv);
4041 }
4042
4043 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4044 CHECK(owner->result_ok);
4045         return *owner->contents.result;
4046 }
4047 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4048         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4049         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4050         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4051         return ret_arr;
4052 }
4053
4054 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4055 CHECK(!owner->result_ok);
4056         return *owner->contents.err;
4057 }
4058 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4059         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4060         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4061 }
4062
4063 typedef struct LDKChannelSigner_JCalls {
4064         atomic_size_t refcnt;
4065         uint32_t instance_ptr;
4066 } LDKChannelSigner_JCalls;
4067 static void LDKChannelSigner_JCalls_free(void* this_arg) {
4068         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4069         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4070                 FREE(j_calls);
4071         }
4072 }
4073 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
4074         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4075         int64_t idx_conv = idx;
4076         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
4077         LDKPublicKey ret_ref;
4078         CHECK(ret->arr_len == 33);
4079         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
4080         return ret_ref;
4081 }
4082 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
4083         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4084         int64_t idx_conv = idx;
4085         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
4086         LDKThirtyTwoBytes ret_ref;
4087         CHECK(ret->arr_len == 32);
4088         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4089         return ret_ref;
4090 }
4091 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4092         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4093         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4094         uint64_t holder_tx_ref = 0;
4095         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4096         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4097         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
4098         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4099         ptrArray preimages_arr = NULL;
4100         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
4101         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
4102         for (size_t m = 0; m < preimages_var.datalen; m++) {
4103                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4104                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4105                 preimages_arr_ptr[m] = preimages_conv_12_arr;
4106         }
4107         
4108         FREE(preimages_var.data);
4109         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
4110         void* ret_ptr = untag_ptr(ret);
4111         CHECK_ACCESS(ret_ptr);
4112         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4113         FREE(untag_ptr(ret));
4114         return ret_conv;
4115 }
4116 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
4117         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4118         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
4119         LDKThirtyTwoBytes ret_ref;
4120         CHECK(ret->arr_len == 32);
4121         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4122         return ret_ref;
4123 }
4124 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4125         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4126         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4127         uint64_t channel_parameters_ref = 0;
4128         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4129         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4130         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
4131         js_invoke_function_buuuuu(j_calls->instance_ptr, 6, channel_parameters_ref, 0, 0, 0, 0, 0);
4132 }
4133 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
4134         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
4135         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4136 }
4137 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
4138         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
4139         atomic_init(&calls->refcnt, 1);
4140         calls->instance_ptr = o;
4141
4142         LDKChannelPublicKeys pubkeys_conv;
4143         pubkeys_conv.inner = untag_ptr(pubkeys);
4144         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4145         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4146
4147         LDKChannelSigner ret = {
4148                 .this_arg = (void*) calls,
4149                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
4150                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
4151                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
4152                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
4153                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
4154                 .free = LDKChannelSigner_JCalls_free,
4155                 .pubkeys = pubkeys_conv,
4156                 .set_pubkeys = NULL,
4157         };
4158         return ret;
4159 }
4160 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
4161         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
4162         *res_ptr = LDKChannelSigner_init(o, pubkeys);
4163         return tag_ptr(res_ptr, true);
4164 }
4165 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
4166         void* this_arg_ptr = untag_ptr(this_arg);
4167         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4168         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4169         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4170         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
4171         return ret_arr;
4172 }
4173
4174 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
4175         void* this_arg_ptr = untag_ptr(this_arg);
4176         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4177         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4178         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4179         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
4180         return ret_arr;
4181 }
4182
4183 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) {
4184         void* this_arg_ptr = untag_ptr(this_arg);
4185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4186         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4187         LDKHolderCommitmentTransaction holder_tx_conv;
4188         holder_tx_conv.inner = untag_ptr(holder_tx);
4189         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4190         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4191         holder_tx_conv.is_owned = false;
4192         LDKCVec_PaymentPreimageZ preimages_constr;
4193         preimages_constr.datalen = preimages->arr_len;
4194         if (preimages_constr.datalen > 0)
4195                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4196         else
4197                 preimages_constr.data = NULL;
4198         int8_tArray* preimages_vals = (void*) preimages->elems;
4199         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4200                 int8_tArray preimages_conv_12 = preimages_vals[m];
4201                 LDKThirtyTwoBytes preimages_conv_12_ref;
4202                 CHECK(preimages_conv_12->arr_len == 32);
4203                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4204                 preimages_constr.data[m] = preimages_conv_12_ref;
4205         }
4206         FREE(preimages);
4207         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4208         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4209         return tag_ptr(ret_conv, true);
4210 }
4211
4212 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
4213         void* this_arg_ptr = untag_ptr(this_arg);
4214         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4215         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4216         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4217         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4218         return ret_arr;
4219 }
4220
4221 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
4222         void* this_arg_ptr = untag_ptr(this_arg);
4223         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4224         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4225         LDKChannelTransactionParameters channel_parameters_conv;
4226         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4227         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4228         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4229         channel_parameters_conv.is_owned = false;
4230         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
4231 }
4232
4233 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
4234         if (this_arg->set_pubkeys != NULL)
4235                 this_arg->set_pubkeys(this_arg);
4236         return this_arg->pubkeys;
4237 }
4238 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
4239         void* this_arg_ptr = untag_ptr(this_arg);
4240         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4241         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4242         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
4243         uint64_t ret_ref = 0;
4244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4246         return ret_ref;
4247 }
4248
4249 typedef struct LDKEcdsaChannelSigner_JCalls {
4250         atomic_size_t refcnt;
4251         uint32_t instance_ptr;
4252         LDKChannelSigner_JCalls* ChannelSigner;
4253 } LDKEcdsaChannelSigner_JCalls;
4254 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
4255         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4256         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4257                 FREE(j_calls);
4258         }
4259 }
4260 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4261         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4262         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4263         uint64_t commitment_tx_ref = 0;
4264         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4265         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4266         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4267         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4268         ptrArray preimages_arr = NULL;
4269         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
4270         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
4271         for (size_t m = 0; m < preimages_var.datalen; m++) {
4272                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4273                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4274                 preimages_arr_ptr[m] = preimages_conv_12_arr;
4275         }
4276         
4277         FREE(preimages_var.data);
4278         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
4279         void* ret_ptr = untag_ptr(ret);
4280         CHECK_ACCESS(ret_ptr);
4281         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4282         FREE(untag_ptr(ret));
4283         return ret_conv;
4284 }
4285 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4286         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4287         int64_t idx_conv = idx;
4288         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
4289         memcpy(secret_arr->elems, *secret, 32);
4290         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
4291         void* ret_ptr = untag_ptr(ret);
4292         CHECK_ACCESS(ret_ptr);
4293         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4294         FREE(untag_ptr(ret));
4295         return ret_conv;
4296 }
4297 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4298         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4299         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4300         uint64_t commitment_tx_ref = 0;
4301         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4302         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4303         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4304         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 9, commitment_tx_ref, 0, 0, 0, 0, 0);
4305         void* ret_ptr = untag_ptr(ret);
4306         CHECK_ACCESS(ret_ptr);
4307         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4308         FREE(untag_ptr(ret));
4309         return ret_conv;
4310 }
4311 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]) {
4312         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4313         LDKTransaction justice_tx_var = justice_tx;
4314         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4315         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4316         Transaction_free(justice_tx_var);
4317         uint32_t input_conv = input;
4318         int64_t amount_conv = amount;
4319         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4320         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4321         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);
4322         void* ret_ptr = untag_ptr(ret);
4323         CHECK_ACCESS(ret_ptr);
4324         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4325         FREE(untag_ptr(ret));
4326         return ret_conv;
4327 }
4328 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) {
4329         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4330         LDKTransaction justice_tx_var = justice_tx;
4331         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4332         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4333         Transaction_free(justice_tx_var);
4334         uint32_t input_conv = input;
4335         int64_t amount_conv = amount;
4336         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4337         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4338         LDKHTLCOutputInCommitment htlc_var = *htlc;
4339         uint64_t htlc_ref = 0;
4340         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4341         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4342         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4343         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);
4344         void* ret_ptr = untag_ptr(ret);
4345         CHECK_ACCESS(ret_ptr);
4346         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4347         FREE(untag_ptr(ret));
4348         return ret_conv;
4349 }
4350 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) {
4351         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4352         LDKTransaction htlc_tx_var = htlc_tx;
4353         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
4354         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
4355         Transaction_free(htlc_tx_var);
4356         uint32_t input_conv = input;
4357         int64_t amount_conv = amount;
4358         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
4359         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
4360         LDKHTLCOutputInCommitment htlc_var = *htlc;
4361         uint64_t htlc_ref = 0;
4362         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4363         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4364         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4365         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);
4366         void* ret_ptr = untag_ptr(ret);
4367         CHECK_ACCESS(ret_ptr);
4368         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4369         FREE(untag_ptr(ret));
4370         return ret_conv;
4371 }
4372 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4373         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4374         LDKClosingTransaction closing_tx_var = *closing_tx;
4375         uint64_t closing_tx_ref = 0;
4376         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4377         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4378         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
4379         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 13, closing_tx_ref, 0, 0, 0, 0, 0);
4380         void* ret_ptr = untag_ptr(ret);
4381         CHECK_ACCESS(ret_ptr);
4382         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4383         FREE(untag_ptr(ret));
4384         return ret_conv;
4385 }
4386 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
4387         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4388         LDKTransaction anchor_tx_var = anchor_tx;
4389         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
4390         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
4391         Transaction_free(anchor_tx_var);
4392         uint32_t input_conv = input;
4393         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 14, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
4394         void* ret_ptr = untag_ptr(ret);
4395         CHECK_ACCESS(ret_ptr);
4396         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4397         FREE(untag_ptr(ret));
4398         return ret_conv;
4399 }
4400 LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4401         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4402         LDKUnsignedChannelAnnouncement msg_var = *msg;
4403         uint64_t msg_ref = 0;
4404         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4405         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4406         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
4407         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 15, msg_ref, 0, 0, 0, 0, 0);
4408         void* ret_ptr = untag_ptr(ret);
4409         CHECK_ACCESS(ret_ptr);
4410         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4411         FREE(untag_ptr(ret));
4412         return ret_conv;
4413 }
4414 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
4415         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
4416         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4417         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
4418 }
4419 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
4420         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
4421         atomic_init(&calls->refcnt, 1);
4422         calls->instance_ptr = o;
4423
4424         LDKChannelPublicKeys pubkeys_conv;
4425         pubkeys_conv.inner = untag_ptr(pubkeys);
4426         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4427         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4428
4429         LDKEcdsaChannelSigner ret = {
4430                 .this_arg = (void*) calls,
4431                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
4432                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
4433                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
4434                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
4435                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
4436                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
4437                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
4438                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
4439                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
4440                 .free = LDKEcdsaChannelSigner_JCalls_free,
4441                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
4442         };
4443         calls->ChannelSigner = ret.ChannelSigner.this_arg;
4444         return ret;
4445 }
4446 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
4447         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
4448         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
4449         return tag_ptr(res_ptr, true);
4450 }
4451 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) {
4452         void* this_arg_ptr = untag_ptr(this_arg);
4453         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4454         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4455         LDKCommitmentTransaction commitment_tx_conv;
4456         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4457         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4458         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4459         commitment_tx_conv.is_owned = false;
4460         LDKCVec_PaymentPreimageZ preimages_constr;
4461         preimages_constr.datalen = preimages->arr_len;
4462         if (preimages_constr.datalen > 0)
4463                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4464         else
4465                 preimages_constr.data = NULL;
4466         int8_tArray* preimages_vals = (void*) preimages->elems;
4467         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4468                 int8_tArray preimages_conv_12 = preimages_vals[m];
4469                 LDKThirtyTwoBytes preimages_conv_12_ref;
4470                 CHECK(preimages_conv_12->arr_len == 32);
4471                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4472                 preimages_constr.data[m] = preimages_conv_12_ref;
4473         }
4474         FREE(preimages);
4475         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4476         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4477         return tag_ptr(ret_conv, true);
4478 }
4479
4480 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) {
4481         void* this_arg_ptr = untag_ptr(this_arg);
4482         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4483         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4484         uint8_t secret_arr[32];
4485         CHECK(secret->arr_len == 32);
4486         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4487         uint8_t (*secret_ref)[32] = &secret_arr;
4488         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4489         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4490         return tag_ptr(ret_conv, true);
4491 }
4492
4493 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) {
4494         void* this_arg_ptr = untag_ptr(this_arg);
4495         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4496         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4497         LDKHolderCommitmentTransaction commitment_tx_conv;
4498         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4499         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4500         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4501         commitment_tx_conv.is_owned = false;
4502         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4503         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4504         return tag_ptr(ret_conv, true);
4505 }
4506
4507 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) {
4508         void* this_arg_ptr = untag_ptr(this_arg);
4509         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4510         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4511         LDKTransaction justice_tx_ref;
4512         justice_tx_ref.datalen = justice_tx->arr_len;
4513         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4514         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4515         justice_tx_ref.data_is_owned = true;
4516         uint8_t per_commitment_key_arr[32];
4517         CHECK(per_commitment_key->arr_len == 32);
4518         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4519         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4520         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4521         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4522         return tag_ptr(ret_conv, true);
4523 }
4524
4525 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) {
4526         void* this_arg_ptr = untag_ptr(this_arg);
4527         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4528         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4529         LDKTransaction justice_tx_ref;
4530         justice_tx_ref.datalen = justice_tx->arr_len;
4531         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4532         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4533         justice_tx_ref.data_is_owned = true;
4534         uint8_t per_commitment_key_arr[32];
4535         CHECK(per_commitment_key->arr_len == 32);
4536         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4537         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4538         LDKHTLCOutputInCommitment htlc_conv;
4539         htlc_conv.inner = untag_ptr(htlc);
4540         htlc_conv.is_owned = ptr_is_owned(htlc);
4541         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4542         htlc_conv.is_owned = false;
4543         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4544         *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);
4545         return tag_ptr(ret_conv, true);
4546 }
4547
4548 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) {
4549         void* this_arg_ptr = untag_ptr(this_arg);
4550         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4551         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4552         LDKTransaction htlc_tx_ref;
4553         htlc_tx_ref.datalen = htlc_tx->arr_len;
4554         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4555         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4556         htlc_tx_ref.data_is_owned = true;
4557         LDKPublicKey per_commitment_point_ref;
4558         CHECK(per_commitment_point->arr_len == 33);
4559         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4560         LDKHTLCOutputInCommitment htlc_conv;
4561         htlc_conv.inner = untag_ptr(htlc);
4562         htlc_conv.is_owned = ptr_is_owned(htlc);
4563         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4564         htlc_conv.is_owned = false;
4565         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4566         *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);
4567         return tag_ptr(ret_conv, true);
4568 }
4569
4570 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4571         void* this_arg_ptr = untag_ptr(this_arg);
4572         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4573         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4574         LDKClosingTransaction closing_tx_conv;
4575         closing_tx_conv.inner = untag_ptr(closing_tx);
4576         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4577         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4578         closing_tx_conv.is_owned = false;
4579         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4580         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4581         return tag_ptr(ret_conv, true);
4582 }
4583
4584 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) {
4585         void* this_arg_ptr = untag_ptr(this_arg);
4586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4587         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4588         LDKTransaction anchor_tx_ref;
4589         anchor_tx_ref.datalen = anchor_tx->arr_len;
4590         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
4591         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
4592         anchor_tx_ref.data_is_owned = true;
4593         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4594         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
4595         return tag_ptr(ret_conv, true);
4596 }
4597
4598 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) {
4599         void* this_arg_ptr = untag_ptr(this_arg);
4600         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4601         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4602         LDKUnsignedChannelAnnouncement msg_conv;
4603         msg_conv.inner = untag_ptr(msg);
4604         msg_conv.is_owned = ptr_is_owned(msg);
4605         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4606         msg_conv.is_owned = false;
4607         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4608         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
4609         return tag_ptr(ret_conv, true);
4610 }
4611
4612 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
4613         atomic_size_t refcnt;
4614         uint32_t instance_ptr;
4615         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
4616         LDKChannelSigner_JCalls* ChannelSigner;
4617 } LDKWriteableEcdsaChannelSigner_JCalls;
4618 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
4619         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
4620         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4621                 FREE(j_calls);
4622         }
4623 }
4624 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
4625         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
4626         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 16, 0, 0, 0, 0, 0, 0);
4627         LDKCVec_u8Z ret_ref;
4628         ret_ref.datalen = ret->arr_len;
4629         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4630         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4631         return ret_ref;
4632 }
4633 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
4634         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
4635         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4636         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
4637         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
4638 }
4639 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
4640         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
4641         atomic_init(&calls->refcnt, 1);
4642         calls->instance_ptr = o;
4643
4644         LDKChannelPublicKeys pubkeys_conv;
4645         pubkeys_conv.inner = untag_ptr(pubkeys);
4646         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4647         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4648
4649         LDKWriteableEcdsaChannelSigner ret = {
4650                 .this_arg = (void*) calls,
4651                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
4652                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
4653                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
4654                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
4655         };
4656         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
4657         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
4658         return ret;
4659 }
4660 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
4661         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4662         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
4663         return tag_ptr(res_ptr, true);
4664 }
4665 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
4666         void* this_arg_ptr = untag_ptr(this_arg);
4667         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4668         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
4669         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4670         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4671         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4672         CVec_u8Z_free(ret_var);
4673         return ret_arr;
4674 }
4675
4676 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4677 CHECK(owner->result_ok);
4678         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
4679 }
4680 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
4681         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4682         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4683         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
4684         return tag_ptr(ret_ret, true);
4685 }
4686
4687 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4688 CHECK(!owner->result_ok);
4689         return DecodeError_clone(&*owner->contents.err);
4690 }
4691 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
4692         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4693         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4694         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
4695         uint64_t ret_ref = tag_ptr(ret_copy, true);
4696         return ret_ref;
4697 }
4698
4699 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4700         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4701         for (size_t i = 0; i < ret.datalen; i++) {
4702                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4703         }
4704         return ret;
4705 }
4706 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4707 CHECK(owner->result_ok);
4708         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4709 }
4710 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4711         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4712         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4713         ptrArray ret_arr = NULL;
4714         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4715         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4716         for (size_t m = 0; m < ret_var.datalen; m++) {
4717                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4718                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4719                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4720                 CVec_u8Z_free(ret_conv_12_var);
4721                 ret_arr_ptr[m] = ret_conv_12_arr;
4722         }
4723         
4724         FREE(ret_var.data);
4725         return ret_arr;
4726 }
4727
4728 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4729 CHECK(!owner->result_ok);
4730         return *owner->contents.err;
4731 }
4732 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4733         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4734         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4735 }
4736
4737 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4738         LDKInMemorySigner ret = *owner->contents.result;
4739         ret.is_owned = false;
4740         return ret;
4741 }
4742 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4743         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4744         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4745         uint64_t ret_ref = 0;
4746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4748         return ret_ref;
4749 }
4750
4751 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4752 CHECK(!owner->result_ok);
4753         return DecodeError_clone(&*owner->contents.err);
4754 }
4755 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4756         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4757         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4758         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4759         uint64_t ret_ref = tag_ptr(ret_copy, true);
4760         return ret_ref;
4761 }
4762
4763 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4764         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4765         for (size_t i = 0; i < ret.datalen; i++) {
4766                 ret.data[i] = TxOut_clone(&orig->data[i]);
4767         }
4768         return ret;
4769 }
4770 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4771 CHECK(owner->result_ok);
4772         return *owner->contents.result;
4773 }
4774 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4775         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4776         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4777         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4778         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4779         return ret_arr;
4780 }
4781
4782 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4783 CHECK(!owner->result_ok);
4784         return *owner->contents.err;
4785 }
4786 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4787         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4788         CResult_TransactionNoneZ_get_err(owner_conv);
4789 }
4790
4791 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4792         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4793         switch(obj->tag) {
4794                 case LDKCOption_u16Z_Some: return 0;
4795                 case LDKCOption_u16Z_None: return 1;
4796                 default: abort();
4797         }
4798 }
4799 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4800         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4801         assert(obj->tag == LDKCOption_u16Z_Some);
4802                         int16_t some_conv = obj->some;
4803         return some_conv;
4804 }
4805 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4806 CHECK(owner->result_ok);
4807         return ThirtyTwoBytes_clone(&*owner->contents.result);
4808 }
4809 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4810         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4811         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4812         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4813         return ret_arr;
4814 }
4815
4816 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4817 CHECK(!owner->result_ok);
4818         return APIError_clone(&*owner->contents.err);
4819 }
4820 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4821         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4822         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4823         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4824         uint64_t ret_ref = tag_ptr(ret_copy, true);
4825         return ret_ref;
4826 }
4827
4828 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
4829         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4830         switch(obj->tag) {
4831                 case LDKRecentPaymentDetails_Pending: return 0;
4832                 case LDKRecentPaymentDetails_Fulfilled: return 1;
4833                 case LDKRecentPaymentDetails_Abandoned: return 2;
4834                 default: abort();
4835         }
4836 }
4837 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
4838         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4839         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4840                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4841                         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
4842         return payment_hash_arr;
4843 }
4844 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
4845         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4846         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4847                         int64_t total_msat_conv = obj->pending.total_msat;
4848         return total_msat_conv;
4849 }
4850 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
4851         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4852         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4853                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4854                         memcpy(payment_hash_arr->elems, obj->fulfilled.payment_hash.data, 32);
4855         return payment_hash_arr;
4856 }
4857 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
4858         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4859         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4860                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4861                         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
4862         return payment_hash_arr;
4863 }
4864 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
4865         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
4866         for (size_t i = 0; i < ret.datalen; i++) {
4867                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
4868         }
4869         return ret;
4870 }
4871 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4872         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4873         switch(obj->tag) {
4874                 case LDKPaymentSendFailure_ParameterError: return 0;
4875                 case LDKPaymentSendFailure_PathParameterError: return 1;
4876                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4877                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4878                 case LDKPaymentSendFailure_PartialFailure: return 4;
4879                 default: abort();
4880         }
4881 }
4882 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4883         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4884         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4885                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4886         return parameter_error_ref;
4887 }
4888 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4889         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4890         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4891                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4892                         uint64_tArray path_parameter_error_arr = NULL;
4893                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4894                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4895                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4896                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4897                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4898                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4899                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4900                         }
4901                         
4902         return path_parameter_error_arr;
4903 }
4904 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4905         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4906         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4907                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4908                         uint64_tArray all_failed_resend_safe_arr = NULL;
4909                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4910                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4911                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4912                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4913                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4914                         }
4915                         
4916         return all_failed_resend_safe_arr;
4917 }
4918 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4919         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4920         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4921                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4922                         uint64_tArray results_arr = NULL;
4923                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4924                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4925                         for (size_t w = 0; w < results_var.datalen; w++) {
4926                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4927                                 *results_conv_22_conv = results_var.data[w];
4928                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4929                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4930                         }
4931                         
4932         return results_arr;
4933 }
4934 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4935         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4936         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4937                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4938                         uint64_t failed_paths_retry_ref = 0;
4939                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4940                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4941         return failed_paths_retry_ref;
4942 }
4943 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4944         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4945         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4946                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4947                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4948         return payment_id_arr;
4949 }
4950 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4951 CHECK(owner->result_ok);
4952         return *owner->contents.result;
4953 }
4954 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4955         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4956         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4957 }
4958
4959 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4960 CHECK(!owner->result_ok);
4961         return PaymentSendFailure_clone(&*owner->contents.err);
4962 }
4963 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4964         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4965         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4966         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4967         uint64_t ret_ref = tag_ptr(ret_copy, true);
4968         return ret_ref;
4969 }
4970
4971 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4972 CHECK(owner->result_ok);
4973         return *owner->contents.result;
4974 }
4975 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
4976         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4977         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
4978 }
4979
4980 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4981 CHECK(!owner->result_ok);
4982         return RetryableSendFailure_clone(&*owner->contents.err);
4983 }
4984 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
4985         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4986         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
4987         return ret_conv;
4988 }
4989
4990 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
4991 CHECK(owner->result_ok);
4992         return ThirtyTwoBytes_clone(&*owner->contents.result);
4993 }
4994 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_ok(uint64_t owner) {
4995         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
4996         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4997         memcpy(ret_arr->elems, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4998         return ret_arr;
4999 }
5000
5001 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
5002 CHECK(!owner->result_ok);
5003         return PaymentSendFailure_clone(&*owner->contents.err);
5004 }
5005 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_err(uint64_t owner) {
5006         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
5007         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5008         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
5009         uint64_t ret_ref = tag_ptr(ret_copy, true);
5010         return ret_ref;
5011 }
5012
5013 static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
5014 CHECK(owner->result_ok);
5015         return ThirtyTwoBytes_clone(&*owner->contents.result);
5016 }
5017 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_ok(uint64_t owner) {
5018         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
5019         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5020         memcpy(ret_arr->elems, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5021         return ret_arr;
5022 }
5023
5024 static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
5025 CHECK(!owner->result_ok);
5026         return RetryableSendFailure_clone(&*owner->contents.err);
5027 }
5028 uint32_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_err(uint64_t owner) {
5029         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
5030         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv));
5031         return ret_conv;
5032 }
5033
5034 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5035         return ThirtyTwoBytes_clone(&owner->a);
5036 }
5037 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
5038         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5039         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5040         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
5041         return ret_arr;
5042 }
5043
5044 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5045         return ThirtyTwoBytes_clone(&owner->b);
5046 }
5047 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
5048         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5049         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5050         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
5051         return ret_arr;
5052 }
5053
5054 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5055 CHECK(owner->result_ok);
5056         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5057 }
5058 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
5059         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5060         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5061         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5062         return tag_ptr(ret_conv, true);
5063 }
5064
5065 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5066 CHECK(!owner->result_ok);
5067         return PaymentSendFailure_clone(&*owner->contents.err);
5068 }
5069 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
5070         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5071         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5072         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5073         uint64_t ret_ref = tag_ptr(ret_copy, true);
5074         return ret_ref;
5075 }
5076
5077 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
5078         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
5079         for (size_t i = 0; i < ret.datalen; i++) {
5080                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5081         }
5082         return ret;
5083 }
5084 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5085         return ThirtyTwoBytes_clone(&owner->a);
5086 }
5087 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
5088         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5089         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5090         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
5091         return ret_arr;
5092 }
5093
5094 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5095         return ThirtyTwoBytes_clone(&owner->b);
5096 }
5097 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
5098         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5099         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5100         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
5101         return ret_arr;
5102 }
5103
5104 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5105 CHECK(owner->result_ok);
5106         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5107 }
5108 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
5109         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5110         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5111         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5112         return tag_ptr(ret_conv, true);
5113 }
5114
5115 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5116 CHECK(!owner->result_ok);
5117         return *owner->contents.err;
5118 }
5119 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
5120         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5121         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5122 }
5123
5124 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5125 CHECK(owner->result_ok);
5126         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5127 }
5128 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
5129         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5130         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5131         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5132         return tag_ptr(ret_conv, true);
5133 }
5134
5135 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5136 CHECK(!owner->result_ok);
5137         return APIError_clone(&*owner->contents.err);
5138 }
5139 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
5140         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5141         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5142         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5143         uint64_t ret_ref = tag_ptr(ret_copy, true);
5144         return ret_ref;
5145 }
5146
5147 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5148 CHECK(owner->result_ok);
5149         return ThirtyTwoBytes_clone(&*owner->contents.result);
5150 }
5151 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
5152         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5153         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5154         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
5155         return ret_arr;
5156 }
5157
5158 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5159 CHECK(!owner->result_ok);
5160         return *owner->contents.err;
5161 }
5162 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
5163         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5164         CResult_PaymentSecretNoneZ_get_err(owner_conv);
5165 }
5166
5167 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5168 CHECK(owner->result_ok);
5169         return ThirtyTwoBytes_clone(&*owner->contents.result);
5170 }
5171 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
5172         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5173         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5174         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
5175         return ret_arr;
5176 }
5177
5178 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5179 CHECK(!owner->result_ok);
5180         return APIError_clone(&*owner->contents.err);
5181 }
5182 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
5183         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5184         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5185         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5186         uint64_t ret_ref = tag_ptr(ret_copy, true);
5187         return ret_ref;
5188 }
5189
5190 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5191 CHECK(owner->result_ok);
5192         return ThirtyTwoBytes_clone(&*owner->contents.result);
5193 }
5194 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
5195         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5196         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5197         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
5198         return ret_arr;
5199 }
5200
5201 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5202 CHECK(!owner->result_ok);
5203         return APIError_clone(&*owner->contents.err);
5204 }
5205 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
5206         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5207         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5208         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5209         uint64_t ret_ref = tag_ptr(ret_copy, true);
5210         return ret_ref;
5211 }
5212
5213 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5214         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5215         ret.is_owned = false;
5216         return ret;
5217 }
5218 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5219         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5220         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5221         uint64_t ret_ref = 0;
5222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5224         return ret_ref;
5225 }
5226
5227 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5228 CHECK(!owner->result_ok);
5229         return DecodeError_clone(&*owner->contents.err);
5230 }
5231 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5232         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5233         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5234         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5235         uint64_t ret_ref = tag_ptr(ret_copy, true);
5236         return ret_ref;
5237 }
5238
5239 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5240         LDKChannelCounterparty ret = *owner->contents.result;
5241         ret.is_owned = false;
5242         return ret;
5243 }
5244 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5245         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5246         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5247         uint64_t ret_ref = 0;
5248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5250         return ret_ref;
5251 }
5252
5253 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5254 CHECK(!owner->result_ok);
5255         return DecodeError_clone(&*owner->contents.err);
5256 }
5257 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5258         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5259         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5260         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5261         uint64_t ret_ref = tag_ptr(ret_copy, true);
5262         return ret_ref;
5263 }
5264
5265 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5266         LDKChannelDetails ret = *owner->contents.result;
5267         ret.is_owned = false;
5268         return ret;
5269 }
5270 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5271         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5272         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5273         uint64_t ret_ref = 0;
5274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5276         return ret_ref;
5277 }
5278
5279 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5280 CHECK(!owner->result_ok);
5281         return DecodeError_clone(&*owner->contents.err);
5282 }
5283 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5284         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5285         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5286         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5287         uint64_t ret_ref = tag_ptr(ret_copy, true);
5288         return ret_ref;
5289 }
5290
5291 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5292         LDKPhantomRouteHints ret = *owner->contents.result;
5293         ret.is_owned = false;
5294         return ret;
5295 }
5296 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5297         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5298         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5299         uint64_t ret_ref = 0;
5300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5302         return ret_ref;
5303 }
5304
5305 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5306 CHECK(!owner->result_ok);
5307         return DecodeError_clone(&*owner->contents.err);
5308 }
5309 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5310         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5311         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5312         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5313         uint64_t ret_ref = tag_ptr(ret_copy, true);
5314         return ret_ref;
5315 }
5316
5317 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5318         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5319         for (size_t i = 0; i < ret.datalen; i++) {
5320                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5321         }
5322         return ret;
5323 }
5324 typedef struct LDKWatch_JCalls {
5325         atomic_size_t refcnt;
5326         uint32_t instance_ptr;
5327 } LDKWatch_JCalls;
5328 static void LDKWatch_JCalls_free(void* this_arg) {
5329         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5330         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5331                 FREE(j_calls);
5332         }
5333 }
5334 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5335         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5336         LDKOutPoint funding_txo_var = funding_txo;
5337         uint64_t funding_txo_ref = 0;
5338         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5339         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5340         LDKChannelMonitor monitor_var = monitor;
5341         uint64_t monitor_ref = 0;
5342         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5343         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5344         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5345         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5346         return ret_conv;
5347 }
5348 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5349         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5350         LDKOutPoint funding_txo_var = funding_txo;
5351         uint64_t funding_txo_ref = 0;
5352         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5353         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5354         LDKChannelMonitorUpdate update_var = *update;
5355         uint64_t update_ref = 0;
5356         update_var = ChannelMonitorUpdate_clone(&update_var);
5357         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5358         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5359         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, update_ref, 0, 0, 0, 0);
5360         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5361         return ret_conv;
5362 }
5363 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5364         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5365         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, 0, 0, 0, 0, 0, 0);
5366         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5367         ret_constr.datalen = ret->arr_len;
5368         if (ret_constr.datalen > 0)
5369                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5370         else
5371                 ret_constr.data = NULL;
5372         uint64_t* ret_vals = ret->elems;
5373         for (size_t x = 0; x < ret_constr.datalen; x++) {
5374                 uint64_t ret_conv_49 = ret_vals[x];
5375                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5376                 CHECK_ACCESS(ret_conv_49_ptr);
5377                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5378                 FREE(untag_ptr(ret_conv_49));
5379                 ret_constr.data[x] = ret_conv_49_conv;
5380         }
5381         FREE(ret);
5382         return ret_constr;
5383 }
5384 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5385         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5386         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5387 }
5388 static inline LDKWatch LDKWatch_init (JSValue o) {
5389         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5390         atomic_init(&calls->refcnt, 1);
5391         calls->instance_ptr = o;
5392
5393         LDKWatch ret = {
5394                 .this_arg = (void*) calls,
5395                 .watch_channel = watch_channel_LDKWatch_jcall,
5396                 .update_channel = update_channel_LDKWatch_jcall,
5397                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5398                 .free = LDKWatch_JCalls_free,
5399         };
5400         return ret;
5401 }
5402 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5403         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5404         *res_ptr = LDKWatch_init(o);
5405         return tag_ptr(res_ptr, true);
5406 }
5407 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5408         void* this_arg_ptr = untag_ptr(this_arg);
5409         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5410         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5411         LDKOutPoint funding_txo_conv;
5412         funding_txo_conv.inner = untag_ptr(funding_txo);
5413         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5414         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5415         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5416         LDKChannelMonitor monitor_conv;
5417         monitor_conv.inner = untag_ptr(monitor);
5418         monitor_conv.is_owned = ptr_is_owned(monitor);
5419         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5420         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5421         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
5422         return ret_conv;
5423 }
5424
5425 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5426         void* this_arg_ptr = untag_ptr(this_arg);
5427         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5428         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5429         LDKOutPoint funding_txo_conv;
5430         funding_txo_conv.inner = untag_ptr(funding_txo);
5431         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5432         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5433         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5434         LDKChannelMonitorUpdate update_conv;
5435         update_conv.inner = untag_ptr(update);
5436         update_conv.is_owned = ptr_is_owned(update);
5437         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5438         update_conv.is_owned = false;
5439         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5440         return ret_conv;
5441 }
5442
5443 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5444         void* this_arg_ptr = untag_ptr(this_arg);
5445         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5446         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5447         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5448         uint64_tArray ret_arr = NULL;
5449         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5450         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5451         for (size_t x = 0; x < ret_var.datalen; x++) {
5452                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5453                 *ret_conv_49_conv = ret_var.data[x];
5454                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5455         }
5456         
5457         FREE(ret_var.data);
5458         return ret_arr;
5459 }
5460
5461 typedef struct LDKBroadcasterInterface_JCalls {
5462         atomic_size_t refcnt;
5463         uint32_t instance_ptr;
5464 } LDKBroadcasterInterface_JCalls;
5465 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5466         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5467         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5468                 FREE(j_calls);
5469         }
5470 }
5471 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5472         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5473         LDKTransaction tx_var = tx;
5474         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5475         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5476         Transaction_free(tx_var);
5477         js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5478 }
5479 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5480         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5481         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5482 }
5483 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5484         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5485         atomic_init(&calls->refcnt, 1);
5486         calls->instance_ptr = o;
5487
5488         LDKBroadcasterInterface ret = {
5489                 .this_arg = (void*) calls,
5490                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5491                 .free = LDKBroadcasterInterface_JCalls_free,
5492         };
5493         return ret;
5494 }
5495 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5496         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5497         *res_ptr = LDKBroadcasterInterface_init(o);
5498         return tag_ptr(res_ptr, true);
5499 }
5500 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5501         void* this_arg_ptr = untag_ptr(this_arg);
5502         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5503         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5504         LDKTransaction tx_ref;
5505         tx_ref.datalen = tx->arr_len;
5506         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5507         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5508         tx_ref.data_is_owned = true;
5509         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5510 }
5511
5512 typedef struct LDKEntropySource_JCalls {
5513         atomic_size_t refcnt;
5514         uint32_t instance_ptr;
5515 } LDKEntropySource_JCalls;
5516 static void LDKEntropySource_JCalls_free(void* this_arg) {
5517         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5518         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5519                 FREE(j_calls);
5520         }
5521 }
5522 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5523         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5524         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, 0, 0, 0, 0, 0, 0);
5525         LDKThirtyTwoBytes ret_ref;
5526         CHECK(ret->arr_len == 32);
5527         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5528         return ret_ref;
5529 }
5530 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5531         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5532         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5533 }
5534 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5535         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5536         atomic_init(&calls->refcnt, 1);
5537         calls->instance_ptr = o;
5538
5539         LDKEntropySource ret = {
5540                 .this_arg = (void*) calls,
5541                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5542                 .free = LDKEntropySource_JCalls_free,
5543         };
5544         return ret;
5545 }
5546 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5547         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5548         *res_ptr = LDKEntropySource_init(o);
5549         return tag_ptr(res_ptr, true);
5550 }
5551 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5552         void* this_arg_ptr = untag_ptr(this_arg);
5553         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5554         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5555         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5556         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5557         return ret_arr;
5558 }
5559
5560 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5561         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5562         switch(obj->tag) {
5563                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5564                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5565                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5566                 default: abort();
5567         }
5568 }
5569 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5570         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5571         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5572                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5573                         uint64_t channel_announcement_ref = 0;
5574                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5575                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5576         return channel_announcement_ref;
5577 }
5578 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5579         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5580         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5581                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5582                         uint64_t channel_update_ref = 0;
5583                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5584                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5585         return channel_update_ref;
5586 }
5587 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5588         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5589         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5590                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5591                         uint64_t node_announcement_ref = 0;
5592                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5593                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5594         return node_announcement_ref;
5595 }
5596 typedef struct LDKNodeSigner_JCalls {
5597         atomic_size_t refcnt;
5598         uint32_t instance_ptr;
5599 } LDKNodeSigner_JCalls;
5600 static void LDKNodeSigner_JCalls_free(void* this_arg) {
5601         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5602         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5603                 FREE(j_calls);
5604         }
5605 }
5606 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
5607         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5608         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5609         LDKThirtyTwoBytes ret_ref;
5610         CHECK(ret->arr_len == 32);
5611         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5612         return ret_ref;
5613 }
5614 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
5615         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5616         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5617         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, recipient_conv, 0, 0, 0, 0, 0);
5618         void* ret_ptr = untag_ptr(ret);
5619         CHECK_ACCESS(ret_ptr);
5620         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5621         FREE(untag_ptr(ret));
5622         return ret_conv;
5623 }
5624 LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5625         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5626         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5627         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5628         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5629         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5630         *tweak_copy = tweak;
5631         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5632         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 24, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5633         void* ret_ptr = untag_ptr(ret);
5634         CHECK_ACCESS(ret_ptr);
5635         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5636         FREE(untag_ptr(ret));
5637         return ret_conv;
5638 }
5639 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
5640         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5641         LDKu8slice hrp_bytes_var = hrp_bytes;
5642         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5643         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5644         LDKCVec_U5Z invoice_data_var = invoice_data;
5645         ptrArray invoice_data_arr = NULL;
5646         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5647         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5648         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5649                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5650                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5651         }
5652         
5653         FREE(invoice_data_var.data);
5654         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5655         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);
5656         void* ret_ptr = untag_ptr(ret);
5657         CHECK_ACCESS(ret_ptr);
5658         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5659         FREE(untag_ptr(ret));
5660         return ret_conv;
5661 }
5662 LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
5663         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5664         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
5665         *msg_copy = msg;
5666         uint64_t msg_ref = tag_ptr(msg_copy, true);
5667         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 26, msg_ref, 0, 0, 0, 0, 0);
5668         void* ret_ptr = untag_ptr(ret);
5669         CHECK_ACCESS(ret_ptr);
5670         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5671         FREE(untag_ptr(ret));
5672         return ret_conv;
5673 }
5674 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
5675         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
5676         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5677 }
5678 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
5679         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
5680         atomic_init(&calls->refcnt, 1);
5681         calls->instance_ptr = o;
5682
5683         LDKNodeSigner ret = {
5684                 .this_arg = (void*) calls,
5685                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
5686                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
5687                 .ecdh = ecdh_LDKNodeSigner_jcall,
5688                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
5689                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
5690                 .free = LDKNodeSigner_JCalls_free,
5691         };
5692         return ret;
5693 }
5694 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
5695         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
5696         *res_ptr = LDKNodeSigner_init(o);
5697         return tag_ptr(res_ptr, true);
5698 }
5699 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
5700         void* this_arg_ptr = untag_ptr(this_arg);
5701         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5702         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5703         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5704         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5705         return ret_arr;
5706 }
5707
5708 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
5709         void* this_arg_ptr = untag_ptr(this_arg);
5710         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5711         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5712         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5713         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5714         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5715         return tag_ptr(ret_conv, true);
5716 }
5717
5718 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) {
5719         void* this_arg_ptr = untag_ptr(this_arg);
5720         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5721         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5722         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5723         LDKPublicKey other_key_ref;
5724         CHECK(other_key->arr_len == 33);
5725         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5726         void* tweak_ptr = untag_ptr(tweak);
5727         CHECK_ACCESS(tweak_ptr);
5728         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5729         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
5730         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5731         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5732         return tag_ptr(ret_conv, true);
5733 }
5734
5735 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) {
5736         void* this_arg_ptr = untag_ptr(this_arg);
5737         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5738         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5739         LDKu8slice hrp_bytes_ref;
5740         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5741         hrp_bytes_ref.data = hrp_bytes->elems;
5742         LDKCVec_U5Z invoice_data_constr;
5743         invoice_data_constr.datalen = invoice_data->arr_len;
5744         if (invoice_data_constr.datalen > 0)
5745                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5746         else
5747                 invoice_data_constr.data = NULL;
5748         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5749         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5750                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5751                 
5752                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5753         }
5754         FREE(invoice_data);
5755         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5756         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5757         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
5758         FREE(hrp_bytes);
5759         return tag_ptr(ret_conv, true);
5760 }
5761
5762 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
5763         void* this_arg_ptr = untag_ptr(this_arg);
5764         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5765         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5766         void* msg_ptr = untag_ptr(msg);
5767         CHECK_ACCESS(msg_ptr);
5768         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
5769         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
5770         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5771         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
5772         return tag_ptr(ret_conv, true);
5773 }
5774
5775 typedef struct LDKSignerProvider_JCalls {
5776         atomic_size_t refcnt;
5777         uint32_t instance_ptr;
5778 } LDKSignerProvider_JCalls;
5779 static void LDKSignerProvider_JCalls_free(void* this_arg) {
5780         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5781         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5782                 FREE(j_calls);
5783         }
5784 }
5785 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5786         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5787         jboolean inbound_conv = inbound;
5788         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5789         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5790         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5791         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);
5792         LDKThirtyTwoBytes ret_ref;
5793         CHECK(ret->arr_len == 32);
5794         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5795         return ret_ref;
5796 }
5797 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5798         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5799         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5800         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5801         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5802         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);
5803         void* ret_ptr = untag_ptr(ret);
5804         CHECK_ACCESS(ret_ptr);
5805         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
5806         FREE(untag_ptr(ret));
5807         return ret_conv;
5808 }
5809 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
5810         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5811         LDKu8slice reader_var = reader;
5812         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5813         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5814         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5815         void* ret_ptr = untag_ptr(ret);
5816         CHECK_ACCESS(ret_ptr);
5817         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
5818         FREE(untag_ptr(ret));
5819         return ret_conv;
5820 }
5821 LDKCVec_u8Z get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
5822         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5823         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
5824         LDKCVec_u8Z ret_ref;
5825         ret_ref.datalen = ret->arr_len;
5826         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5827         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5828         return ret_ref;
5829 }
5830 LDKShutdownScript get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
5831         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5832         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
5833         LDKShutdownScript ret_conv;
5834         ret_conv.inner = untag_ptr(ret);
5835         ret_conv.is_owned = ptr_is_owned(ret);
5836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5837         return ret_conv;
5838 }
5839 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
5840         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
5841         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5842 }
5843 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
5844         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
5845         atomic_init(&calls->refcnt, 1);
5846         calls->instance_ptr = o;
5847
5848         LDKSignerProvider ret = {
5849                 .this_arg = (void*) calls,
5850                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
5851                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
5852                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
5853                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
5854                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
5855                 .free = LDKSignerProvider_JCalls_free,
5856         };
5857         return ret;
5858 }
5859 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
5860         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
5861         *res_ptr = LDKSignerProvider_init(o);
5862         return tag_ptr(res_ptr, true);
5863 }
5864 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) {
5865         void* this_arg_ptr = untag_ptr(this_arg);
5866         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5867         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5868         LDKU128 user_channel_id_ref;
5869         CHECK(user_channel_id->arr_len == 16);
5870         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
5871         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5872         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);
5873         return ret_arr;
5874 }
5875
5876 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) {
5877         void* this_arg_ptr = untag_ptr(this_arg);
5878         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5879         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5880         LDKThirtyTwoBytes channel_keys_id_ref;
5881         CHECK(channel_keys_id->arr_len == 32);
5882         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
5883         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
5884         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
5885         return tag_ptr(ret_ret, true);
5886 }
5887
5888 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5889         void* this_arg_ptr = untag_ptr(this_arg);
5890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5891         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5892         LDKu8slice reader_ref;
5893         reader_ref.datalen = reader->arr_len;
5894         reader_ref.data = reader->elems;
5895         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
5896         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5897         FREE(reader);
5898         return tag_ptr(ret_conv, true);
5899 }
5900
5901 int8_tArray  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
5902         void* this_arg_ptr = untag_ptr(this_arg);
5903         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5904         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5905         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5906         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5907         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5908         CVec_u8Z_free(ret_var);
5909         return ret_arr;
5910 }
5911
5912 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
5913         void* this_arg_ptr = untag_ptr(this_arg);
5914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5915         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5916         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5917         uint64_t ret_ref = 0;
5918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5920         return ret_ref;
5921 }
5922
5923 typedef struct LDKFeeEstimator_JCalls {
5924         atomic_size_t refcnt;
5925         uint32_t instance_ptr;
5926 } LDKFeeEstimator_JCalls;
5927 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5928         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5929         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5930                 FREE(j_calls);
5931         }
5932 }
5933 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5934         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5935         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5936         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, confirmation_target_conv, 0, 0, 0, 0, 0);
5937 }
5938 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5939         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5940         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5941 }
5942 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5943         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5944         atomic_init(&calls->refcnt, 1);
5945         calls->instance_ptr = o;
5946
5947         LDKFeeEstimator ret = {
5948                 .this_arg = (void*) calls,
5949                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5950                 .free = LDKFeeEstimator_JCalls_free,
5951         };
5952         return ret;
5953 }
5954 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5955         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5956         *res_ptr = LDKFeeEstimator_init(o);
5957         return tag_ptr(res_ptr, true);
5958 }
5959 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) {
5960         void* this_arg_ptr = untag_ptr(this_arg);
5961         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5962         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5963         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5964         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5965         return ret_conv;
5966 }
5967
5968 typedef struct LDKRouter_JCalls {
5969         atomic_size_t refcnt;
5970         uint32_t instance_ptr;
5971 } LDKRouter_JCalls;
5972 static void LDKRouter_JCalls_free(void* this_arg) {
5973         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5974         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5975                 FREE(j_calls);
5976         }
5977 }
5978 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs) {
5979         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5980         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
5981         memcpy(payer_arr->elems, payer.compressed_form, 33);
5982         LDKRouteParameters route_params_var = *route_params;
5983         uint64_t route_params_ref = 0;
5984         route_params_var = RouteParameters_clone(&route_params_var);
5985         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
5986         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
5987         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
5988         uint64_tArray first_hops_arr = NULL;
5989         if (first_hops != NULL) {
5990                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
5991                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
5992                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
5993                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
5994                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
5995                         uint64_t first_hops_conv_16_ref = 0;
5996                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
5997                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
5998                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
5999                 }
6000         
6001         }
6002         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
6003         uint64_t inflight_htlcs_ref = 0;
6004         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
6005         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6006         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6007         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);
6008         void* ret_ptr = untag_ptr(ret);
6009         CHECK_ACCESS(ret_ptr);
6010         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6011         FREE(untag_ptr(ret));
6012         return ret_conv;
6013 }
6014 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) {
6015         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6016         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6017         memcpy(payer_arr->elems, payer.compressed_form, 33);
6018         LDKRouteParameters route_params_var = *route_params;
6019         uint64_t route_params_ref = 0;
6020         route_params_var = RouteParameters_clone(&route_params_var);
6021         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6022         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6023         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6024         uint64_tArray first_hops_arr = NULL;
6025         if (first_hops != NULL) {
6026                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6027                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6028                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6029                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6030                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6031                         uint64_t first_hops_conv_16_ref = 0;
6032                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6033                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6034                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6035                 }
6036         
6037         }
6038         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
6039         uint64_t inflight_htlcs_ref = 0;
6040         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
6041         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6042         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6043         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
6044         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
6045         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
6046         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
6047         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);
6048         void* ret_ptr = untag_ptr(ret);
6049         CHECK_ACCESS(ret_ptr);
6050         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6051         FREE(untag_ptr(ret));
6052         return ret_conv;
6053 }
6054 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
6055         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
6056         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6057 }
6058 static inline LDKRouter LDKRouter_init (JSValue o) {
6059         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
6060         atomic_init(&calls->refcnt, 1);
6061         calls->instance_ptr = o;
6062
6063         LDKRouter ret = {
6064                 .this_arg = (void*) calls,
6065                 .find_route = find_route_LDKRouter_jcall,
6066                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
6067                 .free = LDKRouter_JCalls_free,
6068         };
6069         return ret;
6070 }
6071 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
6072         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
6073         *res_ptr = LDKRouter_init(o);
6074         return tag_ptr(res_ptr, true);
6075 }
6076 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) {
6077         void* this_arg_ptr = untag_ptr(this_arg);
6078         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6079         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6080         LDKPublicKey payer_ref;
6081         CHECK(payer->arr_len == 33);
6082         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6083         LDKRouteParameters route_params_conv;
6084         route_params_conv.inner = untag_ptr(route_params);
6085         route_params_conv.is_owned = ptr_is_owned(route_params);
6086         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6087         route_params_conv.is_owned = false;
6088         LDKCVec_ChannelDetailsZ first_hops_constr;
6089         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6090         if (first_hops != 0) {
6091                 first_hops_constr.datalen = first_hops->arr_len;
6092                 if (first_hops_constr.datalen > 0)
6093                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6094                 else
6095                         first_hops_constr.data = NULL;
6096                 uint64_t* first_hops_vals = first_hops->elems;
6097                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6098                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6099                         LDKChannelDetails first_hops_conv_16_conv;
6100                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6101                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6102                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6103                         first_hops_conv_16_conv.is_owned = false;
6104                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6105                 }
6106                 FREE(first_hops);
6107                 first_hops_ptr = &first_hops_constr;
6108         }
6109         LDKInFlightHtlcs inflight_htlcs_conv;
6110         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6111         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6112         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6113         inflight_htlcs_conv.is_owned = false;
6114         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6115         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv);
6116         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6117         return tag_ptr(ret_conv, true);
6118 }
6119
6120 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) {
6121         void* this_arg_ptr = untag_ptr(this_arg);
6122         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6123         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6124         LDKPublicKey payer_ref;
6125         CHECK(payer->arr_len == 33);
6126         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6127         LDKRouteParameters route_params_conv;
6128         route_params_conv.inner = untag_ptr(route_params);
6129         route_params_conv.is_owned = ptr_is_owned(route_params);
6130         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6131         route_params_conv.is_owned = false;
6132         LDKCVec_ChannelDetailsZ first_hops_constr;
6133         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6134         if (first_hops != 0) {
6135                 first_hops_constr.datalen = first_hops->arr_len;
6136                 if (first_hops_constr.datalen > 0)
6137                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6138                 else
6139                         first_hops_constr.data = NULL;
6140                 uint64_t* first_hops_vals = first_hops->elems;
6141                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6142                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6143                         LDKChannelDetails first_hops_conv_16_conv;
6144                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6145                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6146                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6147                         first_hops_conv_16_conv.is_owned = false;
6148                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6149                 }
6150                 FREE(first_hops);
6151                 first_hops_ptr = &first_hops_constr;
6152         }
6153         LDKInFlightHtlcs inflight_htlcs_conv;
6154         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6155         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6156         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6157         inflight_htlcs_conv.is_owned = false;
6158         LDKThirtyTwoBytes _payment_hash_ref;
6159         CHECK(_payment_hash->arr_len == 32);
6160         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6161         LDKThirtyTwoBytes _payment_id_ref;
6162         CHECK(_payment_id->arr_len == 32);
6163         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6164         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6165         *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);
6166         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6167         return tag_ptr(ret_conv, true);
6168 }
6169
6170 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6171         return ThirtyTwoBytes_clone(&owner->a);
6172 }
6173 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
6174         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6175         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6176         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
6177         return ret_arr;
6178 }
6179
6180 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6181         LDKChannelManager ret = owner->b;
6182         ret.is_owned = false;
6183         return ret;
6184 }
6185 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
6186         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6187         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6188         uint64_t ret_ref = 0;
6189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6191         return ret_ref;
6192 }
6193
6194 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6195 CHECK(owner->result_ok);
6196         return &*owner->contents.result;
6197 }
6198 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6199         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6200         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6201         return ret_ret;
6202 }
6203
6204 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6205 CHECK(!owner->result_ok);
6206         return DecodeError_clone(&*owner->contents.err);
6207 }
6208 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6209         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6210         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6211         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6212         uint64_t ret_ref = tag_ptr(ret_copy, true);
6213         return ret_ref;
6214 }
6215
6216 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6217         LDKChannelConfig ret = *owner->contents.result;
6218         ret.is_owned = false;
6219         return ret;
6220 }
6221 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6222         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6223         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6224         uint64_t ret_ref = 0;
6225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6227         return ret_ref;
6228 }
6229
6230 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6231 CHECK(!owner->result_ok);
6232         return DecodeError_clone(&*owner->contents.err);
6233 }
6234 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6235         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6236         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6237         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6238         uint64_t ret_ref = tag_ptr(ret_copy, true);
6239         return ret_ref;
6240 }
6241
6242 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6243         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6244         switch(obj->tag) {
6245                 case LDKCOption_APIErrorZ_Some: return 0;
6246                 case LDKCOption_APIErrorZ_None: return 1;
6247                 default: abort();
6248         }
6249 }
6250 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6251         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6252         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6253                         uint64_t some_ref = tag_ptr(&obj->some, false);
6254         return some_ref;
6255 }
6256 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6257 CHECK(owner->result_ok);
6258         return COption_APIErrorZ_clone(&*owner->contents.result);
6259 }
6260 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6261         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6262         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6263         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6264         uint64_t ret_ref = tag_ptr(ret_copy, true);
6265         return ret_ref;
6266 }
6267
6268 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6269 CHECK(!owner->result_ok);
6270         return DecodeError_clone(&*owner->contents.err);
6271 }
6272 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6273         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6274         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6275         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
6276         uint64_t ret_ref = tag_ptr(ret_copy, true);
6277         return ret_ref;
6278 }
6279
6280 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6281         LDKOutPoint ret = *owner->contents.result;
6282         ret.is_owned = false;
6283         return ret;
6284 }
6285 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
6286         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6287         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6288         uint64_t ret_ref = 0;
6289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6291         return ret_ref;
6292 }
6293
6294 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6295 CHECK(!owner->result_ok);
6296         return DecodeError_clone(&*owner->contents.err);
6297 }
6298 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
6299         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6300         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6301         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6302         uint64_t ret_ref = tag_ptr(ret_copy, true);
6303         return ret_ref;
6304 }
6305
6306 typedef struct LDKType_JCalls {
6307         atomic_size_t refcnt;
6308         uint32_t instance_ptr;
6309 } LDKType_JCalls;
6310 static void LDKType_JCalls_free(void* this_arg) {
6311         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6312         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6313                 FREE(j_calls);
6314         }
6315 }
6316 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6317         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6318         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
6319 }
6320 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6321         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6322         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
6323         LDKStr ret_conv = str_ref_to_owned_c(ret);
6324         return ret_conv;
6325 }
6326 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6327         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6328         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, 0, 0, 0, 0, 0, 0);
6329         LDKCVec_u8Z ret_ref;
6330         ret_ref.datalen = ret->arr_len;
6331         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6332         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6333         return ret_ref;
6334 }
6335 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6336         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6337         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6338 }
6339 static inline LDKType LDKType_init (JSValue o) {
6340         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6341         atomic_init(&calls->refcnt, 1);
6342         calls->instance_ptr = o;
6343
6344         LDKType ret = {
6345                 .this_arg = (void*) calls,
6346                 .type_id = type_id_LDKType_jcall,
6347                 .debug_str = debug_str_LDKType_jcall,
6348                 .write = write_LDKType_jcall,
6349                 .cloned = LDKType_JCalls_cloned,
6350                 .free = LDKType_JCalls_free,
6351         };
6352         return ret;
6353 }
6354 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
6355         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6356         *res_ptr = LDKType_init(o);
6357         return tag_ptr(res_ptr, true);
6358 }
6359 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
6360         void* this_arg_ptr = untag_ptr(this_arg);
6361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6362         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6363         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6364         return ret_conv;
6365 }
6366
6367 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
6368         void* this_arg_ptr = untag_ptr(this_arg);
6369         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6370         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6371         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6372         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6373         Str_free(ret_str);
6374         return ret_conv;
6375 }
6376
6377 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
6378         void* this_arg_ptr = untag_ptr(this_arg);
6379         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6380         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6381         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6382         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6383         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6384         CVec_u8Z_free(ret_var);
6385         return ret_arr;
6386 }
6387
6388 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
6389         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6390         switch(obj->tag) {
6391                 case LDKCOption_TypeZ_Some: return 0;
6392                 case LDKCOption_TypeZ_None: return 1;
6393                 default: abort();
6394         }
6395 }
6396 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
6397         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6398         assert(obj->tag == LDKCOption_TypeZ_Some);
6399                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6400                         *some_ret = Type_clone(&obj->some);
6401         return tag_ptr(some_ret, true);
6402 }
6403 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6404 CHECK(owner->result_ok);
6405         return COption_TypeZ_clone(&*owner->contents.result);
6406 }
6407 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
6408         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6409         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6410         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6411         uint64_t ret_ref = tag_ptr(ret_copy, true);
6412         return ret_ref;
6413 }
6414
6415 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6416 CHECK(!owner->result_ok);
6417         return DecodeError_clone(&*owner->contents.err);
6418 }
6419 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
6420         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6421         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6422         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6423         uint64_t ret_ref = tag_ptr(ret_copy, true);
6424         return ret_ref;
6425 }
6426
6427 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
6428         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6429         switch(obj->tag) {
6430                 case LDKPaymentError_Invoice: return 0;
6431                 case LDKPaymentError_Sending: return 1;
6432                 default: abort();
6433         }
6434 }
6435 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
6436         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6437         assert(obj->tag == LDKPaymentError_Invoice);
6438                         LDKStr invoice_str = obj->invoice;
6439                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
6440         return invoice_conv;
6441 }
6442 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
6443         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6444         assert(obj->tag == LDKPaymentError_Sending);
6445                         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
6446         return sending_conv;
6447 }
6448 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6449 CHECK(owner->result_ok);
6450         return ThirtyTwoBytes_clone(&*owner->contents.result);
6451 }
6452 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
6453         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
6454         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6455         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
6456         return ret_arr;
6457 }
6458
6459 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6460 CHECK(!owner->result_ok);
6461         return PaymentError_clone(&*owner->contents.err);
6462 }
6463 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
6464         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
6465         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6466         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6467         uint64_t ret_ref = tag_ptr(ret_copy, true);
6468         return ret_ref;
6469 }
6470
6471 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
6472 CHECK(owner->result_ok);
6473         return *owner->contents.result;
6474 }
6475 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
6476         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
6477         CResult_NonePaymentErrorZ_get_ok(owner_conv);
6478 }
6479
6480 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
6481 CHECK(!owner->result_ok);
6482         return PaymentError_clone(&*owner->contents.err);
6483 }
6484 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
6485         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
6486         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6487         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
6488         uint64_t ret_ref = tag_ptr(ret_copy, true);
6489         return ret_ref;
6490 }
6491
6492 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6493 CHECK(owner->result_ok);
6494         return *owner->contents.result;
6495 }
6496 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
6497         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6498         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6499         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6500         return ret_conv;
6501 }
6502
6503 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6504 CHECK(!owner->result_ok);
6505         return *owner->contents.err;
6506 }
6507 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
6508         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6509         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6510         return ret_conv;
6511 }
6512
6513 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
6514 CHECK(owner->result_ok);
6515         return *owner->contents.result;
6516 }
6517 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
6518         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
6519         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6520         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
6521         return ret_arr;
6522 }
6523
6524 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
6525 CHECK(!owner->result_ok);
6526         return *owner->contents.err;
6527 }
6528 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
6529         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
6530         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
6531         return ret_conv;
6532 }
6533
6534 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6535         LDKChannelMonitorUpdate ret = *owner->contents.result;
6536         ret.is_owned = false;
6537         return ret;
6538 }
6539 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6540         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6541         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6542         uint64_t ret_ref = 0;
6543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6545         return ret_ref;
6546 }
6547
6548 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6549 CHECK(!owner->result_ok);
6550         return DecodeError_clone(&*owner->contents.err);
6551 }
6552 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6553         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6554         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6555         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6556         uint64_t ret_ref = tag_ptr(ret_copy, true);
6557         return ret_ref;
6558 }
6559
6560 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6561         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6562         switch(obj->tag) {
6563                 case LDKCOption_MonitorEventZ_Some: return 0;
6564                 case LDKCOption_MonitorEventZ_None: return 1;
6565                 default: abort();
6566         }
6567 }
6568 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6569         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6570         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6571                         uint64_t some_ref = tag_ptr(&obj->some, false);
6572         return some_ref;
6573 }
6574 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6575 CHECK(owner->result_ok);
6576         return COption_MonitorEventZ_clone(&*owner->contents.result);
6577 }
6578 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6579         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6580         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6581         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6582         uint64_t ret_ref = tag_ptr(ret_copy, true);
6583         return ret_ref;
6584 }
6585
6586 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6587 CHECK(!owner->result_ok);
6588         return DecodeError_clone(&*owner->contents.err);
6589 }
6590 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6591         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6593         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6594         uint64_t ret_ref = tag_ptr(ret_copy, true);
6595         return ret_ref;
6596 }
6597
6598 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6599         LDKHTLCUpdate ret = *owner->contents.result;
6600         ret.is_owned = false;
6601         return ret;
6602 }
6603 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6604         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6605         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6606         uint64_t ret_ref = 0;
6607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6609         return ret_ref;
6610 }
6611
6612 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6613 CHECK(!owner->result_ok);
6614         return DecodeError_clone(&*owner->contents.err);
6615 }
6616 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6617         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6619         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6620         uint64_t ret_ref = tag_ptr(ret_copy, true);
6621         return ret_ref;
6622 }
6623
6624 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6625         LDKOutPoint ret = owner->a;
6626         ret.is_owned = false;
6627         return ret;
6628 }
6629 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6630         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6631         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6632         uint64_t ret_ref = 0;
6633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6635         return ret_ref;
6636 }
6637
6638 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6639         return CVec_u8Z_clone(&owner->b);
6640 }
6641 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6642         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6643         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6644         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6645         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6646         CVec_u8Z_free(ret_var);
6647         return ret_arr;
6648 }
6649
6650 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6651         return owner->a;
6652 }
6653 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6654         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6655         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6656         return ret_conv;
6657 }
6658
6659 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6660         return CVec_u8Z_clone(&owner->b);
6661 }
6662 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6663         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6664         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6665         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6666         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6667         CVec_u8Z_free(ret_var);
6668         return ret_arr;
6669 }
6670
6671 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6672         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6673         for (size_t i = 0; i < ret.datalen; i++) {
6674                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6675         }
6676         return ret;
6677 }
6678 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6679         return ThirtyTwoBytes_clone(&owner->a);
6680 }
6681 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6682         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6683         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6684         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6685         return ret_arr;
6686 }
6687
6688 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6689         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6690 }
6691 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6692         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6693         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6694         uint64_tArray ret_arr = NULL;
6695         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6696         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6697         for (size_t v = 0; v < ret_var.datalen; v++) {
6698                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6699                 *ret_conv_21_conv = ret_var.data[v];
6700                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6701         }
6702         
6703         FREE(ret_var.data);
6704         return ret_arr;
6705 }
6706
6707 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6708         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 };
6709         for (size_t i = 0; i < ret.datalen; i++) {
6710                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6711         }
6712         return ret;
6713 }
6714 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6715         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6716         for (size_t i = 0; i < ret.datalen; i++) {
6717                 ret.data[i] = Event_clone(&orig->data[i]);
6718         }
6719         return ret;
6720 }
6721 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6722         return owner->a;
6723 }
6724 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6725         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6726         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6727         return ret_conv;
6728 }
6729
6730 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6731         return TxOut_clone(&owner->b);
6732 }
6733 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6734         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6735         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6736         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6737         return tag_ptr(ret_ref, true);
6738 }
6739
6740 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6741         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6742         for (size_t i = 0; i < ret.datalen; i++) {
6743                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6744         }
6745         return ret;
6746 }
6747 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6748         return ThirtyTwoBytes_clone(&owner->a);
6749 }
6750 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6751         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6752         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6753         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6754         return ret_arr;
6755 }
6756
6757 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6758         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6759 }
6760 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6761         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6762         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6763         uint64_tArray ret_arr = NULL;
6764         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6765         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6766         for (size_t u = 0; u < ret_var.datalen; u++) {
6767                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6768                 *ret_conv_20_conv = ret_var.data[u];
6769                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6770         }
6771         
6772         FREE(ret_var.data);
6773         return ret_arr;
6774 }
6775
6776 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6777         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 };
6778         for (size_t i = 0; i < ret.datalen; i++) {
6779                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6780         }
6781         return ret;
6782 }
6783 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6784         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6785         switch(obj->tag) {
6786                 case LDKBalance_ClaimableOnChannelClose: return 0;
6787                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6788                 case LDKBalance_ContentiousClaimable: return 2;
6789                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6790                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6791                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6792                 default: abort();
6793         }
6794 }
6795 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6796         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6797         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6798                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6799         return claimable_amount_satoshis_conv;
6800 }
6801 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6802         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6803         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6804                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6805         return claimable_amount_satoshis_conv;
6806 }
6807 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6808         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6809         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6810                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6811         return confirmation_height_conv;
6812 }
6813 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6814         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6815         assert(obj->tag == LDKBalance_ContentiousClaimable);
6816                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6817         return claimable_amount_satoshis_conv;
6818 }
6819 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6820         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6821         assert(obj->tag == LDKBalance_ContentiousClaimable);
6822                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6823         return timeout_height_conv;
6824 }
6825 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6826         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6827         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6828                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
6829         return claimable_amount_satoshis_conv;
6830 }
6831 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6832         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6833         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6834                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6835         return claimable_height_conv;
6836 }
6837 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6838         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6839         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6840                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
6841         return claimable_amount_satoshis_conv;
6842 }
6843 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6844         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6845         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6846                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6847         return expiry_height_conv;
6848 }
6849 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6850         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6851         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6852                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
6853         return claimable_amount_satoshis_conv;
6854 }
6855 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6856         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6857         for (size_t i = 0; i < ret.datalen; i++) {
6858                 ret.data[i] = Balance_clone(&orig->data[i]);
6859         }
6860         return ret;
6861 }
6862 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6863         return ThirtyTwoBytes_clone(&owner->a);
6864 }
6865 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6866         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6867         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6868         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6869         return ret_arr;
6870 }
6871
6872 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6873         LDKChannelMonitor ret = owner->b;
6874         ret.is_owned = false;
6875         return ret;
6876 }
6877 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6878         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6879         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6880         uint64_t ret_ref = 0;
6881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6883         return ret_ref;
6884 }
6885
6886 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6887 CHECK(owner->result_ok);
6888         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6889 }
6890 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6891         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6892         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6893         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6894         return tag_ptr(ret_conv, true);
6895 }
6896
6897 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6898 CHECK(!owner->result_ok);
6899         return DecodeError_clone(&*owner->contents.err);
6900 }
6901 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6902         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6903         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6904         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6905         uint64_t ret_ref = tag_ptr(ret_copy, true);
6906         return ret_ref;
6907 }
6908
6909 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6910         return owner->a;
6911 }
6912 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6913         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6914         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6915         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6916         return ret_arr;
6917 }
6918
6919 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6920         return Type_clone(&owner->b);
6921 }
6922 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6923         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6924         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6925         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6926         return tag_ptr(ret_ret, true);
6927 }
6928
6929 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6930         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6931         for (size_t i = 0; i < ret.datalen; i++) {
6932                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6933         }
6934         return ret;
6935 }
6936 typedef struct LDKCustomOnionMessageContents_JCalls {
6937         atomic_size_t refcnt;
6938         uint32_t instance_ptr;
6939 } LDKCustomOnionMessageContents_JCalls;
6940 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
6941         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6942         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6943                 FREE(j_calls);
6944         }
6945 }
6946 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6947         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6948         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
6949 }
6950 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6951         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6952         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
6953         LDKCVec_u8Z ret_ref;
6954         ret_ref.datalen = ret->arr_len;
6955         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6956         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6957         return ret_ref;
6958 }
6959 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
6960         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
6961         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6962 }
6963 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
6964         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
6965         atomic_init(&calls->refcnt, 1);
6966         calls->instance_ptr = o;
6967
6968         LDKCustomOnionMessageContents ret = {
6969                 .this_arg = (void*) calls,
6970                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
6971                 .write = write_LDKCustomOnionMessageContents_jcall,
6972                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
6973                 .free = LDKCustomOnionMessageContents_JCalls_free,
6974         };
6975         return ret;
6976 }
6977 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
6978         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6979         *res_ptr = LDKCustomOnionMessageContents_init(o);
6980         return tag_ptr(res_ptr, true);
6981 }
6982 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
6983         void* this_arg_ptr = untag_ptr(this_arg);
6984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6985         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6986         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6987         return ret_conv;
6988 }
6989
6990 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
6991         void* this_arg_ptr = untag_ptr(this_arg);
6992         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6993         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6994         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6995         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6996         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6997         CVec_u8Z_free(ret_var);
6998         return ret_arr;
6999 }
7000
7001 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
7002         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
7003         switch(obj->tag) {
7004                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
7005                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
7006                 default: abort();
7007         }
7008 }
7009 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
7010         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
7011         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
7012                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
7013                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
7014         return tag_ptr(some_ret, true);
7015 }
7016 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7017 CHECK(owner->result_ok);
7018         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
7019 }
7020 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
7021         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7022         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
7023         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
7024         uint64_t ret_ref = tag_ptr(ret_copy, true);
7025         return ret_ref;
7026 }
7027
7028 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7029 CHECK(!owner->result_ok);
7030         return DecodeError_clone(&*owner->contents.err);
7031 }
7032 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
7033         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7034         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7035         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
7036         uint64_t ret_ref = tag_ptr(ret_copy, true);
7037         return ret_ref;
7038 }
7039
7040 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
7041         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
7042         switch(obj->tag) {
7043                 case LDKCOption_NetAddressZ_Some: return 0;
7044                 case LDKCOption_NetAddressZ_None: return 1;
7045                 default: abort();
7046         }
7047 }
7048 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
7049         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
7050         assert(obj->tag == LDKCOption_NetAddressZ_Some);
7051                         uint64_t some_ref = tag_ptr(&obj->some, false);
7052         return some_ref;
7053 }
7054 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
7055         return owner->a;
7056 }
7057 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(uint64_t owner) {
7058         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
7059         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7060         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form, 33);
7061         return ret_arr;
7062 }
7063
7064 static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
7065         return COption_NetAddressZ_clone(&owner->b);
7066 }
7067 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(uint64_t owner) {
7068         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
7069         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
7070         *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv);
7071         uint64_t ret_ref = tag_ptr(ret_copy, true);
7072         return ret_ref;
7073 }
7074
7075 static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) {
7076         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen };
7077         for (size_t i = 0; i < ret.datalen; i++) {
7078                 ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]);
7079         }
7080         return ret;
7081 }
7082 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7083 CHECK(owner->result_ok);
7084         return CVec_u8Z_clone(&*owner->contents.result);
7085 }
7086 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
7087         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7088         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7089         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7090         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7091         CVec_u8Z_free(ret_var);
7092         return ret_arr;
7093 }
7094
7095 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7096         LDKPeerHandleError ret = *owner->contents.err;
7097         ret.is_owned = false;
7098         return ret;
7099 }
7100 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7101         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7102         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7103         uint64_t ret_ref = 0;
7104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7106         return ret_ref;
7107 }
7108
7109 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7110 CHECK(owner->result_ok);
7111         return *owner->contents.result;
7112 }
7113 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7114         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7115         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7116 }
7117
7118 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7119         LDKPeerHandleError ret = *owner->contents.err;
7120         ret.is_owned = false;
7121         return ret;
7122 }
7123 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7124         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7125         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7126         uint64_t ret_ref = 0;
7127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7129         return ret_ref;
7130 }
7131
7132 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7133 CHECK(owner->result_ok);
7134         return *owner->contents.result;
7135 }
7136 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7137         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7138         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7139         return ret_conv;
7140 }
7141
7142 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7143         LDKPeerHandleError ret = *owner->contents.err;
7144         ret.is_owned = false;
7145         return ret;
7146 }
7147 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7148         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7149         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7150         uint64_t ret_ref = 0;
7151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7153         return ret_ref;
7154 }
7155
7156 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
7157         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
7158         switch(obj->tag) {
7159                 case LDKSendError_Secp256k1: return 0;
7160                 case LDKSendError_TooBigPacket: return 1;
7161                 case LDKSendError_TooFewBlindedHops: return 2;
7162                 case LDKSendError_InvalidFirstHop: return 3;
7163                 case LDKSendError_InvalidMessage: return 4;
7164                 case LDKSendError_BufferFull: return 5;
7165                 case LDKSendError_GetNodeIdFailed: return 6;
7166                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
7167                 default: abort();
7168         }
7169 }
7170 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
7171         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
7172         assert(obj->tag == LDKSendError_Secp256k1);
7173                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
7174         return secp256k1_conv;
7175 }
7176 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
7177 CHECK(owner->result_ok);
7178         return *owner->contents.result;
7179 }
7180 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
7181         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
7182         CResult_NoneSendErrorZ_get_ok(owner_conv);
7183 }
7184
7185 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
7186 CHECK(!owner->result_ok);
7187         return SendError_clone(&*owner->contents.err);
7188 }
7189 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
7190         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
7191         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
7192         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
7193         uint64_t ret_ref = tag_ptr(ret_copy, true);
7194         return ret_ref;
7195 }
7196
7197 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7198         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7199         switch(obj->tag) {
7200                 case LDKGraphSyncError_DecodeError: return 0;
7201                 case LDKGraphSyncError_LightningError: return 1;
7202                 default: abort();
7203         }
7204 }
7205 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7206         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7207         assert(obj->tag == LDKGraphSyncError_DecodeError);
7208                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7209         return decode_error_ref;
7210 }
7211 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7212         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7213         assert(obj->tag == LDKGraphSyncError_LightningError);
7214                         LDKLightningError lightning_error_var = obj->lightning_error;
7215                         uint64_t lightning_error_ref = 0;
7216                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7217                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7218         return lightning_error_ref;
7219 }
7220 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7221 CHECK(owner->result_ok);
7222         return *owner->contents.result;
7223 }
7224 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7225         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7226         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7227         return ret_conv;
7228 }
7229
7230 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7231 CHECK(!owner->result_ok);
7232         return GraphSyncError_clone(&*owner->contents.err);
7233 }
7234 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7235         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7236         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7237         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7238         uint64_t ret_ref = tag_ptr(ret_copy, true);
7239         return ret_ref;
7240 }
7241
7242 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
7243         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7244         switch(obj->tag) {
7245                 case LDKParseError_Bech32Error: return 0;
7246                 case LDKParseError_ParseAmountError: return 1;
7247                 case LDKParseError_MalformedSignature: return 2;
7248                 case LDKParseError_BadPrefix: return 3;
7249                 case LDKParseError_UnknownCurrency: return 4;
7250                 case LDKParseError_UnknownSiPrefix: return 5;
7251                 case LDKParseError_MalformedHRP: return 6;
7252                 case LDKParseError_TooShortDataPart: return 7;
7253                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
7254                 case LDKParseError_DescriptionDecodeError: return 9;
7255                 case LDKParseError_PaddingError: return 10;
7256                 case LDKParseError_IntegerOverflowError: return 11;
7257                 case LDKParseError_InvalidSegWitProgramLength: return 12;
7258                 case LDKParseError_InvalidPubKeyHashLength: return 13;
7259                 case LDKParseError_InvalidScriptHashLength: return 14;
7260                 case LDKParseError_InvalidRecoveryId: return 15;
7261                 case LDKParseError_InvalidSliceLength: return 16;
7262                 case LDKParseError_Skip: return 17;
7263                 default: abort();
7264         }
7265 }
7266 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
7267         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7268         assert(obj->tag == LDKParseError_Bech32Error);
7269                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
7270         return bech32_error_ref;
7271 }
7272 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
7273         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7274         assert(obj->tag == LDKParseError_ParseAmountError);
7275                         /*obj->parse_amount_error*/
7276         return 0;
7277 }
7278 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
7279         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7280         assert(obj->tag == LDKParseError_MalformedSignature);
7281                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
7282         return malformed_signature_conv;
7283 }
7284 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
7285         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7286         assert(obj->tag == LDKParseError_DescriptionDecodeError);
7287                         /*obj->description_decode_error*/
7288         return 0;
7289 }
7290 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
7291         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7292         assert(obj->tag == LDKParseError_InvalidSliceLength);
7293                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
7294                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
7295         return invalid_slice_length_conv;
7296 }
7297 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7298 CHECK(owner->result_ok);
7299         return SiPrefix_clone(&*owner->contents.result);
7300 }
7301 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
7302         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7303         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
7304         return ret_conv;
7305 }
7306
7307 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7308 CHECK(!owner->result_ok);
7309         return ParseError_clone(&*owner->contents.err);
7310 }
7311 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
7312         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7313         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7314         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
7315         uint64_t ret_ref = tag_ptr(ret_copy, true);
7316         return ret_ref;
7317 }
7318
7319 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
7320         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
7321         switch(obj->tag) {
7322                 case LDKParseOrSemanticError_ParseError: return 0;
7323                 case LDKParseOrSemanticError_SemanticError: return 1;
7324                 default: abort();
7325         }
7326 }
7327 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
7328         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
7329         assert(obj->tag == LDKParseOrSemanticError_ParseError);
7330                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
7331         return parse_error_ref;
7332 }
7333 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
7334         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
7335         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
7336                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
7337         return semantic_error_conv;
7338 }
7339 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7340         LDKInvoice ret = *owner->contents.result;
7341         ret.is_owned = false;
7342         return ret;
7343 }
7344 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
7345         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7346         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7347         uint64_t ret_ref = 0;
7348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7350         return ret_ref;
7351 }
7352
7353 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7354 CHECK(!owner->result_ok);
7355         return ParseOrSemanticError_clone(&*owner->contents.err);
7356 }
7357 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
7358         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7359         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7360         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7361         uint64_t ret_ref = tag_ptr(ret_copy, true);
7362         return ret_ref;
7363 }
7364
7365 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7366         LDKSignedRawInvoice ret = *owner->contents.result;
7367         ret.is_owned = false;
7368         return ret;
7369 }
7370 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
7371         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7372         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7373         uint64_t ret_ref = 0;
7374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7376         return ret_ref;
7377 }
7378
7379 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7380 CHECK(!owner->result_ok);
7381         return ParseError_clone(&*owner->contents.err);
7382 }
7383 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
7384         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7385         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7386         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7387         uint64_t ret_ref = tag_ptr(ret_copy, true);
7388         return ret_ref;
7389 }
7390
7391 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7392         LDKRawInvoice ret = owner->a;
7393         ret.is_owned = false;
7394         return ret;
7395 }
7396 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
7397         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7398         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
7399         uint64_t ret_ref = 0;
7400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7402         return ret_ref;
7403 }
7404
7405 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7406         return ThirtyTwoBytes_clone(&owner->b);
7407 }
7408 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
7409         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7410         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7411         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
7412         return ret_arr;
7413 }
7414
7415 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7416         LDKInvoiceSignature ret = owner->c;
7417         ret.is_owned = false;
7418         return ret;
7419 }
7420 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
7421         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7422         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
7423         uint64_t ret_ref = 0;
7424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7426         return ret_ref;
7427 }
7428
7429 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7430         LDKPayeePubKey ret = *owner->contents.result;
7431         ret.is_owned = false;
7432         return ret;
7433 }
7434 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
7435         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7436         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
7437         uint64_t ret_ref = 0;
7438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7440         return ret_ref;
7441 }
7442
7443 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7444 CHECK(!owner->result_ok);
7445         return *owner->contents.err;
7446 }
7447 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
7448         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7449         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
7450         return ret_conv;
7451 }
7452
7453 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
7454         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
7455         for (size_t i = 0; i < ret.datalen; i++) {
7456                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
7457         }
7458         return ret;
7459 }
7460 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7461         LDKPositiveTimestamp ret = *owner->contents.result;
7462         ret.is_owned = false;
7463         return ret;
7464 }
7465 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
7466         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7467         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
7468         uint64_t ret_ref = 0;
7469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7471         return ret_ref;
7472 }
7473
7474 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7475 CHECK(!owner->result_ok);
7476         return CreationError_clone(&*owner->contents.err);
7477 }
7478 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
7479         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7480         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
7481         return ret_conv;
7482 }
7483
7484 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7485 CHECK(owner->result_ok);
7486         return *owner->contents.result;
7487 }
7488 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
7489         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7490         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
7491 }
7492
7493 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7494 CHECK(!owner->result_ok);
7495         return SemanticError_clone(&*owner->contents.err);
7496 }
7497 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
7498         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7499         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
7500         return ret_conv;
7501 }
7502
7503 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7504         LDKInvoice ret = *owner->contents.result;
7505         ret.is_owned = false;
7506         return ret;
7507 }
7508 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
7509         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7510         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
7511         uint64_t ret_ref = 0;
7512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7514         return ret_ref;
7515 }
7516
7517 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7518 CHECK(!owner->result_ok);
7519         return SemanticError_clone(&*owner->contents.err);
7520 }
7521 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
7522         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7523         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
7524         return ret_conv;
7525 }
7526
7527 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7528         LDKDescription ret = *owner->contents.result;
7529         ret.is_owned = false;
7530         return ret;
7531 }
7532 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
7533         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7534         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
7535         uint64_t ret_ref = 0;
7536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7538         return ret_ref;
7539 }
7540
7541 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7542 CHECK(!owner->result_ok);
7543         return CreationError_clone(&*owner->contents.err);
7544 }
7545 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
7546         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7547         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
7548         return ret_conv;
7549 }
7550
7551 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7552         LDKPrivateRoute ret = *owner->contents.result;
7553         ret.is_owned = false;
7554         return ret;
7555 }
7556 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
7557         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7558         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
7559         uint64_t ret_ref = 0;
7560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7562         return ret_ref;
7563 }
7564
7565 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7566 CHECK(!owner->result_ok);
7567         return CreationError_clone(&*owner->contents.err);
7568 }
7569 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
7570         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7571         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
7572         return ret_conv;
7573 }
7574
7575 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7576 CHECK(owner->result_ok);
7577         return *owner->contents.result;
7578 }
7579 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
7580         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7581         CResult_NoneErrorZ_get_ok(owner_conv);
7582 }
7583
7584 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7585 CHECK(!owner->result_ok);
7586         return *owner->contents.err;
7587 }
7588 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
7589         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7590         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
7591         return ret_conv;
7592 }
7593
7594 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7595 CHECK(owner->result_ok);
7596         return NetAddress_clone(&*owner->contents.result);
7597 }
7598 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
7599         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7600         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
7601         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
7602         uint64_t ret_ref = tag_ptr(ret_copy, true);
7603         return ret_ref;
7604 }
7605
7606 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7607 CHECK(!owner->result_ok);
7608         return DecodeError_clone(&*owner->contents.err);
7609 }
7610 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
7611         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7612         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7613         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
7614         uint64_t ret_ref = tag_ptr(ret_copy, true);
7615         return ret_ref;
7616 }
7617
7618 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7619         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7620         for (size_t i = 0; i < ret.datalen; i++) {
7621                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7622         }
7623         return ret;
7624 }
7625 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7626         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7627         for (size_t i = 0; i < ret.datalen; i++) {
7628                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7629         }
7630         return ret;
7631 }
7632 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7633         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7634         for (size_t i = 0; i < ret.datalen; i++) {
7635                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7636         }
7637         return ret;
7638 }
7639 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7640         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7641         for (size_t i = 0; i < ret.datalen; i++) {
7642                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7643         }
7644         return ret;
7645 }
7646 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7647         LDKAcceptChannel ret = *owner->contents.result;
7648         ret.is_owned = false;
7649         return ret;
7650 }
7651 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7652         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7653         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7654         uint64_t ret_ref = 0;
7655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7657         return ret_ref;
7658 }
7659
7660 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7661 CHECK(!owner->result_ok);
7662         return DecodeError_clone(&*owner->contents.err);
7663 }
7664 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7665         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7666         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7667         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7668         uint64_t ret_ref = tag_ptr(ret_copy, true);
7669         return ret_ref;
7670 }
7671
7672 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7673         LDKAnnouncementSignatures ret = *owner->contents.result;
7674         ret.is_owned = false;
7675         return ret;
7676 }
7677 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7678         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7679         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7680         uint64_t ret_ref = 0;
7681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7683         return ret_ref;
7684 }
7685
7686 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7687 CHECK(!owner->result_ok);
7688         return DecodeError_clone(&*owner->contents.err);
7689 }
7690 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7691         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7692         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7693         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7694         uint64_t ret_ref = tag_ptr(ret_copy, true);
7695         return ret_ref;
7696 }
7697
7698 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7699         LDKChannelReestablish ret = *owner->contents.result;
7700         ret.is_owned = false;
7701         return ret;
7702 }
7703 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7704         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7705         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7706         uint64_t ret_ref = 0;
7707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7709         return ret_ref;
7710 }
7711
7712 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7713 CHECK(!owner->result_ok);
7714         return DecodeError_clone(&*owner->contents.err);
7715 }
7716 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7717         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7718         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7719         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7720         uint64_t ret_ref = tag_ptr(ret_copy, true);
7721         return ret_ref;
7722 }
7723
7724 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7725         LDKClosingSigned ret = *owner->contents.result;
7726         ret.is_owned = false;
7727         return ret;
7728 }
7729 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7730         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7731         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7732         uint64_t ret_ref = 0;
7733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7735         return ret_ref;
7736 }
7737
7738 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7739 CHECK(!owner->result_ok);
7740         return DecodeError_clone(&*owner->contents.err);
7741 }
7742 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7743         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7744         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7745         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7746         uint64_t ret_ref = tag_ptr(ret_copy, true);
7747         return ret_ref;
7748 }
7749
7750 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7751         LDKClosingSignedFeeRange ret = *owner->contents.result;
7752         ret.is_owned = false;
7753         return ret;
7754 }
7755 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7756         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7757         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7758         uint64_t ret_ref = 0;
7759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7761         return ret_ref;
7762 }
7763
7764 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7765 CHECK(!owner->result_ok);
7766         return DecodeError_clone(&*owner->contents.err);
7767 }
7768 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7769         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7770         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7771         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7772         uint64_t ret_ref = tag_ptr(ret_copy, true);
7773         return ret_ref;
7774 }
7775
7776 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7777         LDKCommitmentSigned ret = *owner->contents.result;
7778         ret.is_owned = false;
7779         return ret;
7780 }
7781 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7782         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7783         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7784         uint64_t ret_ref = 0;
7785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7787         return ret_ref;
7788 }
7789
7790 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7791 CHECK(!owner->result_ok);
7792         return DecodeError_clone(&*owner->contents.err);
7793 }
7794 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7795         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7796         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7797         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7798         uint64_t ret_ref = tag_ptr(ret_copy, true);
7799         return ret_ref;
7800 }
7801
7802 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7803         LDKFundingCreated ret = *owner->contents.result;
7804         ret.is_owned = false;
7805         return ret;
7806 }
7807 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7808         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7809         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7810         uint64_t ret_ref = 0;
7811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7813         return ret_ref;
7814 }
7815
7816 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7817 CHECK(!owner->result_ok);
7818         return DecodeError_clone(&*owner->contents.err);
7819 }
7820 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7821         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7822         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7823         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7824         uint64_t ret_ref = tag_ptr(ret_copy, true);
7825         return ret_ref;
7826 }
7827
7828 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7829         LDKFundingSigned ret = *owner->contents.result;
7830         ret.is_owned = false;
7831         return ret;
7832 }
7833 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7834         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7835         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7836         uint64_t ret_ref = 0;
7837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7839         return ret_ref;
7840 }
7841
7842 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7843 CHECK(!owner->result_ok);
7844         return DecodeError_clone(&*owner->contents.err);
7845 }
7846 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7847         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7848         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7849         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7850         uint64_t ret_ref = tag_ptr(ret_copy, true);
7851         return ret_ref;
7852 }
7853
7854 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7855         LDKChannelReady ret = *owner->contents.result;
7856         ret.is_owned = false;
7857         return ret;
7858 }
7859 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7860         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7861         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7862         uint64_t ret_ref = 0;
7863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7865         return ret_ref;
7866 }
7867
7868 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7869 CHECK(!owner->result_ok);
7870         return DecodeError_clone(&*owner->contents.err);
7871 }
7872 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7873         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7874         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7875         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7876         uint64_t ret_ref = tag_ptr(ret_copy, true);
7877         return ret_ref;
7878 }
7879
7880 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7881         LDKInit ret = *owner->contents.result;
7882         ret.is_owned = false;
7883         return ret;
7884 }
7885 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7886         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7887         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7888         uint64_t ret_ref = 0;
7889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7891         return ret_ref;
7892 }
7893
7894 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7895 CHECK(!owner->result_ok);
7896         return DecodeError_clone(&*owner->contents.err);
7897 }
7898 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7899         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7900         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7901         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7902         uint64_t ret_ref = tag_ptr(ret_copy, true);
7903         return ret_ref;
7904 }
7905
7906 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7907         LDKOpenChannel ret = *owner->contents.result;
7908         ret.is_owned = false;
7909         return ret;
7910 }
7911 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7912         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7913         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7914         uint64_t ret_ref = 0;
7915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7917         return ret_ref;
7918 }
7919
7920 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7921 CHECK(!owner->result_ok);
7922         return DecodeError_clone(&*owner->contents.err);
7923 }
7924 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7925         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7926         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7927         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7928         uint64_t ret_ref = tag_ptr(ret_copy, true);
7929         return ret_ref;
7930 }
7931
7932 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7933         LDKRevokeAndACK ret = *owner->contents.result;
7934         ret.is_owned = false;
7935         return ret;
7936 }
7937 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7938         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7939         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7940         uint64_t ret_ref = 0;
7941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7943         return ret_ref;
7944 }
7945
7946 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7947 CHECK(!owner->result_ok);
7948         return DecodeError_clone(&*owner->contents.err);
7949 }
7950 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7951         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7953         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7954         uint64_t ret_ref = tag_ptr(ret_copy, true);
7955         return ret_ref;
7956 }
7957
7958 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7959         LDKShutdown ret = *owner->contents.result;
7960         ret.is_owned = false;
7961         return ret;
7962 }
7963 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7964         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7965         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7966         uint64_t ret_ref = 0;
7967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7969         return ret_ref;
7970 }
7971
7972 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7973 CHECK(!owner->result_ok);
7974         return DecodeError_clone(&*owner->contents.err);
7975 }
7976 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7977         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7978         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7979         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7980         uint64_t ret_ref = tag_ptr(ret_copy, true);
7981         return ret_ref;
7982 }
7983
7984 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7985         LDKUpdateFailHTLC ret = *owner->contents.result;
7986         ret.is_owned = false;
7987         return ret;
7988 }
7989 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7990         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7991         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7992         uint64_t ret_ref = 0;
7993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7995         return ret_ref;
7996 }
7997
7998 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7999 CHECK(!owner->result_ok);
8000         return DecodeError_clone(&*owner->contents.err);
8001 }
8002 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
8003         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8004         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8005         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8006         uint64_t ret_ref = tag_ptr(ret_copy, true);
8007         return ret_ref;
8008 }
8009
8010 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8011         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8012         ret.is_owned = false;
8013         return ret;
8014 }
8015 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8016         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8017         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8018         uint64_t ret_ref = 0;
8019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8021         return ret_ref;
8022 }
8023
8024 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8025 CHECK(!owner->result_ok);
8026         return DecodeError_clone(&*owner->contents.err);
8027 }
8028 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
8029         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8030         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8031         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8032         uint64_t ret_ref = tag_ptr(ret_copy, true);
8033         return ret_ref;
8034 }
8035
8036 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8037         LDKUpdateFee ret = *owner->contents.result;
8038         ret.is_owned = false;
8039         return ret;
8040 }
8041 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
8042         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8043         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8044         uint64_t ret_ref = 0;
8045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8047         return ret_ref;
8048 }
8049
8050 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8051 CHECK(!owner->result_ok);
8052         return DecodeError_clone(&*owner->contents.err);
8053 }
8054 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
8055         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8056         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8057         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8058         uint64_t ret_ref = tag_ptr(ret_copy, true);
8059         return ret_ref;
8060 }
8061
8062 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8063         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8064         ret.is_owned = false;
8065         return ret;
8066 }
8067 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8068         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8069         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8070         uint64_t ret_ref = 0;
8071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8073         return ret_ref;
8074 }
8075
8076 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8077 CHECK(!owner->result_ok);
8078         return DecodeError_clone(&*owner->contents.err);
8079 }
8080 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
8081         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8082         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8083         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8084         uint64_t ret_ref = tag_ptr(ret_copy, true);
8085         return ret_ref;
8086 }
8087
8088 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8089         LDKUpdateAddHTLC ret = *owner->contents.result;
8090         ret.is_owned = false;
8091         return ret;
8092 }
8093 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8094         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8095         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8096         uint64_t ret_ref = 0;
8097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8099         return ret_ref;
8100 }
8101
8102 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8103 CHECK(!owner->result_ok);
8104         return DecodeError_clone(&*owner->contents.err);
8105 }
8106 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
8107         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8108         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8109         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8110         uint64_t ret_ref = tag_ptr(ret_copy, true);
8111         return ret_ref;
8112 }
8113
8114 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8115         LDKOnionMessage ret = *owner->contents.result;
8116         ret.is_owned = false;
8117         return ret;
8118 }
8119 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
8120         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8121         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
8122         uint64_t ret_ref = 0;
8123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8125         return ret_ref;
8126 }
8127
8128 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8129 CHECK(!owner->result_ok);
8130         return DecodeError_clone(&*owner->contents.err);
8131 }
8132 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
8133         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8134         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8135         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
8136         uint64_t ret_ref = tag_ptr(ret_copy, true);
8137         return ret_ref;
8138 }
8139
8140 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8141         LDKPing ret = *owner->contents.result;
8142         ret.is_owned = false;
8143         return ret;
8144 }
8145 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
8146         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8147         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8148         uint64_t ret_ref = 0;
8149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8151         return ret_ref;
8152 }
8153
8154 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8155 CHECK(!owner->result_ok);
8156         return DecodeError_clone(&*owner->contents.err);
8157 }
8158 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
8159         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8160         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8161         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
8162         uint64_t ret_ref = tag_ptr(ret_copy, true);
8163         return ret_ref;
8164 }
8165
8166 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8167         LDKPong ret = *owner->contents.result;
8168         ret.is_owned = false;
8169         return ret;
8170 }
8171 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
8172         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8173         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8174         uint64_t ret_ref = 0;
8175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8177         return ret_ref;
8178 }
8179
8180 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8181 CHECK(!owner->result_ok);
8182         return DecodeError_clone(&*owner->contents.err);
8183 }
8184 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
8185         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8186         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8187         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
8188         uint64_t ret_ref = tag_ptr(ret_copy, true);
8189         return ret_ref;
8190 }
8191
8192 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8193         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8194         ret.is_owned = false;
8195         return ret;
8196 }
8197 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8198         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8199         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8200         uint64_t ret_ref = 0;
8201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8203         return ret_ref;
8204 }
8205
8206 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8207 CHECK(!owner->result_ok);
8208         return DecodeError_clone(&*owner->contents.err);
8209 }
8210 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8211         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8212         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8213         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8214         uint64_t ret_ref = tag_ptr(ret_copy, true);
8215         return ret_ref;
8216 }
8217
8218 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8219         LDKChannelAnnouncement ret = *owner->contents.result;
8220         ret.is_owned = false;
8221         return ret;
8222 }
8223 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8224         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8225         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8226         uint64_t ret_ref = 0;
8227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8229         return ret_ref;
8230 }
8231
8232 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8233 CHECK(!owner->result_ok);
8234         return DecodeError_clone(&*owner->contents.err);
8235 }
8236 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8237         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8238         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8239         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8240         uint64_t ret_ref = tag_ptr(ret_copy, true);
8241         return ret_ref;
8242 }
8243
8244 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8245         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8246         ret.is_owned = false;
8247         return ret;
8248 }
8249 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8250         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8251         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8252         uint64_t ret_ref = 0;
8253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8255         return ret_ref;
8256 }
8257
8258 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8259 CHECK(!owner->result_ok);
8260         return DecodeError_clone(&*owner->contents.err);
8261 }
8262 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8263         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8264         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8265         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8266         uint64_t ret_ref = tag_ptr(ret_copy, true);
8267         return ret_ref;
8268 }
8269
8270 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8271         LDKChannelUpdate ret = *owner->contents.result;
8272         ret.is_owned = false;
8273         return ret;
8274 }
8275 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8276         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8277         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8278         uint64_t ret_ref = 0;
8279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8281         return ret_ref;
8282 }
8283
8284 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8285 CHECK(!owner->result_ok);
8286         return DecodeError_clone(&*owner->contents.err);
8287 }
8288 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8289         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8290         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8291         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8292         uint64_t ret_ref = tag_ptr(ret_copy, true);
8293         return ret_ref;
8294 }
8295
8296 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8297         LDKErrorMessage ret = *owner->contents.result;
8298         ret.is_owned = false;
8299         return ret;
8300 }
8301 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
8302         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8303         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8304         uint64_t ret_ref = 0;
8305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8307         return ret_ref;
8308 }
8309
8310 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8311 CHECK(!owner->result_ok);
8312         return DecodeError_clone(&*owner->contents.err);
8313 }
8314 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
8315         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8316         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8317         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8318         uint64_t ret_ref = tag_ptr(ret_copy, true);
8319         return ret_ref;
8320 }
8321
8322 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8323         LDKWarningMessage ret = *owner->contents.result;
8324         ret.is_owned = false;
8325         return ret;
8326 }
8327 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
8328         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8329         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8330         uint64_t ret_ref = 0;
8331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8333         return ret_ref;
8334 }
8335
8336 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8337 CHECK(!owner->result_ok);
8338         return DecodeError_clone(&*owner->contents.err);
8339 }
8340 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
8341         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8342         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8343         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8344         uint64_t ret_ref = tag_ptr(ret_copy, true);
8345         return ret_ref;
8346 }
8347
8348 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8349         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
8350         ret.is_owned = false;
8351         return ret;
8352 }
8353 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8354         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8355         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8356         uint64_t ret_ref = 0;
8357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8359         return ret_ref;
8360 }
8361
8362 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8363 CHECK(!owner->result_ok);
8364         return DecodeError_clone(&*owner->contents.err);
8365 }
8366 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8367         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8368         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8369         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8370         uint64_t ret_ref = tag_ptr(ret_copy, true);
8371         return ret_ref;
8372 }
8373
8374 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8375         LDKNodeAnnouncement ret = *owner->contents.result;
8376         ret.is_owned = false;
8377         return ret;
8378 }
8379 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8380         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8381         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8382         uint64_t ret_ref = 0;
8383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8385         return ret_ref;
8386 }
8387
8388 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8389 CHECK(!owner->result_ok);
8390         return DecodeError_clone(&*owner->contents.err);
8391 }
8392 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8393         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8394         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8395         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8396         uint64_t ret_ref = tag_ptr(ret_copy, true);
8397         return ret_ref;
8398 }
8399
8400 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8401         LDKQueryShortChannelIds ret = *owner->contents.result;
8402         ret.is_owned = false;
8403         return ret;
8404 }
8405 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
8406         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8407         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8408         uint64_t ret_ref = 0;
8409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8411         return ret_ref;
8412 }
8413
8414 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8415 CHECK(!owner->result_ok);
8416         return DecodeError_clone(&*owner->contents.err);
8417 }
8418 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
8419         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8420         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8421         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8422         uint64_t ret_ref = tag_ptr(ret_copy, true);
8423         return ret_ref;
8424 }
8425
8426 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8427         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
8428         ret.is_owned = false;
8429         return ret;
8430 }
8431 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
8432         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8433         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8434         uint64_t ret_ref = 0;
8435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8437         return ret_ref;
8438 }
8439
8440 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8441 CHECK(!owner->result_ok);
8442         return DecodeError_clone(&*owner->contents.err);
8443 }
8444 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
8445         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8446         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8447         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8448         uint64_t ret_ref = tag_ptr(ret_copy, true);
8449         return ret_ref;
8450 }
8451
8452 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8453         LDKQueryChannelRange ret = *owner->contents.result;
8454         ret.is_owned = false;
8455         return ret;
8456 }
8457 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8458         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8459         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8460         uint64_t ret_ref = 0;
8461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8463         return ret_ref;
8464 }
8465
8466 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8467 CHECK(!owner->result_ok);
8468         return DecodeError_clone(&*owner->contents.err);
8469 }
8470 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8471         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8472         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8473         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8474         uint64_t ret_ref = tag_ptr(ret_copy, true);
8475         return ret_ref;
8476 }
8477
8478 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8479         LDKReplyChannelRange ret = *owner->contents.result;
8480         ret.is_owned = false;
8481         return ret;
8482 }
8483 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8484         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8485         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8486         uint64_t ret_ref = 0;
8487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8489         return ret_ref;
8490 }
8491
8492 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8493 CHECK(!owner->result_ok);
8494         return DecodeError_clone(&*owner->contents.err);
8495 }
8496 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8497         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8498         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8499         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8500         uint64_t ret_ref = tag_ptr(ret_copy, true);
8501         return ret_ref;
8502 }
8503
8504 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8505         LDKGossipTimestampFilter ret = *owner->contents.result;
8506         ret.is_owned = false;
8507         return ret;
8508 }
8509 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
8510         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8511         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8512         uint64_t ret_ref = 0;
8513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8515         return ret_ref;
8516 }
8517
8518 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8519 CHECK(!owner->result_ok);
8520         return DecodeError_clone(&*owner->contents.err);
8521 }
8522 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
8523         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8524         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8525         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8526         uint64_t ret_ref = tag_ptr(ret_copy, true);
8527         return ret_ref;
8528 }
8529
8530 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
8531         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
8532         for (size_t i = 0; i < ret.datalen; i++) {
8533                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
8534         }
8535         return ret;
8536 }
8537 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
8538         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8539         switch(obj->tag) {
8540                 case LDKSignOrCreationError_SignError: return 0;
8541                 case LDKSignOrCreationError_CreationError: return 1;
8542                 default: abort();
8543         }
8544 }
8545 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
8546         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8547         assert(obj->tag == LDKSignOrCreationError_CreationError);
8548                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
8549         return creation_error_conv;
8550 }
8551 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8552         LDKInvoice ret = *owner->contents.result;
8553         ret.is_owned = false;
8554         return ret;
8555 }
8556 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
8557         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8558         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8559         uint64_t ret_ref = 0;
8560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8562         return ret_ref;
8563 }
8564
8565 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8566 CHECK(!owner->result_ok);
8567         return SignOrCreationError_clone(&*owner->contents.err);
8568 }
8569 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
8570         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8571         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8572         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8573         uint64_t ret_ref = tag_ptr(ret_copy, true);
8574         return ret_ref;
8575 }
8576
8577 typedef struct LDKFilter_JCalls {
8578         atomic_size_t refcnt;
8579         uint32_t instance_ptr;
8580 } LDKFilter_JCalls;
8581 static void LDKFilter_JCalls_free(void* this_arg) {
8582         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8583         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8584                 FREE(j_calls);
8585         }
8586 }
8587 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8588         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8589         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8590         memcpy(txid_arr->elems, *txid, 32);
8591         LDKu8slice script_pubkey_var = script_pubkey;
8592         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8593         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8594         js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
8595 }
8596 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8597         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8598         LDKWatchedOutput output_var = output;
8599         uint64_t output_ref = 0;
8600         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8601         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
8602         js_invoke_function_buuuuu(j_calls->instance_ptr, 41, output_ref, 0, 0, 0, 0, 0);
8603 }
8604 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8605         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8606         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8607 }
8608 static inline LDKFilter LDKFilter_init (JSValue o) {
8609         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8610         atomic_init(&calls->refcnt, 1);
8611         calls->instance_ptr = o;
8612
8613         LDKFilter ret = {
8614                 .this_arg = (void*) calls,
8615                 .register_tx = register_tx_LDKFilter_jcall,
8616                 .register_output = register_output_LDKFilter_jcall,
8617                 .free = LDKFilter_JCalls_free,
8618         };
8619         return ret;
8620 }
8621 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8622         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8623         *res_ptr = LDKFilter_init(o);
8624         return tag_ptr(res_ptr, true);
8625 }
8626 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8627         void* this_arg_ptr = untag_ptr(this_arg);
8628         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8629         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8630         uint8_t txid_arr[32];
8631         CHECK(txid->arr_len == 32);
8632         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8633         uint8_t (*txid_ref)[32] = &txid_arr;
8634         LDKu8slice script_pubkey_ref;
8635         script_pubkey_ref.datalen = script_pubkey->arr_len;
8636         script_pubkey_ref.data = script_pubkey->elems;
8637         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8638         FREE(script_pubkey);
8639 }
8640
8641 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
8642         void* this_arg_ptr = untag_ptr(this_arg);
8643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8644         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8645         LDKWatchedOutput output_conv;
8646         output_conv.inner = untag_ptr(output);
8647         output_conv.is_owned = ptr_is_owned(output);
8648         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8649         output_conv = WatchedOutput_clone(&output_conv);
8650         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8651 }
8652
8653 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
8654         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8655         switch(obj->tag) {
8656                 case LDKCOption_FilterZ_Some: return 0;
8657                 case LDKCOption_FilterZ_None: return 1;
8658                 default: abort();
8659         }
8660 }
8661 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
8662         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8663         assert(obj->tag == LDKCOption_FilterZ_Some);
8664                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8665                         *some_ret = obj->some;
8666                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8667                         if ((*some_ret).free == LDKFilter_JCalls_free) {
8668                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8669                                 LDKFilter_JCalls_cloned(&(*some_ret));
8670                         }
8671         return tag_ptr(some_ret, true);
8672 }
8673 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8674         LDKLockedChannelMonitor ret = *owner->contents.result;
8675         ret.is_owned = false;
8676         return ret;
8677 }
8678 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
8679         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8680         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8681         uint64_t ret_ref = 0;
8682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8684         return ret_ref;
8685 }
8686
8687 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8688 CHECK(!owner->result_ok);
8689         return *owner->contents.err;
8690 }
8691 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
8692         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8693         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8694 }
8695
8696 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8697         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8698         for (size_t i = 0; i < ret.datalen; i++) {
8699                 ret.data[i] = OutPoint_clone(&orig->data[i]);
8700         }
8701         return ret;
8702 }
8703 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
8704         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
8705         for (size_t i = 0; i < ret.datalen; i++) {
8706                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
8707         }
8708         return ret;
8709 }
8710 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8711         LDKOutPoint ret = owner->a;
8712         ret.is_owned = false;
8713         return ret;
8714 }
8715 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
8716         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8717         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
8718         uint64_t ret_ref = 0;
8719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8721         return ret_ref;
8722 }
8723
8724 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8725         return CVec_MonitorUpdateIdZ_clone(&owner->b);
8726 }
8727 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
8728         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8729         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
8730         uint64_tArray ret_arr = NULL;
8731         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8732         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8733         for (size_t r = 0; r < ret_var.datalen; r++) {
8734                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
8735                 uint64_t ret_conv_17_ref = 0;
8736                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
8737                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
8738                 ret_arr_ptr[r] = ret_conv_17_ref;
8739         }
8740         
8741         FREE(ret_var.data);
8742         return ret_arr;
8743 }
8744
8745 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
8746         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
8747         for (size_t i = 0; i < ret.datalen; i++) {
8748                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
8749         }
8750         return ret;
8751 }
8752 typedef struct LDKMessageSendEventsProvider_JCalls {
8753         atomic_size_t refcnt;
8754         uint32_t instance_ptr;
8755 } LDKMessageSendEventsProvider_JCalls;
8756 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
8757         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8758         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8759                 FREE(j_calls);
8760         }
8761 }
8762 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
8763         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8764         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
8765         LDKCVec_MessageSendEventZ ret_constr;
8766         ret_constr.datalen = ret->arr_len;
8767         if (ret_constr.datalen > 0)
8768                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8769         else
8770                 ret_constr.data = NULL;
8771         uint64_t* ret_vals = ret->elems;
8772         for (size_t s = 0; s < ret_constr.datalen; s++) {
8773                 uint64_t ret_conv_18 = ret_vals[s];
8774                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
8775                 CHECK_ACCESS(ret_conv_18_ptr);
8776                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
8777                 FREE(untag_ptr(ret_conv_18));
8778                 ret_constr.data[s] = ret_conv_18_conv;
8779         }
8780         FREE(ret);
8781         return ret_constr;
8782 }
8783 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
8784         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
8785         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8786 }
8787 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
8788         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
8789         atomic_init(&calls->refcnt, 1);
8790         calls->instance_ptr = o;
8791
8792         LDKMessageSendEventsProvider ret = {
8793                 .this_arg = (void*) calls,
8794                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
8795                 .free = LDKMessageSendEventsProvider_JCalls_free,
8796         };
8797         return ret;
8798 }
8799 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
8800         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8801         *res_ptr = LDKMessageSendEventsProvider_init(o);
8802         return tag_ptr(res_ptr, true);
8803 }
8804 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) {
8805         void* this_arg_ptr = untag_ptr(this_arg);
8806         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8807         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
8808         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
8809         uint64_tArray ret_arr = NULL;
8810         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8811         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8812         for (size_t s = 0; s < ret_var.datalen; s++) {
8813                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8814                 *ret_conv_18_copy = ret_var.data[s];
8815                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
8816                 ret_arr_ptr[s] = ret_conv_18_ref;
8817         }
8818         
8819         FREE(ret_var.data);
8820         return ret_arr;
8821 }
8822
8823 typedef struct LDKOnionMessageProvider_JCalls {
8824         atomic_size_t refcnt;
8825         uint32_t instance_ptr;
8826 } LDKOnionMessageProvider_JCalls;
8827 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
8828         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
8829         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8830                 FREE(j_calls);
8831         }
8832 }
8833 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
8834         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
8835         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
8836         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
8837         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
8838         LDKOnionMessage ret_conv;
8839         ret_conv.inner = untag_ptr(ret);
8840         ret_conv.is_owned = ptr_is_owned(ret);
8841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
8842         return ret_conv;
8843 }
8844 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
8845         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
8846         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8847 }
8848 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
8849         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
8850         atomic_init(&calls->refcnt, 1);
8851         calls->instance_ptr = o;
8852
8853         LDKOnionMessageProvider ret = {
8854                 .this_arg = (void*) calls,
8855                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
8856                 .free = LDKOnionMessageProvider_JCalls_free,
8857         };
8858         return ret;
8859 }
8860 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
8861         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
8862         *res_ptr = LDKOnionMessageProvider_init(o);
8863         return tag_ptr(res_ptr, true);
8864 }
8865 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) {
8866         void* this_arg_ptr = untag_ptr(this_arg);
8867         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8868         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
8869         LDKPublicKey peer_node_id_ref;
8870         CHECK(peer_node_id->arr_len == 33);
8871         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
8872         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
8873         uint64_t ret_ref = 0;
8874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8876         return ret_ref;
8877 }
8878
8879 typedef struct LDKEventHandler_JCalls {
8880         atomic_size_t refcnt;
8881         uint32_t instance_ptr;
8882 } LDKEventHandler_JCalls;
8883 static void LDKEventHandler_JCalls_free(void* this_arg) {
8884         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8885         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8886                 FREE(j_calls);
8887         }
8888 }
8889 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
8890         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8891         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8892         *event_copy = event;
8893         uint64_t event_ref = tag_ptr(event_copy, true);
8894         js_invoke_function_buuuuu(j_calls->instance_ptr, 44, event_ref, 0, 0, 0, 0, 0);
8895 }
8896 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8897         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8898         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8899 }
8900 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8901         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8902         atomic_init(&calls->refcnt, 1);
8903         calls->instance_ptr = o;
8904
8905         LDKEventHandler ret = {
8906                 .this_arg = (void*) calls,
8907                 .handle_event = handle_event_LDKEventHandler_jcall,
8908                 .free = LDKEventHandler_JCalls_free,
8909         };
8910         return ret;
8911 }
8912 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8913         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8914         *res_ptr = LDKEventHandler_init(o);
8915         return tag_ptr(res_ptr, true);
8916 }
8917 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
8918         void* this_arg_ptr = untag_ptr(this_arg);
8919         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8920         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8921         void* event_ptr = untag_ptr(event);
8922         CHECK_ACCESS(event_ptr);
8923         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
8924         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
8925         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8926 }
8927
8928 typedef struct LDKEventsProvider_JCalls {
8929         atomic_size_t refcnt;
8930         uint32_t instance_ptr;
8931 } LDKEventsProvider_JCalls;
8932 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8933         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8934         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8935                 FREE(j_calls);
8936         }
8937 }
8938 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8939         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8940         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8941         *handler_ret = handler;
8942         js_invoke_function_buuuuu(j_calls->instance_ptr, 45, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
8943 }
8944 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8945         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8946         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8947 }
8948 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8949         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8950         atomic_init(&calls->refcnt, 1);
8951         calls->instance_ptr = o;
8952
8953         LDKEventsProvider ret = {
8954                 .this_arg = (void*) calls,
8955                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8956                 .free = LDKEventsProvider_JCalls_free,
8957         };
8958         return ret;
8959 }
8960 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8961         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8962         *res_ptr = LDKEventsProvider_init(o);
8963         return tag_ptr(res_ptr, true);
8964 }
8965 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
8966         void* this_arg_ptr = untag_ptr(this_arg);
8967         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8968         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8969         void* handler_ptr = untag_ptr(handler);
8970         CHECK_ACCESS(handler_ptr);
8971         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8972         if (handler_conv.free == LDKEventHandler_JCalls_free) {
8973                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8974                 LDKEventHandler_JCalls_cloned(&handler_conv);
8975         }
8976         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8977 }
8978
8979 typedef struct LDKScore_JCalls {
8980         atomic_size_t refcnt;
8981         uint32_t instance_ptr;
8982 } LDKScore_JCalls;
8983 static void LDKScore_JCalls_free(void* this_arg) {
8984         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8985         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8986                 FREE(j_calls);
8987         }
8988 }
8989 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8990         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8991         int64_t short_channel_id_conv = short_channel_id;
8992         LDKNodeId source_var = *source;
8993         uint64_t source_ref = 0;
8994         source_var = NodeId_clone(&source_var);
8995         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8996         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
8997         LDKNodeId target_var = *target;
8998         uint64_t target_ref = 0;
8999         target_var = NodeId_clone(&target_var);
9000         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
9001         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
9002         LDKChannelUsage usage_var = usage;
9003         uint64_t usage_ref = 0;
9004         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
9005         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
9006         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 46, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
9007 }
9008 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9009         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9010         LDKCVec_RouteHopZ path_var = path;
9011         uint64_tArray path_arr = NULL;
9012         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
9013         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
9014         for (size_t k = 0; k < path_var.datalen; k++) {
9015                 LDKRouteHop path_conv_10_var = path_var.data[k];
9016                 uint64_t path_conv_10_ref = 0;
9017                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9018                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9019                 path_arr_ptr[k] = path_conv_10_ref;
9020         }
9021         
9022         FREE(path_var.data);
9023         int64_t short_channel_id_conv = short_channel_id;
9024         js_invoke_function_ubuuuu(j_calls->instance_ptr, 47, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
9025 }
9026 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9027         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9028         LDKCVec_RouteHopZ path_var = path;
9029         uint64_tArray path_arr = NULL;
9030         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
9031         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
9032         for (size_t k = 0; k < path_var.datalen; k++) {
9033                 LDKRouteHop path_conv_10_var = path_var.data[k];
9034                 uint64_t path_conv_10_ref = 0;
9035                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9036                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9037                 path_arr_ptr[k] = path_conv_10_ref;
9038         }
9039         
9040         FREE(path_var.data);
9041         js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, (uint32_t)path_arr, 0, 0, 0, 0, 0);
9042 }
9043 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9044         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9045         LDKCVec_RouteHopZ path_var = path;
9046         uint64_tArray path_arr = NULL;
9047         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
9048         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
9049         for (size_t k = 0; k < path_var.datalen; k++) {
9050                 LDKRouteHop path_conv_10_var = path_var.data[k];
9051                 uint64_t path_conv_10_ref = 0;
9052                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9053                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9054                 path_arr_ptr[k] = path_conv_10_ref;
9055         }
9056         
9057         FREE(path_var.data);
9058         int64_t short_channel_id_conv = short_channel_id;
9059         js_invoke_function_ubuuuu(j_calls->instance_ptr, 49, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
9060 }
9061 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9062         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9063         LDKCVec_RouteHopZ path_var = path;
9064         uint64_tArray path_arr = NULL;
9065         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
9066         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
9067         for (size_t k = 0; k < path_var.datalen; k++) {
9068                 LDKRouteHop path_conv_10_var = path_var.data[k];
9069                 uint64_t path_conv_10_ref = 0;
9070                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9071                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9072                 path_arr_ptr[k] = path_conv_10_ref;
9073         }
9074         
9075         FREE(path_var.data);
9076         js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, (uint32_t)path_arr, 0, 0, 0, 0, 0);
9077 }
9078 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
9079         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9080         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, 0, 0, 0, 0, 0, 0);
9081         LDKCVec_u8Z ret_ref;
9082         ret_ref.datalen = ret->arr_len;
9083         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9084         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9085         return ret_ref;
9086 }
9087 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
9088         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
9089         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9090 }
9091 static inline LDKScore LDKScore_init (JSValue o) {
9092         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
9093         atomic_init(&calls->refcnt, 1);
9094         calls->instance_ptr = o;
9095
9096         LDKScore ret = {
9097                 .this_arg = (void*) calls,
9098                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
9099                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
9100                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
9101                 .probe_failed = probe_failed_LDKScore_jcall,
9102                 .probe_successful = probe_successful_LDKScore_jcall,
9103                 .write = write_LDKScore_jcall,
9104                 .free = LDKScore_JCalls_free,
9105         };
9106         return ret;
9107 }
9108 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
9109         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
9110         *res_ptr = LDKScore_init(o);
9111         return tag_ptr(res_ptr, true);
9112 }
9113 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) {
9114         void* this_arg_ptr = untag_ptr(this_arg);
9115         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9116         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9117         LDKNodeId source_conv;
9118         source_conv.inner = untag_ptr(source);
9119         source_conv.is_owned = ptr_is_owned(source);
9120         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
9121         source_conv.is_owned = false;
9122         LDKNodeId target_conv;
9123         target_conv.inner = untag_ptr(target);
9124         target_conv.is_owned = ptr_is_owned(target);
9125         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
9126         target_conv.is_owned = false;
9127         LDKChannelUsage usage_conv;
9128         usage_conv.inner = untag_ptr(usage);
9129         usage_conv.is_owned = ptr_is_owned(usage);
9130         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
9131         usage_conv = ChannelUsage_clone(&usage_conv);
9132         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
9133         return ret_conv;
9134 }
9135
9136 void  __attribute__((export_name("TS_Score_payment_path_failed"))) TS_Score_payment_path_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
9137         void* this_arg_ptr = untag_ptr(this_arg);
9138         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9139         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9140         LDKCVec_RouteHopZ path_constr;
9141         path_constr.datalen = path->arr_len;
9142         if (path_constr.datalen > 0)
9143                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9144         else
9145                 path_constr.data = NULL;
9146         uint64_t* path_vals = path->elems;
9147         for (size_t k = 0; k < path_constr.datalen; k++) {
9148                 uint64_t path_conv_10 = path_vals[k];
9149                 LDKRouteHop path_conv_10_conv;
9150                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9151                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9152                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9153                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9154                 path_constr.data[k] = path_conv_10_conv;
9155         }
9156         FREE(path);
9157         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
9158 }
9159
9160 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
9161         void* this_arg_ptr = untag_ptr(this_arg);
9162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9163         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9164         LDKCVec_RouteHopZ path_constr;
9165         path_constr.datalen = path->arr_len;
9166         if (path_constr.datalen > 0)
9167                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9168         else
9169                 path_constr.data = NULL;
9170         uint64_t* path_vals = path->elems;
9171         for (size_t k = 0; k < path_constr.datalen; k++) {
9172                 uint64_t path_conv_10 = path_vals[k];
9173                 LDKRouteHop path_conv_10_conv;
9174                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9175                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9176                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9177                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9178                 path_constr.data[k] = path_conv_10_conv;
9179         }
9180         FREE(path);
9181         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
9182 }
9183
9184 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
9185         void* this_arg_ptr = untag_ptr(this_arg);
9186         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9187         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9188         LDKCVec_RouteHopZ path_constr;
9189         path_constr.datalen = path->arr_len;
9190         if (path_constr.datalen > 0)
9191                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9192         else
9193                 path_constr.data = NULL;
9194         uint64_t* path_vals = path->elems;
9195         for (size_t k = 0; k < path_constr.datalen; k++) {
9196                 uint64_t path_conv_10 = path_vals[k];
9197                 LDKRouteHop path_conv_10_conv;
9198                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9199                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9200                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9201                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9202                 path_constr.data[k] = path_conv_10_conv;
9203         }
9204         FREE(path);
9205         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
9206 }
9207
9208 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
9209         void* this_arg_ptr = untag_ptr(this_arg);
9210         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9211         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9212         LDKCVec_RouteHopZ path_constr;
9213         path_constr.datalen = path->arr_len;
9214         if (path_constr.datalen > 0)
9215                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9216         else
9217                 path_constr.data = NULL;
9218         uint64_t* path_vals = path->elems;
9219         for (size_t k = 0; k < path_constr.datalen; k++) {
9220                 uint64_t path_conv_10 = path_vals[k];
9221                 LDKRouteHop path_conv_10_conv;
9222                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9223                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9224                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9225                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9226                 path_constr.data[k] = path_conv_10_conv;
9227         }
9228         FREE(path);
9229         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
9230 }
9231
9232 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
9233         void* this_arg_ptr = untag_ptr(this_arg);
9234         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9235         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9236         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9237         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9238         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9239         CVec_u8Z_free(ret_var);
9240         return ret_arr;
9241 }
9242
9243 typedef struct LDKLockableScore_JCalls {
9244         atomic_size_t refcnt;
9245         uint32_t instance_ptr;
9246 } LDKLockableScore_JCalls;
9247 static void LDKLockableScore_JCalls_free(void* this_arg) {
9248         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9249         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9250                 FREE(j_calls);
9251         }
9252 }
9253 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
9254         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9255         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, 0, 0, 0, 0, 0, 0);
9256         void* ret_ptr = untag_ptr(ret);
9257         CHECK_ACCESS(ret_ptr);
9258         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
9259         if (ret_conv.free == LDKScore_JCalls_free) {
9260                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9261                 LDKScore_JCalls_cloned(&ret_conv);
9262         }// WARNING: we may need a move here but no clone is available for LDKScore
9263         
9264         return ret_conv;
9265 }
9266 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
9267         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
9268         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9269 }
9270 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
9271         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
9272         atomic_init(&calls->refcnt, 1);
9273         calls->instance_ptr = o;
9274
9275         LDKLockableScore ret = {
9276                 .this_arg = (void*) calls,
9277                 .lock = lock_LDKLockableScore_jcall,
9278                 .free = LDKLockableScore_JCalls_free,
9279         };
9280         return ret;
9281 }
9282 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
9283         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
9284         *res_ptr = LDKLockableScore_init(o);
9285         return tag_ptr(res_ptr, true);
9286 }
9287 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
9288         void* this_arg_ptr = untag_ptr(this_arg);
9289         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9290         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
9291         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
9292         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
9293         return tag_ptr(ret_ret, true);
9294 }
9295
9296 typedef struct LDKWriteableScore_JCalls {
9297         atomic_size_t refcnt;
9298         uint32_t instance_ptr;
9299         LDKLockableScore_JCalls* LockableScore;
9300 } LDKWriteableScore_JCalls;
9301 static void LDKWriteableScore_JCalls_free(void* this_arg) {
9302         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
9303         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9304                 FREE(j_calls);
9305         }
9306 }
9307 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
9308         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
9309         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, 0, 0, 0, 0, 0, 0);
9310         LDKCVec_u8Z ret_ref;
9311         ret_ref.datalen = ret->arr_len;
9312         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9313         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9314         return ret_ref;
9315 }
9316 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
9317         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
9318         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9319         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
9320 }
9321 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
9322         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
9323         atomic_init(&calls->refcnt, 1);
9324         calls->instance_ptr = o;
9325
9326         LDKWriteableScore ret = {
9327                 .this_arg = (void*) calls,
9328                 .write = write_LDKWriteableScore_jcall,
9329                 .free = LDKWriteableScore_JCalls_free,
9330                 .LockableScore = LDKLockableScore_init(LockableScore),
9331         };
9332         calls->LockableScore = ret.LockableScore.this_arg;
9333         return ret;
9334 }
9335 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
9336         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
9337         *res_ptr = LDKWriteableScore_init(o, LockableScore);
9338         return tag_ptr(res_ptr, true);
9339 }
9340 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
9341         void* this_arg_ptr = untag_ptr(this_arg);
9342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9343         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
9344         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9345         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9346         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9347         CVec_u8Z_free(ret_var);
9348         return ret_arr;
9349 }
9350
9351 typedef struct LDKPersister_JCalls {
9352         atomic_size_t refcnt;
9353         uint32_t instance_ptr;
9354 } LDKPersister_JCalls;
9355 static void LDKPersister_JCalls_free(void* this_arg) {
9356         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9357         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9358                 FREE(j_calls);
9359         }
9360 }
9361 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
9362         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9363         LDKChannelManager channel_manager_var = *channel_manager;
9364         uint64_t channel_manager_ref = 0;
9365         // WARNING: we may need a move here but no clone is available for LDKChannelManager
9366         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
9367         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
9368         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 54, channel_manager_ref, 0, 0, 0, 0, 0);
9369         void* ret_ptr = untag_ptr(ret);
9370         CHECK_ACCESS(ret_ptr);
9371         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9372         FREE(untag_ptr(ret));
9373         return ret_conv;
9374 }
9375 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
9376         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9377         LDKNetworkGraph network_graph_var = *network_graph;
9378         uint64_t network_graph_ref = 0;
9379         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
9380         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
9381         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
9382         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 55, network_graph_ref, 0, 0, 0, 0, 0);
9383         void* ret_ptr = untag_ptr(ret);
9384         CHECK_ACCESS(ret_ptr);
9385         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9386         FREE(untag_ptr(ret));
9387         return ret_conv;
9388 }
9389 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
9390         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9391         // WARNING: This object doesn't live past this scope, needs clone!
9392         uint64_t ret_scorer = tag_ptr(scorer, false);
9393         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 56, ret_scorer, 0, 0, 0, 0, 0);
9394         void* ret_ptr = untag_ptr(ret);
9395         CHECK_ACCESS(ret_ptr);
9396         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9397         FREE(untag_ptr(ret));
9398         return ret_conv;
9399 }
9400 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
9401         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
9402         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9403 }
9404 static inline LDKPersister LDKPersister_init (JSValue o) {
9405         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
9406         atomic_init(&calls->refcnt, 1);
9407         calls->instance_ptr = o;
9408
9409         LDKPersister ret = {
9410                 .this_arg = (void*) calls,
9411                 .persist_manager = persist_manager_LDKPersister_jcall,
9412                 .persist_graph = persist_graph_LDKPersister_jcall,
9413                 .persist_scorer = persist_scorer_LDKPersister_jcall,
9414                 .free = LDKPersister_JCalls_free,
9415         };
9416         return ret;
9417 }
9418 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
9419         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
9420         *res_ptr = LDKPersister_init(o);
9421         return tag_ptr(res_ptr, true);
9422 }
9423 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
9424         void* this_arg_ptr = untag_ptr(this_arg);
9425         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9426         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9427         LDKChannelManager channel_manager_conv;
9428         channel_manager_conv.inner = untag_ptr(channel_manager);
9429         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
9430         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
9431         channel_manager_conv.is_owned = false;
9432         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9433         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
9434         return tag_ptr(ret_conv, true);
9435 }
9436
9437 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
9438         void* this_arg_ptr = untag_ptr(this_arg);
9439         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9440         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9441         LDKNetworkGraph network_graph_conv;
9442         network_graph_conv.inner = untag_ptr(network_graph);
9443         network_graph_conv.is_owned = ptr_is_owned(network_graph);
9444         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
9445         network_graph_conv.is_owned = false;
9446         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9447         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
9448         return tag_ptr(ret_conv, true);
9449 }
9450
9451 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
9452         void* this_arg_ptr = untag_ptr(this_arg);
9453         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9454         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9455         void* scorer_ptr = untag_ptr(scorer);
9456         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
9457         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
9458         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9459         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
9460         return tag_ptr(ret_conv, true);
9461 }
9462
9463 typedef struct LDKFutureCallback_JCalls {
9464         atomic_size_t refcnt;
9465         uint32_t instance_ptr;
9466 } LDKFutureCallback_JCalls;
9467 static void LDKFutureCallback_JCalls_free(void* this_arg) {
9468         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
9469         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9470                 FREE(j_calls);
9471         }
9472 }
9473 void call_LDKFutureCallback_jcall(const void* this_arg) {
9474         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
9475         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, 0, 0, 0, 0, 0, 0);
9476 }
9477 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
9478         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
9479         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9480 }
9481 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
9482         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
9483         atomic_init(&calls->refcnt, 1);
9484         calls->instance_ptr = o;
9485
9486         LDKFutureCallback ret = {
9487                 .this_arg = (void*) calls,
9488                 .call = call_LDKFutureCallback_jcall,
9489                 .free = LDKFutureCallback_JCalls_free,
9490         };
9491         return ret;
9492 }
9493 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
9494         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
9495         *res_ptr = LDKFutureCallback_init(o);
9496         return tag_ptr(res_ptr, true);
9497 }
9498 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
9499         void* this_arg_ptr = untag_ptr(this_arg);
9500         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9501         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
9502         (this_arg_conv->call)(this_arg_conv->this_arg);
9503 }
9504
9505 typedef struct LDKListen_JCalls {
9506         atomic_size_t refcnt;
9507         uint32_t instance_ptr;
9508 } LDKListen_JCalls;
9509 static void LDKListen_JCalls_free(void* this_arg) {
9510         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9511         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9512                 FREE(j_calls);
9513         }
9514 }
9515 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9516         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9517         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9518         memcpy(header_arr->elems, *header, 80);
9519         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9520         uint64_tArray txdata_arr = NULL;
9521         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9522         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9523         for (size_t c = 0; c < txdata_var.datalen; c++) {
9524                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9525                 *txdata_conv_28_conv = txdata_var.data[c];
9526                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9527         }
9528         
9529         FREE(txdata_var.data);
9530         int32_t height_conv = height;
9531         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9532 }
9533 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
9534         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9535         LDKu8slice block_var = block;
9536         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
9537         memcpy(block_arr->elems, block_var.data, block_var.datalen);
9538         int32_t height_conv = height;
9539         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
9540 }
9541 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9542         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9543         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9544         memcpy(header_arr->elems, *header, 80);
9545         int32_t height_conv = height;
9546         js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9547 }
9548 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
9549         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
9550         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9551 }
9552 static inline LDKListen LDKListen_init (JSValue o) {
9553         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
9554         atomic_init(&calls->refcnt, 1);
9555         calls->instance_ptr = o;
9556
9557         LDKListen ret = {
9558                 .this_arg = (void*) calls,
9559                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
9560                 .block_connected = block_connected_LDKListen_jcall,
9561                 .block_disconnected = block_disconnected_LDKListen_jcall,
9562                 .free = LDKListen_JCalls_free,
9563         };
9564         return ret;
9565 }
9566 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
9567         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
9568         *res_ptr = LDKListen_init(o);
9569         return tag_ptr(res_ptr, true);
9570 }
9571 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) {
9572         void* this_arg_ptr = untag_ptr(this_arg);
9573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9574         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9575         uint8_t header_arr[80];
9576         CHECK(header->arr_len == 80);
9577         memcpy(header_arr, header->elems, 80); FREE(header);
9578         uint8_t (*header_ref)[80] = &header_arr;
9579         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9580         txdata_constr.datalen = txdata->arr_len;
9581         if (txdata_constr.datalen > 0)
9582                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9583         else
9584                 txdata_constr.data = NULL;
9585         uint64_t* txdata_vals = txdata->elems;
9586         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9587                 uint64_t txdata_conv_28 = txdata_vals[c];
9588                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9589                 CHECK_ACCESS(txdata_conv_28_ptr);
9590                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9591                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9592                 txdata_constr.data[c] = txdata_conv_28_conv;
9593         }
9594         FREE(txdata);
9595         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9596 }
9597
9598 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
9599         void* this_arg_ptr = untag_ptr(this_arg);
9600         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9601         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9602         LDKu8slice block_ref;
9603         block_ref.datalen = block->arr_len;
9604         block_ref.data = block->elems;
9605         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9606         FREE(block);
9607 }
9608
9609 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
9610         void* this_arg_ptr = untag_ptr(this_arg);
9611         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9612         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9613         uint8_t header_arr[80];
9614         CHECK(header->arr_len == 80);
9615         memcpy(header_arr, header->elems, 80); FREE(header);
9616         uint8_t (*header_ref)[80] = &header_arr;
9617         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9618 }
9619
9620 typedef struct LDKConfirm_JCalls {
9621         atomic_size_t refcnt;
9622         uint32_t instance_ptr;
9623 } LDKConfirm_JCalls;
9624 static void LDKConfirm_JCalls_free(void* this_arg) {
9625         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9626         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9627                 FREE(j_calls);
9628         }
9629 }
9630 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9631         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9632         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9633         memcpy(header_arr->elems, *header, 80);
9634         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9635         uint64_tArray txdata_arr = NULL;
9636         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9637         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9638         for (size_t c = 0; c < txdata_var.datalen; c++) {
9639                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9640                 *txdata_conv_28_conv = txdata_var.data[c];
9641                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9642         }
9643         
9644         FREE(txdata_var.data);
9645         int32_t height_conv = height;
9646         js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9647 }
9648 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
9649         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9650         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
9651         memcpy(txid_arr->elems, *txid, 32);
9652         js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
9653 }
9654 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9655         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9656         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9657         memcpy(header_arr->elems, *header, 80);
9658         int32_t height_conv = height;
9659         js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9660 }
9661 LDKCVec_C2Tuple_TxidBlockHashZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
9662         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9663         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 64, 0, 0, 0, 0, 0, 0);
9664         LDKCVec_C2Tuple_TxidBlockHashZZ ret_constr;
9665         ret_constr.datalen = ret->arr_len;
9666         if (ret_constr.datalen > 0)
9667                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
9668         else
9669                 ret_constr.data = NULL;
9670         uint64_t* ret_vals = ret->elems;
9671         for (size_t z = 0; z < ret_constr.datalen; z++) {
9672                 uint64_t ret_conv_25 = ret_vals[z];
9673                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
9674                 CHECK_ACCESS(ret_conv_25_ptr);
9675                 LDKC2Tuple_TxidBlockHashZ ret_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(ret_conv_25_ptr);
9676                 FREE(untag_ptr(ret_conv_25));
9677                 ret_constr.data[z] = ret_conv_25_conv;
9678         }
9679         FREE(ret);
9680         return ret_constr;
9681 }
9682 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
9683         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
9684         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9685 }
9686 static inline LDKConfirm LDKConfirm_init (JSValue o) {
9687         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
9688         atomic_init(&calls->refcnt, 1);
9689         calls->instance_ptr = o;
9690
9691         LDKConfirm ret = {
9692                 .this_arg = (void*) calls,
9693                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
9694                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
9695                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
9696                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
9697                 .free = LDKConfirm_JCalls_free,
9698         };
9699         return ret;
9700 }
9701 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
9702         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
9703         *res_ptr = LDKConfirm_init(o);
9704         return tag_ptr(res_ptr, true);
9705 }
9706 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) {
9707         void* this_arg_ptr = untag_ptr(this_arg);
9708         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9709         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9710         uint8_t header_arr[80];
9711         CHECK(header->arr_len == 80);
9712         memcpy(header_arr, header->elems, 80); FREE(header);
9713         uint8_t (*header_ref)[80] = &header_arr;
9714         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9715         txdata_constr.datalen = txdata->arr_len;
9716         if (txdata_constr.datalen > 0)
9717                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9718         else
9719                 txdata_constr.data = NULL;
9720         uint64_t* txdata_vals = txdata->elems;
9721         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9722                 uint64_t txdata_conv_28 = txdata_vals[c];
9723                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9724                 CHECK_ACCESS(txdata_conv_28_ptr);
9725                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9726                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9727                 txdata_constr.data[c] = txdata_conv_28_conv;
9728         }
9729         FREE(txdata);
9730         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9731 }
9732
9733 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
9734         void* this_arg_ptr = untag_ptr(this_arg);
9735         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9736         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9737         uint8_t txid_arr[32];
9738         CHECK(txid->arr_len == 32);
9739         memcpy(txid_arr, txid->elems, 32); FREE(txid);
9740         uint8_t (*txid_ref)[32] = &txid_arr;
9741         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
9742 }
9743
9744 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
9745         void* this_arg_ptr = untag_ptr(this_arg);
9746         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9747         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9748         uint8_t header_arr[80];
9749         CHECK(header->arr_len == 80);
9750         memcpy(header_arr, header->elems, 80); FREE(header);
9751         uint8_t (*header_ref)[80] = &header_arr;
9752         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
9753 }
9754
9755 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
9756         void* this_arg_ptr = untag_ptr(this_arg);
9757         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9758         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9759         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
9760         uint64_tArray ret_arr = NULL;
9761         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9762         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9763         for (size_t z = 0; z < ret_var.datalen; z++) {
9764                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
9765                 *ret_conv_25_conv = ret_var.data[z];
9766                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
9767         }
9768         
9769         FREE(ret_var.data);
9770         return ret_arr;
9771 }
9772
9773 typedef struct LDKPersist_JCalls {
9774         atomic_size_t refcnt;
9775         uint32_t instance_ptr;
9776 } LDKPersist_JCalls;
9777 static void LDKPersist_JCalls_free(void* this_arg) {
9778         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9779         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9780                 FREE(j_calls);
9781         }
9782 }
9783 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9784         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9785         LDKOutPoint channel_id_var = channel_id;
9786         uint64_t channel_id_ref = 0;
9787         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9788         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9789         LDKChannelMonitor data_var = *data;
9790         uint64_t data_ref = 0;
9791         data_var = ChannelMonitor_clone(&data_var);
9792         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9793         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9794         LDKMonitorUpdateId update_id_var = update_id;
9795         uint64_t update_id_ref = 0;
9796         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9797         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9798         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 65, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
9799         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9800         return ret_conv;
9801 }
9802 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9803         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9804         LDKOutPoint channel_id_var = channel_id;
9805         uint64_t channel_id_ref = 0;
9806         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9807         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9808         LDKChannelMonitorUpdate update_var = update;
9809         uint64_t update_ref = 0;
9810         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9811         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
9812         LDKChannelMonitor data_var = *data;
9813         uint64_t data_ref = 0;
9814         data_var = ChannelMonitor_clone(&data_var);
9815         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9816         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9817         LDKMonitorUpdateId update_id_var = update_id;
9818         uint64_t update_id_ref = 0;
9819         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9820         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9821         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 66, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
9822         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9823         return ret_conv;
9824 }
9825 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9826         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9827         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9828 }
9829 static inline LDKPersist LDKPersist_init (JSValue o) {
9830         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9831         atomic_init(&calls->refcnt, 1);
9832         calls->instance_ptr = o;
9833
9834         LDKPersist ret = {
9835                 .this_arg = (void*) calls,
9836                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9837                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9838                 .free = LDKPersist_JCalls_free,
9839         };
9840         return ret;
9841 }
9842 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9843         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9844         *res_ptr = LDKPersist_init(o);
9845         return tag_ptr(res_ptr, true);
9846 }
9847 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) {
9848         void* this_arg_ptr = untag_ptr(this_arg);
9849         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9850         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9851         LDKOutPoint channel_id_conv;
9852         channel_id_conv.inner = untag_ptr(channel_id);
9853         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9854         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9855         channel_id_conv = OutPoint_clone(&channel_id_conv);
9856         LDKChannelMonitor data_conv;
9857         data_conv.inner = untag_ptr(data);
9858         data_conv.is_owned = ptr_is_owned(data);
9859         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9860         data_conv.is_owned = false;
9861         LDKMonitorUpdateId update_id_conv;
9862         update_id_conv.inner = untag_ptr(update_id);
9863         update_id_conv.is_owned = ptr_is_owned(update_id);
9864         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9865         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9866         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));
9867         return ret_conv;
9868 }
9869
9870 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) {
9871         void* this_arg_ptr = untag_ptr(this_arg);
9872         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9873         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9874         LDKOutPoint channel_id_conv;
9875         channel_id_conv.inner = untag_ptr(channel_id);
9876         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9877         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9878         channel_id_conv = OutPoint_clone(&channel_id_conv);
9879         LDKChannelMonitorUpdate update_conv;
9880         update_conv.inner = untag_ptr(update);
9881         update_conv.is_owned = ptr_is_owned(update);
9882         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9883         update_conv = ChannelMonitorUpdate_clone(&update_conv);
9884         LDKChannelMonitor data_conv;
9885         data_conv.inner = untag_ptr(data);
9886         data_conv.is_owned = ptr_is_owned(data);
9887         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9888         data_conv.is_owned = false;
9889         LDKMonitorUpdateId update_id_conv;
9890         update_id_conv.inner = untag_ptr(update_id);
9891         update_id_conv.is_owned = ptr_is_owned(update_id);
9892         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9893         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9894         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));
9895         return ret_conv;
9896 }
9897
9898 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
9899         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
9900         switch(obj->tag) {
9901                 case LDKRetry_Attempts: return 0;
9902                 default: abort();
9903         }
9904 }
9905 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
9906         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
9907         assert(obj->tag == LDKRetry_Attempts);
9908                         uint32_t attempts_conv = obj->attempts;
9909         return attempts_conv;
9910 }
9911 typedef struct LDKChannelMessageHandler_JCalls {
9912         atomic_size_t refcnt;
9913         uint32_t instance_ptr;
9914         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9915 } LDKChannelMessageHandler_JCalls;
9916 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9917         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9918         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9919                 FREE(j_calls);
9920         }
9921 }
9922 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
9923         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9924         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9925         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9926         LDKOpenChannel msg_var = *msg;
9927         uint64_t msg_ref = 0;
9928         msg_var = OpenChannel_clone(&msg_var);
9929         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9930         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9931         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9932 }
9933 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
9934         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9935         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9936         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9937         LDKAcceptChannel msg_var = *msg;
9938         uint64_t msg_ref = 0;
9939         msg_var = AcceptChannel_clone(&msg_var);
9940         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9941         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9942         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9943 }
9944 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9945         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9946         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9947         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9948         LDKFundingCreated msg_var = *msg;
9949         uint64_t msg_ref = 0;
9950         msg_var = FundingCreated_clone(&msg_var);
9951         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9952         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9953         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9954 }
9955 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9956         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9957         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9958         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9959         LDKFundingSigned msg_var = *msg;
9960         uint64_t msg_ref = 0;
9961         msg_var = FundingSigned_clone(&msg_var);
9962         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9963         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9964         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9965 }
9966 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9967         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9968         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9969         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9970         LDKChannelReady msg_var = *msg;
9971         uint64_t msg_ref = 0;
9972         msg_var = ChannelReady_clone(&msg_var);
9973         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9974         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9975         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9976 }
9977 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
9978         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9979         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9980         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9981         LDKShutdown msg_var = *msg;
9982         uint64_t msg_ref = 0;
9983         msg_var = Shutdown_clone(&msg_var);
9984         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9985         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9986         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9987 }
9988 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9989         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9990         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9991         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9992         LDKClosingSigned msg_var = *msg;
9993         uint64_t msg_ref = 0;
9994         msg_var = ClosingSigned_clone(&msg_var);
9995         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9996         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9997         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9998 }
9999 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
10000         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10001         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10002         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10003         LDKUpdateAddHTLC msg_var = *msg;
10004         uint64_t msg_ref = 0;
10005         msg_var = UpdateAddHTLC_clone(&msg_var);
10006         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10007         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10008         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10009 }
10010 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
10011         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10012         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10013         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10014         LDKUpdateFulfillHTLC msg_var = *msg;
10015         uint64_t msg_ref = 0;
10016         msg_var = UpdateFulfillHTLC_clone(&msg_var);
10017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10018         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10019         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10020 }
10021 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
10022         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10023         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10024         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10025         LDKUpdateFailHTLC msg_var = *msg;
10026         uint64_t msg_ref = 0;
10027         msg_var = UpdateFailHTLC_clone(&msg_var);
10028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10029         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10030         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10031 }
10032 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
10033         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10034         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10035         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10036         LDKUpdateFailMalformedHTLC msg_var = *msg;
10037         uint64_t msg_ref = 0;
10038         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
10039         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10040         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10041         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10042 }
10043 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
10044         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10045         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10046         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10047         LDKCommitmentSigned msg_var = *msg;
10048         uint64_t msg_ref = 0;
10049         msg_var = CommitmentSigned_clone(&msg_var);
10050         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10051         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10052         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10053 }
10054 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
10055         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10056         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10057         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10058         LDKRevokeAndACK msg_var = *msg;
10059         uint64_t msg_ref = 0;
10060         msg_var = RevokeAndACK_clone(&msg_var);
10061         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10062         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10063         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10064 }
10065 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
10066         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10067         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10068         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10069         LDKUpdateFee msg_var = *msg;
10070         uint64_t msg_ref = 0;
10071         msg_var = UpdateFee_clone(&msg_var);
10072         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10073         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10074         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10075 }
10076 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
10077         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10078         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10079         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10080         LDKAnnouncementSignatures msg_var = *msg;
10081         uint64_t msg_ref = 0;
10082         msg_var = AnnouncementSignatures_clone(&msg_var);
10083         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10084         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10085         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10086 }
10087 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10088         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10089         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10090         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10091         js_invoke_function_uuuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10092 }
10093 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
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         LDKInit msg_var = *msg;
10098         uint64_t msg_ref = 0;
10099         msg_var = Init_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         jboolean inbound_conv = inbound;
10103         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0);
10104         void* ret_ptr = untag_ptr(ret);
10105         CHECK_ACCESS(ret_ptr);
10106         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10107         FREE(untag_ptr(ret));
10108         return ret_conv;
10109 }
10110 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
10111         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10112         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10113         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10114         LDKChannelReestablish msg_var = *msg;
10115         uint64_t msg_ref = 0;
10116         msg_var = ChannelReestablish_clone(&msg_var);
10117         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10118         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10119         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10120 }
10121 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
10122         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10123         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10124         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10125         LDKChannelUpdate msg_var = *msg;
10126         uint64_t msg_ref = 0;
10127         msg_var = ChannelUpdate_clone(&msg_var);
10128         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10129         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10130         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10131 }
10132 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
10133         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10134         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10135         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10136         LDKErrorMessage msg_var = *msg;
10137         uint64_t msg_ref = 0;
10138         msg_var = ErrorMessage_clone(&msg_var);
10139         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10140         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10141         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10142 }
10143 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
10144         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10145         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 87, 0, 0, 0, 0, 0, 0);
10146         LDKNodeFeatures ret_conv;
10147         ret_conv.inner = untag_ptr(ret);
10148         ret_conv.is_owned = ptr_is_owned(ret);
10149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10150         return ret_conv;
10151 }
10152 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10153         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10154         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10155         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10156         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10157         LDKInitFeatures ret_conv;
10158         ret_conv.inner = untag_ptr(ret);
10159         ret_conv.is_owned = ptr_is_owned(ret);
10160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10161         return ret_conv;
10162 }
10163 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
10164         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
10165         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10166         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10167 }
10168 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10169         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
10170         atomic_init(&calls->refcnt, 1);
10171         calls->instance_ptr = o;
10172
10173         LDKChannelMessageHandler ret = {
10174                 .this_arg = (void*) calls,
10175                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
10176                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
10177                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
10178                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
10179                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
10180                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
10181                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
10182                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
10183                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
10184                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
10185                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
10186                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
10187                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
10188                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
10189                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
10190                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
10191                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
10192                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
10193                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
10194                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
10195                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
10196                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
10197                 .free = LDKChannelMessageHandler_JCalls_free,
10198                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10199         };
10200         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10201         return ret;
10202 }
10203 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10204         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
10205         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
10206         return tag_ptr(res_ptr, true);
10207 }
10208 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) {
10209         void* this_arg_ptr = untag_ptr(this_arg);
10210         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10211         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10212         LDKPublicKey their_node_id_ref;
10213         CHECK(their_node_id->arr_len == 33);
10214         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10215         LDKOpenChannel msg_conv;
10216         msg_conv.inner = untag_ptr(msg);
10217         msg_conv.is_owned = ptr_is_owned(msg);
10218         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10219         msg_conv.is_owned = false;
10220         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10221 }
10222
10223 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) {
10224         void* this_arg_ptr = untag_ptr(this_arg);
10225         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10226         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10227         LDKPublicKey their_node_id_ref;
10228         CHECK(their_node_id->arr_len == 33);
10229         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10230         LDKAcceptChannel msg_conv;
10231         msg_conv.inner = untag_ptr(msg);
10232         msg_conv.is_owned = ptr_is_owned(msg);
10233         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10234         msg_conv.is_owned = false;
10235         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10236 }
10237
10238 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) {
10239         void* this_arg_ptr = untag_ptr(this_arg);
10240         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10241         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10242         LDKPublicKey their_node_id_ref;
10243         CHECK(their_node_id->arr_len == 33);
10244         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10245         LDKFundingCreated msg_conv;
10246         msg_conv.inner = untag_ptr(msg);
10247         msg_conv.is_owned = ptr_is_owned(msg);
10248         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10249         msg_conv.is_owned = false;
10250         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10251 }
10252
10253 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) {
10254         void* this_arg_ptr = untag_ptr(this_arg);
10255         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10256         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10257         LDKPublicKey their_node_id_ref;
10258         CHECK(their_node_id->arr_len == 33);
10259         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10260         LDKFundingSigned msg_conv;
10261         msg_conv.inner = untag_ptr(msg);
10262         msg_conv.is_owned = ptr_is_owned(msg);
10263         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10264         msg_conv.is_owned = false;
10265         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10266 }
10267
10268 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) {
10269         void* this_arg_ptr = untag_ptr(this_arg);
10270         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10271         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10272         LDKPublicKey their_node_id_ref;
10273         CHECK(their_node_id->arr_len == 33);
10274         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10275         LDKChannelReady msg_conv;
10276         msg_conv.inner = untag_ptr(msg);
10277         msg_conv.is_owned = ptr_is_owned(msg);
10278         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10279         msg_conv.is_owned = false;
10280         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10281 }
10282
10283 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10284         void* this_arg_ptr = untag_ptr(this_arg);
10285         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10286         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10287         LDKPublicKey their_node_id_ref;
10288         CHECK(their_node_id->arr_len == 33);
10289         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10290         LDKShutdown msg_conv;
10291         msg_conv.inner = untag_ptr(msg);
10292         msg_conv.is_owned = ptr_is_owned(msg);
10293         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10294         msg_conv.is_owned = false;
10295         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10296 }
10297
10298 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) {
10299         void* this_arg_ptr = untag_ptr(this_arg);
10300         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10301         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10302         LDKPublicKey their_node_id_ref;
10303         CHECK(their_node_id->arr_len == 33);
10304         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10305         LDKClosingSigned msg_conv;
10306         msg_conv.inner = untag_ptr(msg);
10307         msg_conv.is_owned = ptr_is_owned(msg);
10308         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10309         msg_conv.is_owned = false;
10310         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10311 }
10312
10313 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) {
10314         void* this_arg_ptr = untag_ptr(this_arg);
10315         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10316         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10317         LDKPublicKey their_node_id_ref;
10318         CHECK(their_node_id->arr_len == 33);
10319         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10320         LDKUpdateAddHTLC msg_conv;
10321         msg_conv.inner = untag_ptr(msg);
10322         msg_conv.is_owned = ptr_is_owned(msg);
10323         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10324         msg_conv.is_owned = false;
10325         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10326 }
10327
10328 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) {
10329         void* this_arg_ptr = untag_ptr(this_arg);
10330         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10331         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10332         LDKPublicKey their_node_id_ref;
10333         CHECK(their_node_id->arr_len == 33);
10334         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10335         LDKUpdateFulfillHTLC msg_conv;
10336         msg_conv.inner = untag_ptr(msg);
10337         msg_conv.is_owned = ptr_is_owned(msg);
10338         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10339         msg_conv.is_owned = false;
10340         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10341 }
10342
10343 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) {
10344         void* this_arg_ptr = untag_ptr(this_arg);
10345         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10346         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10347         LDKPublicKey their_node_id_ref;
10348         CHECK(their_node_id->arr_len == 33);
10349         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10350         LDKUpdateFailHTLC msg_conv;
10351         msg_conv.inner = untag_ptr(msg);
10352         msg_conv.is_owned = ptr_is_owned(msg);
10353         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10354         msg_conv.is_owned = false;
10355         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10356 }
10357
10358 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) {
10359         void* this_arg_ptr = untag_ptr(this_arg);
10360         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10361         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10362         LDKPublicKey their_node_id_ref;
10363         CHECK(their_node_id->arr_len == 33);
10364         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10365         LDKUpdateFailMalformedHTLC msg_conv;
10366         msg_conv.inner = untag_ptr(msg);
10367         msg_conv.is_owned = ptr_is_owned(msg);
10368         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10369         msg_conv.is_owned = false;
10370         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10371 }
10372
10373 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) {
10374         void* this_arg_ptr = untag_ptr(this_arg);
10375         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10376         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10377         LDKPublicKey their_node_id_ref;
10378         CHECK(their_node_id->arr_len == 33);
10379         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10380         LDKCommitmentSigned msg_conv;
10381         msg_conv.inner = untag_ptr(msg);
10382         msg_conv.is_owned = ptr_is_owned(msg);
10383         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10384         msg_conv.is_owned = false;
10385         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10386 }
10387
10388 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) {
10389         void* this_arg_ptr = untag_ptr(this_arg);
10390         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10391         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10392         LDKPublicKey their_node_id_ref;
10393         CHECK(their_node_id->arr_len == 33);
10394         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10395         LDKRevokeAndACK msg_conv;
10396         msg_conv.inner = untag_ptr(msg);
10397         msg_conv.is_owned = ptr_is_owned(msg);
10398         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10399         msg_conv.is_owned = false;
10400         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10401 }
10402
10403 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) {
10404         void* this_arg_ptr = untag_ptr(this_arg);
10405         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10406         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10407         LDKPublicKey their_node_id_ref;
10408         CHECK(their_node_id->arr_len == 33);
10409         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10410         LDKUpdateFee msg_conv;
10411         msg_conv.inner = untag_ptr(msg);
10412         msg_conv.is_owned = ptr_is_owned(msg);
10413         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10414         msg_conv.is_owned = false;
10415         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10416 }
10417
10418 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) {
10419         void* this_arg_ptr = untag_ptr(this_arg);
10420         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10421         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10422         LDKPublicKey their_node_id_ref;
10423         CHECK(their_node_id->arr_len == 33);
10424         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10425         LDKAnnouncementSignatures msg_conv;
10426         msg_conv.inner = untag_ptr(msg);
10427         msg_conv.is_owned = ptr_is_owned(msg);
10428         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10429         msg_conv.is_owned = false;
10430         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10431 }
10432
10433 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
10434         void* this_arg_ptr = untag_ptr(this_arg);
10435         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10436         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10437         LDKPublicKey their_node_id_ref;
10438         CHECK(their_node_id->arr_len == 33);
10439         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10440         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
10441 }
10442
10443 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) {
10444         void* this_arg_ptr = untag_ptr(this_arg);
10445         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10446         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10447         LDKPublicKey their_node_id_ref;
10448         CHECK(their_node_id->arr_len == 33);
10449         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10450         LDKInit msg_conv;
10451         msg_conv.inner = untag_ptr(msg);
10452         msg_conv.is_owned = ptr_is_owned(msg);
10453         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10454         msg_conv.is_owned = false;
10455         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10456         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
10457         return tag_ptr(ret_conv, true);
10458 }
10459
10460 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) {
10461         void* this_arg_ptr = untag_ptr(this_arg);
10462         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10463         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10464         LDKPublicKey their_node_id_ref;
10465         CHECK(their_node_id->arr_len == 33);
10466         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10467         LDKChannelReestablish msg_conv;
10468         msg_conv.inner = untag_ptr(msg);
10469         msg_conv.is_owned = ptr_is_owned(msg);
10470         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10471         msg_conv.is_owned = false;
10472         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10473 }
10474
10475 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) {
10476         void* this_arg_ptr = untag_ptr(this_arg);
10477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10478         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10479         LDKPublicKey their_node_id_ref;
10480         CHECK(their_node_id->arr_len == 33);
10481         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10482         LDKChannelUpdate msg_conv;
10483         msg_conv.inner = untag_ptr(msg);
10484         msg_conv.is_owned = ptr_is_owned(msg);
10485         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10486         msg_conv.is_owned = false;
10487         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10488 }
10489
10490 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10491         void* this_arg_ptr = untag_ptr(this_arg);
10492         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10493         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10494         LDKPublicKey their_node_id_ref;
10495         CHECK(their_node_id->arr_len == 33);
10496         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10497         LDKErrorMessage msg_conv;
10498         msg_conv.inner = untag_ptr(msg);
10499         msg_conv.is_owned = ptr_is_owned(msg);
10500         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10501         msg_conv.is_owned = false;
10502         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10503 }
10504
10505 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
10506         void* this_arg_ptr = untag_ptr(this_arg);
10507         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10508         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10509         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10510         uint64_t ret_ref = 0;
10511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10513         return ret_ref;
10514 }
10515
10516 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10517         void* this_arg_ptr = untag_ptr(this_arg);
10518         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10519         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10520         LDKPublicKey their_node_id_ref;
10521         CHECK(their_node_id->arr_len == 33);
10522         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10523         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10524         uint64_t ret_ref = 0;
10525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10527         return ret_ref;
10528 }
10529
10530 typedef struct LDKRoutingMessageHandler_JCalls {
10531         atomic_size_t refcnt;
10532         uint32_t instance_ptr;
10533         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10534 } LDKRoutingMessageHandler_JCalls;
10535 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
10536         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10537         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10538                 FREE(j_calls);
10539         }
10540 }
10541 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
10542         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10543         LDKNodeAnnouncement msg_var = *msg;
10544         uint64_t msg_ref = 0;
10545         msg_var = NodeAnnouncement_clone(&msg_var);
10546         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10547         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10548         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, msg_ref, 0, 0, 0, 0, 0);
10549         void* ret_ptr = untag_ptr(ret);
10550         CHECK_ACCESS(ret_ptr);
10551         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10552         FREE(untag_ptr(ret));
10553         return ret_conv;
10554 }
10555 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
10556         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10557         LDKChannelAnnouncement msg_var = *msg;
10558         uint64_t msg_ref = 0;
10559         msg_var = ChannelAnnouncement_clone(&msg_var);
10560         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10561         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10562         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 90, msg_ref, 0, 0, 0, 0, 0);
10563         void* ret_ptr = untag_ptr(ret);
10564         CHECK_ACCESS(ret_ptr);
10565         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10566         FREE(untag_ptr(ret));
10567         return ret_conv;
10568 }
10569 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
10570         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10571         LDKChannelUpdate msg_var = *msg;
10572         uint64_t msg_ref = 0;
10573         msg_var = ChannelUpdate_clone(&msg_var);
10574         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10575         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10576         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 91, msg_ref, 0, 0, 0, 0, 0);
10577         void* ret_ptr = untag_ptr(ret);
10578         CHECK_ACCESS(ret_ptr);
10579         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10580         FREE(untag_ptr(ret));
10581         return ret_conv;
10582 }
10583 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
10584         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10585         int64_t starting_point_conv = starting_point;
10586         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 92, starting_point_conv, 0, 0, 0, 0, 0);
10587         void* ret_ptr = untag_ptr(ret);
10588         CHECK_ACCESS(ret_ptr);
10589         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
10590         FREE(untag_ptr(ret));
10591         return ret_conv;
10592 }
10593 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
10594         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10595         LDKNodeId starting_point_var = starting_point;
10596         uint64_t starting_point_ref = 0;
10597         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
10598         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
10599         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 93, starting_point_ref, 0, 0, 0, 0, 0);
10600         LDKNodeAnnouncement ret_conv;
10601         ret_conv.inner = untag_ptr(ret);
10602         ret_conv.is_owned = ptr_is_owned(ret);
10603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10604         return ret_conv;
10605 }
10606 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
10607         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10608         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10609         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10610         LDKInit init_var = *init;
10611         uint64_t init_ref = 0;
10612         init_var = Init_clone(&init_var);
10613         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10614         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10615         jboolean inbound_conv = inbound;
10616         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
10617         void* ret_ptr = untag_ptr(ret);
10618         CHECK_ACCESS(ret_ptr);
10619         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10620         FREE(untag_ptr(ret));
10621         return ret_conv;
10622 }
10623 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
10624         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10625         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10626         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10627         LDKReplyChannelRange msg_var = msg;
10628         uint64_t msg_ref = 0;
10629         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10630         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10631         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10632         void* ret_ptr = untag_ptr(ret);
10633         CHECK_ACCESS(ret_ptr);
10634         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10635         FREE(untag_ptr(ret));
10636         return ret_conv;
10637 }
10638 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
10639         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10640         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10641         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10642         LDKReplyShortChannelIdsEnd msg_var = msg;
10643         uint64_t msg_ref = 0;
10644         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10645         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10646         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10647         void* ret_ptr = untag_ptr(ret);
10648         CHECK_ACCESS(ret_ptr);
10649         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10650         FREE(untag_ptr(ret));
10651         return ret_conv;
10652 }
10653 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
10654         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10655         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10656         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10657         LDKQueryChannelRange msg_var = msg;
10658         uint64_t msg_ref = 0;
10659         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10660         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10661         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10662         void* ret_ptr = untag_ptr(ret);
10663         CHECK_ACCESS(ret_ptr);
10664         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10665         FREE(untag_ptr(ret));
10666         return ret_conv;
10667 }
10668 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
10669         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10670         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10671         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10672         LDKQueryShortChannelIds msg_var = msg;
10673         uint64_t msg_ref = 0;
10674         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10675         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10676         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10677         void* ret_ptr = untag_ptr(ret);
10678         CHECK_ACCESS(ret_ptr);
10679         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10680         FREE(untag_ptr(ret));
10681         return ret_conv;
10682 }
10683 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10684         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10685         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, 0, 0, 0, 0, 0, 0);
10686 }
10687 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10688         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10689         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, 0, 0, 0, 0, 0, 0);
10690         LDKNodeFeatures ret_conv;
10691         ret_conv.inner = untag_ptr(ret);
10692         ret_conv.is_owned = ptr_is_owned(ret);
10693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10694         return ret_conv;
10695 }
10696 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10697         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10698         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10699         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10700         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10701         LDKInitFeatures ret_conv;
10702         ret_conv.inner = untag_ptr(ret);
10703         ret_conv.is_owned = ptr_is_owned(ret);
10704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10705         return ret_conv;
10706 }
10707 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
10708         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
10709         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10710         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10711 }
10712 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10713         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
10714         atomic_init(&calls->refcnt, 1);
10715         calls->instance_ptr = o;
10716
10717         LDKRoutingMessageHandler ret = {
10718                 .this_arg = (void*) calls,
10719                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
10720                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
10721                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
10722                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
10723                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
10724                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
10725                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
10726                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
10727                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
10728                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
10729                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
10730                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
10731                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
10732                 .free = LDKRoutingMessageHandler_JCalls_free,
10733                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10734         };
10735         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10736         return ret;
10737 }
10738 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10739         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10740         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
10741         return tag_ptr(res_ptr, true);
10742 }
10743 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
10744         void* this_arg_ptr = untag_ptr(this_arg);
10745         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10746         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10747         LDKNodeAnnouncement msg_conv;
10748         msg_conv.inner = untag_ptr(msg);
10749         msg_conv.is_owned = ptr_is_owned(msg);
10750         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10751         msg_conv.is_owned = false;
10752         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10753         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10754         return tag_ptr(ret_conv, true);
10755 }
10756
10757 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
10758         void* this_arg_ptr = untag_ptr(this_arg);
10759         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10760         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10761         LDKChannelAnnouncement msg_conv;
10762         msg_conv.inner = untag_ptr(msg);
10763         msg_conv.is_owned = ptr_is_owned(msg);
10764         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10765         msg_conv.is_owned = false;
10766         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10767         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10768         return tag_ptr(ret_conv, true);
10769 }
10770
10771 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
10772         void* this_arg_ptr = untag_ptr(this_arg);
10773         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10774         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10775         LDKChannelUpdate msg_conv;
10776         msg_conv.inner = untag_ptr(msg);
10777         msg_conv.is_owned = ptr_is_owned(msg);
10778         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10779         msg_conv.is_owned = false;
10780         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10781         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10782         return tag_ptr(ret_conv, true);
10783 }
10784
10785 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) {
10786         void* this_arg_ptr = untag_ptr(this_arg);
10787         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10788         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10789         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
10790         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
10791         uint64_t ret_ref = tag_ptr(ret_copy, true);
10792         return ret_ref;
10793 }
10794
10795 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) {
10796         void* this_arg_ptr = untag_ptr(this_arg);
10797         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10798         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10799         LDKNodeId starting_point_conv;
10800         starting_point_conv.inner = untag_ptr(starting_point);
10801         starting_point_conv.is_owned = ptr_is_owned(starting_point);
10802         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
10803         starting_point_conv = NodeId_clone(&starting_point_conv);
10804         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
10805         uint64_t ret_ref = 0;
10806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10808         return ret_ref;
10809 }
10810
10811 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) {
10812         void* this_arg_ptr = untag_ptr(this_arg);
10813         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10814         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10815         LDKPublicKey their_node_id_ref;
10816         CHECK(their_node_id->arr_len == 33);
10817         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10818         LDKInit init_conv;
10819         init_conv.inner = untag_ptr(init);
10820         init_conv.is_owned = ptr_is_owned(init);
10821         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10822         init_conv.is_owned = false;
10823         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10824         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
10825         return tag_ptr(ret_conv, true);
10826 }
10827
10828 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) {
10829         void* this_arg_ptr = untag_ptr(this_arg);
10830         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10831         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10832         LDKPublicKey their_node_id_ref;
10833         CHECK(their_node_id->arr_len == 33);
10834         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10835         LDKReplyChannelRange msg_conv;
10836         msg_conv.inner = untag_ptr(msg);
10837         msg_conv.is_owned = ptr_is_owned(msg);
10838         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10839         msg_conv = ReplyChannelRange_clone(&msg_conv);
10840         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10841         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10842         return tag_ptr(ret_conv, true);
10843 }
10844
10845 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) {
10846         void* this_arg_ptr = untag_ptr(this_arg);
10847         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10848         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10849         LDKPublicKey their_node_id_ref;
10850         CHECK(their_node_id->arr_len == 33);
10851         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10852         LDKReplyShortChannelIdsEnd msg_conv;
10853         msg_conv.inner = untag_ptr(msg);
10854         msg_conv.is_owned = ptr_is_owned(msg);
10855         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10856         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10857         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10858         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10859         return tag_ptr(ret_conv, true);
10860 }
10861
10862 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) {
10863         void* this_arg_ptr = untag_ptr(this_arg);
10864         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10865         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10866         LDKPublicKey their_node_id_ref;
10867         CHECK(their_node_id->arr_len == 33);
10868         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10869         LDKQueryChannelRange msg_conv;
10870         msg_conv.inner = untag_ptr(msg);
10871         msg_conv.is_owned = ptr_is_owned(msg);
10872         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10873         msg_conv = QueryChannelRange_clone(&msg_conv);
10874         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10875         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10876         return tag_ptr(ret_conv, true);
10877 }
10878
10879 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) {
10880         void* this_arg_ptr = untag_ptr(this_arg);
10881         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10882         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10883         LDKPublicKey their_node_id_ref;
10884         CHECK(their_node_id->arr_len == 33);
10885         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10886         LDKQueryShortChannelIds msg_conv;
10887         msg_conv.inner = untag_ptr(msg);
10888         msg_conv.is_owned = ptr_is_owned(msg);
10889         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10890         msg_conv = QueryShortChannelIds_clone(&msg_conv);
10891         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10892         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10893         return tag_ptr(ret_conv, true);
10894 }
10895
10896 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
10897         void* this_arg_ptr = untag_ptr(this_arg);
10898         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10899         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10900         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
10901         return ret_conv;
10902 }
10903
10904 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
10905         void* this_arg_ptr = untag_ptr(this_arg);
10906         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10907         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10908         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10909         uint64_t ret_ref = 0;
10910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10912         return ret_ref;
10913 }
10914
10915 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10916         void* this_arg_ptr = untag_ptr(this_arg);
10917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10918         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10919         LDKPublicKey their_node_id_ref;
10920         CHECK(their_node_id->arr_len == 33);
10921         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10922         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10923         uint64_t ret_ref = 0;
10924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10926         return ret_ref;
10927 }
10928
10929 typedef struct LDKOnionMessageHandler_JCalls {
10930         atomic_size_t refcnt;
10931         uint32_t instance_ptr;
10932         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
10933 } LDKOnionMessageHandler_JCalls;
10934 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
10935         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10936         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10937                 FREE(j_calls);
10938         }
10939 }
10940 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
10941         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10942         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
10943         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
10944         LDKOnionMessage msg_var = *msg;
10945         uint64_t msg_ref = 0;
10946         msg_var = OnionMessage_clone(&msg_var);
10947         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10948         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10949         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
10950 }
10951 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
10952         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10953         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10954         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10955         LDKInit init_var = *init;
10956         uint64_t init_ref = 0;
10957         init_var = Init_clone(&init_var);
10958         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10959         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10960         jboolean inbound_conv = inbound;
10961         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);
10962         void* ret_ptr = untag_ptr(ret);
10963         CHECK_ACCESS(ret_ptr);
10964         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10965         FREE(untag_ptr(ret));
10966         return ret_conv;
10967 }
10968 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10969         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10970         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10971         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10972         js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10973 }
10974 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
10975         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10976         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0);
10977         LDKNodeFeatures ret_conv;
10978         ret_conv.inner = untag_ptr(ret);
10979         ret_conv.is_owned = ptr_is_owned(ret);
10980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10981         return ret_conv;
10982 }
10983 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10984         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10985         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10986         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10987         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10988         LDKInitFeatures ret_conv;
10989         ret_conv.inner = untag_ptr(ret);
10990         ret_conv.is_owned = ptr_is_owned(ret);
10991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10992         return ret_conv;
10993 }
10994 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
10995         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
10996         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10997         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
10998 }
10999 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
11000         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
11001         atomic_init(&calls->refcnt, 1);
11002         calls->instance_ptr = o;
11003
11004         LDKOnionMessageHandler ret = {
11005                 .this_arg = (void*) calls,
11006                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
11007                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
11008                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
11009                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
11010                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
11011                 .free = LDKOnionMessageHandler_JCalls_free,
11012                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
11013         };
11014         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
11015         return ret;
11016 }
11017 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
11018         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
11019         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
11020         return tag_ptr(res_ptr, true);
11021 }
11022 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) {
11023         void* this_arg_ptr = untag_ptr(this_arg);
11024         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11025         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11026         LDKPublicKey peer_node_id_ref;
11027         CHECK(peer_node_id->arr_len == 33);
11028         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
11029         LDKOnionMessage msg_conv;
11030         msg_conv.inner = untag_ptr(msg);
11031         msg_conv.is_owned = ptr_is_owned(msg);
11032         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11033         msg_conv.is_owned = false;
11034         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
11035 }
11036
11037 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) {
11038         void* this_arg_ptr = untag_ptr(this_arg);
11039         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11040         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11041         LDKPublicKey their_node_id_ref;
11042         CHECK(their_node_id->arr_len == 33);
11043         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11044         LDKInit init_conv;
11045         init_conv.inner = untag_ptr(init);
11046         init_conv.is_owned = ptr_is_owned(init);
11047         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
11048         init_conv.is_owned = false;
11049         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11050         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
11051         return tag_ptr(ret_conv, true);
11052 }
11053
11054 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
11055         void* this_arg_ptr = untag_ptr(this_arg);
11056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11057         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11058         LDKPublicKey their_node_id_ref;
11059         CHECK(their_node_id->arr_len == 33);
11060         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11061         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
11062 }
11063
11064 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
11065         void* this_arg_ptr = untag_ptr(this_arg);
11066         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11067         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11068         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
11069         uint64_t ret_ref = 0;
11070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11072         return ret_ref;
11073 }
11074
11075 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
11076         void* this_arg_ptr = untag_ptr(this_arg);
11077         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11078         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11079         LDKPublicKey their_node_id_ref;
11080         CHECK(their_node_id->arr_len == 33);
11081         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11082         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
11083         uint64_t ret_ref = 0;
11084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11086         return ret_ref;
11087 }
11088
11089 typedef struct LDKCustomMessageReader_JCalls {
11090         atomic_size_t refcnt;
11091         uint32_t instance_ptr;
11092 } LDKCustomMessageReader_JCalls;
11093 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
11094         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11095         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11096                 FREE(j_calls);
11097         }
11098 }
11099 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
11100         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11101         int16_t message_type_conv = message_type;
11102         LDKu8slice buffer_var = buffer;
11103         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
11104         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
11105         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 107, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
11106         void* ret_ptr = untag_ptr(ret);
11107         CHECK_ACCESS(ret_ptr);
11108         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
11109         FREE(untag_ptr(ret));
11110         return ret_conv;
11111 }
11112 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
11113         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
11114         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11115 }
11116 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
11117         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
11118         atomic_init(&calls->refcnt, 1);
11119         calls->instance_ptr = o;
11120
11121         LDKCustomMessageReader ret = {
11122                 .this_arg = (void*) calls,
11123                 .read = read_LDKCustomMessageReader_jcall,
11124                 .free = LDKCustomMessageReader_JCalls_free,
11125         };
11126         return ret;
11127 }
11128 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
11129         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
11130         *res_ptr = LDKCustomMessageReader_init(o);
11131         return tag_ptr(res_ptr, true);
11132 }
11133 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
11134         void* this_arg_ptr = untag_ptr(this_arg);
11135         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11136         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
11137         LDKu8slice buffer_ref;
11138         buffer_ref.datalen = buffer->arr_len;
11139         buffer_ref.data = buffer->elems;
11140         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11141         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
11142         FREE(buffer);
11143         return tag_ptr(ret_conv, true);
11144 }
11145
11146 typedef struct LDKCustomMessageHandler_JCalls {
11147         atomic_size_t refcnt;
11148         uint32_t instance_ptr;
11149         LDKCustomMessageReader_JCalls* CustomMessageReader;
11150 } LDKCustomMessageHandler_JCalls;
11151 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
11152         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11153         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11154                 FREE(j_calls);
11155         }
11156 }
11157 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
11158         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11159         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
11160         *msg_ret = msg;
11161         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
11162         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
11163         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);
11164         void* ret_ptr = untag_ptr(ret);
11165         CHECK_ACCESS(ret_ptr);
11166         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11167         FREE(untag_ptr(ret));
11168         return ret_conv;
11169 }
11170 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
11171         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11172         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, 0, 0, 0, 0, 0, 0);
11173         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
11174         ret_constr.datalen = ret->arr_len;
11175         if (ret_constr.datalen > 0)
11176                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11177         else
11178                 ret_constr.data = NULL;
11179         uint64_t* ret_vals = ret->elems;
11180         for (size_t z = 0; z < ret_constr.datalen; z++) {
11181                 uint64_t ret_conv_25 = ret_vals[z];
11182                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
11183                 CHECK_ACCESS(ret_conv_25_ptr);
11184                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
11185                 FREE(untag_ptr(ret_conv_25));
11186                 ret_constr.data[z] = ret_conv_25_conv;
11187         }
11188         FREE(ret);
11189         return ret_constr;
11190 }
11191 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
11192         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
11193         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11194         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
11195 }
11196 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
11197         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
11198         atomic_init(&calls->refcnt, 1);
11199         calls->instance_ptr = o;
11200
11201         LDKCustomMessageHandler ret = {
11202                 .this_arg = (void*) calls,
11203                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
11204                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
11205                 .free = LDKCustomMessageHandler_JCalls_free,
11206                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
11207         };
11208         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
11209         return ret;
11210 }
11211 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
11212         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
11213         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
11214         return tag_ptr(res_ptr, true);
11215 }
11216 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) {
11217         void* this_arg_ptr = untag_ptr(this_arg);
11218         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11219         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11220         void* msg_ptr = untag_ptr(msg);
11221         CHECK_ACCESS(msg_ptr);
11222         LDKType msg_conv = *(LDKType*)(msg_ptr);
11223         if (msg_conv.free == LDKType_JCalls_free) {
11224                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11225                 LDKType_JCalls_cloned(&msg_conv);
11226         }
11227         LDKPublicKey sender_node_id_ref;
11228         CHECK(sender_node_id->arr_len == 33);
11229         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
11230         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11231         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
11232         return tag_ptr(ret_conv, true);
11233 }
11234
11235 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
11236         void* this_arg_ptr = untag_ptr(this_arg);
11237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11238         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11239         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
11240         uint64_tArray ret_arr = NULL;
11241         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11242         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11243         for (size_t z = 0; z < ret_var.datalen; z++) {
11244                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11245                 *ret_conv_25_conv = ret_var.data[z];
11246                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
11247         }
11248         
11249         FREE(ret_var.data);
11250         return ret_arr;
11251 }
11252
11253 typedef struct LDKCustomOnionMessageHandler_JCalls {
11254         atomic_size_t refcnt;
11255         uint32_t instance_ptr;
11256 } LDKCustomOnionMessageHandler_JCalls;
11257 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
11258         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11259         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11260                 FREE(j_calls);
11261         }
11262 }
11263 void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
11264         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11265         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11266         *msg_ret = msg;
11267         js_invoke_function_buuuuu(j_calls->instance_ptr, 110, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
11268 }
11269 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
11270         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11271         int64_t message_type_conv = message_type;
11272         LDKu8slice buffer_var = buffer;
11273         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
11274         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
11275         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 111, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
11276         void* ret_ptr = untag_ptr(ret);
11277         CHECK_ACCESS(ret_ptr);
11278         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
11279         FREE(untag_ptr(ret));
11280         return ret_conv;
11281 }
11282 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
11283         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
11284         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11285 }
11286 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
11287         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
11288         atomic_init(&calls->refcnt, 1);
11289         calls->instance_ptr = o;
11290
11291         LDKCustomOnionMessageHandler ret = {
11292                 .this_arg = (void*) calls,
11293                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
11294                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
11295                 .free = LDKCustomOnionMessageHandler_JCalls_free,
11296         };
11297         return ret;
11298 }
11299 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
11300         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
11301         *res_ptr = LDKCustomOnionMessageHandler_init(o);
11302         return tag_ptr(res_ptr, true);
11303 }
11304 void  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
11305         void* this_arg_ptr = untag_ptr(this_arg);
11306         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11307         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
11308         void* msg_ptr = untag_ptr(msg);
11309         CHECK_ACCESS(msg_ptr);
11310         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
11311         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
11312                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11313                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
11314         }
11315         (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
11316 }
11317
11318 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) {
11319         void* this_arg_ptr = untag_ptr(this_arg);
11320         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11321         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
11322         LDKu8slice buffer_ref;
11323         buffer_ref.datalen = buffer->arr_len;
11324         buffer_ref.data = buffer->elems;
11325         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
11326         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
11327         FREE(buffer);
11328         return tag_ptr(ret_conv, true);
11329 }
11330
11331 typedef struct LDKSocketDescriptor_JCalls {
11332         atomic_size_t refcnt;
11333         uint32_t instance_ptr;
11334 } LDKSocketDescriptor_JCalls;
11335 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
11336         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11337         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11338                 FREE(j_calls);
11339         }
11340 }
11341 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
11342         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11343         LDKu8slice data_var = data;
11344         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
11345         memcpy(data_arr->elems, data_var.data, data_var.datalen);
11346         jboolean resume_read_conv = resume_read;
11347         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
11348 }
11349 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
11350         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11351         js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
11352 }
11353 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
11354         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11355         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11356         *other_arg_clone = SocketDescriptor_clone(other_arg);
11357         return js_invoke_function_buuuuu(j_calls->instance_ptr, 114, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
11358 }
11359 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
11360         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11361         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0);
11362 }
11363 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
11364         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
11365         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11366 }
11367 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
11368         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
11369         atomic_init(&calls->refcnt, 1);
11370         calls->instance_ptr = o;
11371
11372         LDKSocketDescriptor ret = {
11373                 .this_arg = (void*) calls,
11374                 .send_data = send_data_LDKSocketDescriptor_jcall,
11375                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
11376                 .eq = eq_LDKSocketDescriptor_jcall,
11377                 .hash = hash_LDKSocketDescriptor_jcall,
11378                 .cloned = LDKSocketDescriptor_JCalls_cloned,
11379                 .free = LDKSocketDescriptor_JCalls_free,
11380         };
11381         return ret;
11382 }
11383 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
11384         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11385         *res_ptr = LDKSocketDescriptor_init(o);
11386         return tag_ptr(res_ptr, true);
11387 }
11388 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
11389         void* this_arg_ptr = untag_ptr(this_arg);
11390         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11391         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11392         LDKu8slice data_ref;
11393         data_ref.datalen = data->arr_len;
11394         data_ref.data = data->elems;
11395         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
11396         FREE(data);
11397         return ret_conv;
11398 }
11399
11400 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
11401         void* this_arg_ptr = untag_ptr(this_arg);
11402         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11403         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11404         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
11405 }
11406
11407 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
11408         void* this_arg_ptr = untag_ptr(this_arg);
11409         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11410         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11411         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
11412         return ret_conv;
11413 }
11414
11415 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
11416         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11417         switch(obj->tag) {
11418                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
11419                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
11420                 case LDKEffectiveCapacity_Total: return 2;
11421                 case LDKEffectiveCapacity_Infinite: return 3;
11422                 case LDKEffectiveCapacity_Unknown: return 4;
11423                 default: abort();
11424         }
11425 }
11426 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
11427         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11428         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
11429                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
11430         return liquidity_msat_conv;
11431 }
11432 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
11433         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11434         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
11435                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
11436         return amount_msat_conv;
11437 }
11438 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
11439         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11440         assert(obj->tag == LDKEffectiveCapacity_Total);
11441                         int64_t capacity_msat_conv = obj->total.capacity_msat;
11442         return capacity_msat_conv;
11443 }
11444 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
11445         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11446         assert(obj->tag == LDKEffectiveCapacity_Total);
11447                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
11448         return htlc_maximum_msat_conv;
11449 }
11450 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
11451         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11452         switch(obj->tag) {
11453                 case LDKDestination_Node: return 0;
11454                 case LDKDestination_BlindedPath: return 1;
11455                 default: abort();
11456         }
11457 }
11458 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
11459         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11460         assert(obj->tag == LDKDestination_Node);
11461                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
11462                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
11463         return node_arr;
11464 }
11465 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
11466         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11467         assert(obj->tag == LDKDestination_BlindedPath);
11468                         LDKBlindedPath blinded_path_var = obj->blinded_path;
11469                         uint64_t blinded_path_ref = 0;
11470                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
11471                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
11472         return blinded_path_ref;
11473 }
11474 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11475         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11476         switch(obj->tag) {
11477                 case LDKOnionMessageContents_Custom: return 0;
11478                 default: abort();
11479         }
11480 }
11481 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11482         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11483         assert(obj->tag == LDKOnionMessageContents_Custom);
11484                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11485                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
11486         return tag_ptr(custom_ret, true);
11487 }
11488 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
11489         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11490         switch(obj->tag) {
11491                 case LDKGossipSync_P2P: return 0;
11492                 case LDKGossipSync_Rapid: return 1;
11493                 case LDKGossipSync_None: return 2;
11494                 default: abort();
11495         }
11496 }
11497 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
11498         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11499         assert(obj->tag == LDKGossipSync_P2P);
11500                         LDKP2PGossipSync p2p_var = obj->p2p;
11501                         uint64_t p2p_ref = 0;
11502                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
11503                         p2p_ref = tag_ptr(p2p_var.inner, false);
11504         return p2p_ref;
11505 }
11506 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
11507         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11508         assert(obj->tag == LDKGossipSync_Rapid);
11509                         LDKRapidGossipSync rapid_var = obj->rapid;
11510                         uint64_t rapid_ref = 0;
11511                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
11512                         rapid_ref = tag_ptr(rapid_var.inner, false);
11513         return rapid_ref;
11514 }
11515 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
11516         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11517         switch(obj->tag) {
11518                 case LDKFallback_SegWitProgram: return 0;
11519                 case LDKFallback_PubKeyHash: return 1;
11520                 case LDKFallback_ScriptHash: return 2;
11521                 default: abort();
11522         }
11523 }
11524 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
11525         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11526         assert(obj->tag == LDKFallback_SegWitProgram);
11527                         uint8_t version_val = obj->seg_wit_program.version._0;
11528         return version_val;
11529 }
11530 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
11531         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11532         assert(obj->tag == LDKFallback_SegWitProgram);
11533                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
11534                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
11535                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
11536         return program_arr;
11537 }
11538 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
11539         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11540         assert(obj->tag == LDKFallback_PubKeyHash);
11541                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
11542                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
11543         return pub_key_hash_arr;
11544 }
11545 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
11546         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11547         assert(obj->tag == LDKFallback_ScriptHash);
11548                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
11549                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
11550         return script_hash_arr;
11551 }
11552 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11553         LDKStr ret_str = _ldk_get_compiled_version();
11554         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11555         Str_free(ret_str);
11556         return ret_conv;
11557 }
11558
11559 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11560         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11561         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11562         Str_free(ret_str);
11563         return ret_conv;
11564 }
11565
11566 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
11567         LDKU128 val_ref;
11568         CHECK(val->arr_len == 16);
11569         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
11570         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11571         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
11572         return ret_arr;
11573 }
11574
11575 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
11576         LDKSixteenBytes le_bytes_ref;
11577         CHECK(le_bytes->arr_len == 16);
11578         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
11579         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11580         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
11581         return ret_arr;
11582 }
11583
11584 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11585         LDKThirtyTwoBytes big_endian_bytes_ref;
11586         CHECK(big_endian_bytes->arr_len == 32);
11587         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11588         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11589         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11590         return tag_ptr(ret_ref, true);
11591 }
11592
11593 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11594         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11595         *ret_copy = Bech32Error_clone(arg);
11596         uint64_t ret_ref = tag_ptr(ret_copy, true);
11597         return ret_ref;
11598 }
11599 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11600         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11601         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11602         return ret_conv;
11603 }
11604
11605 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11606         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11607         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11608         *ret_copy = Bech32Error_clone(orig_conv);
11609         uint64_t ret_ref = tag_ptr(ret_copy, true);
11610         return ret_ref;
11611 }
11612
11613 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11614         if (!ptr_is_owned(o)) return;
11615         void* o_ptr = untag_ptr(o);
11616         CHECK_ACCESS(o_ptr);
11617         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11618         FREE(untag_ptr(o));
11619         Bech32Error_free(o_conv);
11620 }
11621
11622 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11623         LDKTransaction _res_ref;
11624         _res_ref.datalen = _res->arr_len;
11625         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11626         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11627         _res_ref.data_is_owned = true;
11628         Transaction_free(_res_ref);
11629 }
11630
11631 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
11632         LDKWitness _res_ref;
11633         _res_ref.datalen = _res->arr_len;
11634         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
11635         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11636         _res_ref.data_is_owned = true;
11637         Witness_free(_res_ref);
11638 }
11639
11640 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11641         LDKCVec_u8Z script_pubkey_ref;
11642         script_pubkey_ref.datalen = script_pubkey->arr_len;
11643         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11644         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11645         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11646         *ret_ref = TxOut_new(script_pubkey_ref, value);
11647         return tag_ptr(ret_ref, true);
11648 }
11649
11650 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11651         if (!ptr_is_owned(_res)) return;
11652         void* _res_ptr = untag_ptr(_res);
11653         CHECK_ACCESS(_res_ptr);
11654         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11655         FREE(untag_ptr(_res));
11656         TxOut_free(_res_conv);
11657 }
11658
11659 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11660         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11661         *ret_ref = TxOut_clone(arg);
11662         return tag_ptr(ret_ref, true);
11663 }
11664 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11665         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11666         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11667         return ret_conv;
11668 }
11669
11670 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11671         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11672         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11673         *ret_ref = TxOut_clone(orig_conv);
11674         return tag_ptr(ret_ref, true);
11675 }
11676
11677 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11678         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11679         Str_free(dummy);
11680 }
11681
11682 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
11683         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11684         *ret_conv = CResult_NoneAPIErrorZ_ok();
11685         return tag_ptr(ret_conv, true);
11686 }
11687
11688 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
11689         void* e_ptr = untag_ptr(e);
11690         CHECK_ACCESS(e_ptr);
11691         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11692         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
11693         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11694         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
11695         return tag_ptr(ret_conv, true);
11696 }
11697
11698 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
11699         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
11700         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
11701         return ret_conv;
11702 }
11703
11704 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
11705         if (!ptr_is_owned(_res)) return;
11706         void* _res_ptr = untag_ptr(_res);
11707         CHECK_ACCESS(_res_ptr);
11708         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
11709         FREE(untag_ptr(_res));
11710         CResult_NoneAPIErrorZ_free(_res_conv);
11711 }
11712
11713 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
11714         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11715         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
11716         return tag_ptr(ret_conv, true);
11717 }
11718 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
11719         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
11720         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
11721         return ret_conv;
11722 }
11723
11724 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
11725         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
11726         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11727         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
11728         return tag_ptr(ret_conv, true);
11729 }
11730
11731 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
11732         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
11733         _res_constr.datalen = _res->arr_len;
11734         if (_res_constr.datalen > 0)
11735                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
11736         else
11737                 _res_constr.data = NULL;
11738         uint64_t* _res_vals = _res->elems;
11739         for (size_t w = 0; w < _res_constr.datalen; w++) {
11740                 uint64_t _res_conv_22 = _res_vals[w];
11741                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
11742                 CHECK_ACCESS(_res_conv_22_ptr);
11743                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
11744                 FREE(untag_ptr(_res_conv_22));
11745                 _res_constr.data[w] = _res_conv_22_conv;
11746         }
11747         FREE(_res);
11748         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
11749 }
11750
11751 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
11752         LDKCVec_APIErrorZ _res_constr;
11753         _res_constr.datalen = _res->arr_len;
11754         if (_res_constr.datalen > 0)
11755                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
11756         else
11757                 _res_constr.data = NULL;
11758         uint64_t* _res_vals = _res->elems;
11759         for (size_t k = 0; k < _res_constr.datalen; k++) {
11760                 uint64_t _res_conv_10 = _res_vals[k];
11761                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
11762                 CHECK_ACCESS(_res_conv_10_ptr);
11763                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
11764                 FREE(untag_ptr(_res_conv_10));
11765                 _res_constr.data[k] = _res_conv_10_conv;
11766         }
11767         FREE(_res);
11768         CVec_APIErrorZ_free(_res_constr);
11769 }
11770
11771 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
11772         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
11773         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
11774         *ret_copy = COption_HTLCClaimZ_some(o_conv);
11775         uint64_t ret_ref = tag_ptr(ret_copy, true);
11776         return ret_ref;
11777 }
11778
11779 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
11780         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
11781         *ret_copy = COption_HTLCClaimZ_none();
11782         uint64_t ret_ref = tag_ptr(ret_copy, true);
11783         return ret_ref;
11784 }
11785
11786 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
11787         if (!ptr_is_owned(_res)) return;
11788         void* _res_ptr = untag_ptr(_res);
11789         CHECK_ACCESS(_res_ptr);
11790         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
11791         FREE(untag_ptr(_res));
11792         COption_HTLCClaimZ_free(_res_conv);
11793 }
11794
11795 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
11796         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11797         *ret_conv = CResult_NoneNoneZ_ok();
11798         return tag_ptr(ret_conv, true);
11799 }
11800
11801 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11802         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11803         *ret_conv = CResult_NoneNoneZ_err();
11804         return tag_ptr(ret_conv, true);
11805 }
11806
11807 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
11808         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
11809         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11810         return ret_conv;
11811 }
11812
11813 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
11814         if (!ptr_is_owned(_res)) return;
11815         void* _res_ptr = untag_ptr(_res);
11816         CHECK_ACCESS(_res_ptr);
11817         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11818         FREE(untag_ptr(_res));
11819         CResult_NoneNoneZ_free(_res_conv);
11820 }
11821
11822 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11823         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11824         *ret_conv = CResult_NoneNoneZ_clone(arg);
11825         return tag_ptr(ret_conv, true);
11826 }
11827 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
11828         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
11829         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11830         return ret_conv;
11831 }
11832
11833 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
11834         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
11835         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11836         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11837         return tag_ptr(ret_conv, true);
11838 }
11839
11840 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
11841         LDKCounterpartyCommitmentSecrets o_conv;
11842         o_conv.inner = untag_ptr(o);
11843         o_conv.is_owned = ptr_is_owned(o);
11844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11845         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11846         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11847         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11848         return tag_ptr(ret_conv, true);
11849 }
11850
11851 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
11852         void* e_ptr = untag_ptr(e);
11853         CHECK_ACCESS(e_ptr);
11854         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11855         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11856         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11857         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11858         return tag_ptr(ret_conv, true);
11859 }
11860
11861 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
11862         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
11863         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11864         return ret_conv;
11865 }
11866
11867 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
11868         if (!ptr_is_owned(_res)) return;
11869         void* _res_ptr = untag_ptr(_res);
11870         CHECK_ACCESS(_res_ptr);
11871         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11872         FREE(untag_ptr(_res));
11873         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11874 }
11875
11876 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11877         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11878         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11879         return tag_ptr(ret_conv, true);
11880 }
11881 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
11882         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
11883         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11884         return ret_conv;
11885 }
11886
11887 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
11888         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
11889         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11890         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11891         return tag_ptr(ret_conv, true);
11892 }
11893
11894 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
11895         LDKTxCreationKeys o_conv;
11896         o_conv.inner = untag_ptr(o);
11897         o_conv.is_owned = ptr_is_owned(o);
11898         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11899         o_conv = TxCreationKeys_clone(&o_conv);
11900         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11901         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11902         return tag_ptr(ret_conv, true);
11903 }
11904
11905 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
11906         void* e_ptr = untag_ptr(e);
11907         CHECK_ACCESS(e_ptr);
11908         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11909         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11910         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11911         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11912         return tag_ptr(ret_conv, true);
11913 }
11914
11915 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
11916         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
11917         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11918         return ret_conv;
11919 }
11920
11921 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
11922         if (!ptr_is_owned(_res)) return;
11923         void* _res_ptr = untag_ptr(_res);
11924         CHECK_ACCESS(_res_ptr);
11925         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11926         FREE(untag_ptr(_res));
11927         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11928 }
11929
11930 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11931         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11932         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11933         return tag_ptr(ret_conv, true);
11934 }
11935 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11936         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
11937         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11938         return ret_conv;
11939 }
11940
11941 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
11942         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
11943         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11944         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11945         return tag_ptr(ret_conv, true);
11946 }
11947
11948 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
11949         LDKChannelPublicKeys o_conv;
11950         o_conv.inner = untag_ptr(o);
11951         o_conv.is_owned = ptr_is_owned(o);
11952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11953         o_conv = ChannelPublicKeys_clone(&o_conv);
11954         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11955         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11956         return tag_ptr(ret_conv, true);
11957 }
11958
11959 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
11960         void* e_ptr = untag_ptr(e);
11961         CHECK_ACCESS(e_ptr);
11962         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11963         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11964         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11965         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11966         return tag_ptr(ret_conv, true);
11967 }
11968
11969 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
11970         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
11971         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11972         return ret_conv;
11973 }
11974
11975 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
11976         if (!ptr_is_owned(_res)) return;
11977         void* _res_ptr = untag_ptr(_res);
11978         CHECK_ACCESS(_res_ptr);
11979         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11980         FREE(untag_ptr(_res));
11981         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11982 }
11983
11984 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11985         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11986         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11987         return tag_ptr(ret_conv, true);
11988 }
11989 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11990         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
11991         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11992         return ret_conv;
11993 }
11994
11995 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
11996         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
11997         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11998         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11999         return tag_ptr(ret_conv, true);
12000 }
12001
12002 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
12003         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12004         *ret_copy = COption_u32Z_some(o);
12005         uint64_t ret_ref = tag_ptr(ret_copy, true);
12006         return ret_ref;
12007 }
12008
12009 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
12010         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12011         *ret_copy = COption_u32Z_none();
12012         uint64_t ret_ref = tag_ptr(ret_copy, true);
12013         return ret_ref;
12014 }
12015
12016 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
12017         if (!ptr_is_owned(_res)) return;
12018         void* _res_ptr = untag_ptr(_res);
12019         CHECK_ACCESS(_res_ptr);
12020         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
12021         FREE(untag_ptr(_res));
12022         COption_u32Z_free(_res_conv);
12023 }
12024
12025 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
12026         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12027         *ret_copy = COption_u32Z_clone(arg);
12028         uint64_t ret_ref = tag_ptr(ret_copy, true);
12029         return ret_ref;
12030 }
12031 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
12032         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
12033         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
12034         return ret_conv;
12035 }
12036
12037 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
12038         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
12039         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12040         *ret_copy = COption_u32Z_clone(orig_conv);
12041         uint64_t ret_ref = tag_ptr(ret_copy, true);
12042         return ret_ref;
12043 }
12044
12045 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
12046         LDKHTLCOutputInCommitment o_conv;
12047         o_conv.inner = untag_ptr(o);
12048         o_conv.is_owned = ptr_is_owned(o);
12049         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12050         o_conv = HTLCOutputInCommitment_clone(&o_conv);
12051         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12052         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
12053         return tag_ptr(ret_conv, true);
12054 }
12055
12056 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
12057         void* e_ptr = untag_ptr(e);
12058         CHECK_ACCESS(e_ptr);
12059         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12060         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12061         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12062         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
12063         return tag_ptr(ret_conv, true);
12064 }
12065
12066 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
12067         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
12068         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
12069         return ret_conv;
12070 }
12071
12072 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
12073         if (!ptr_is_owned(_res)) return;
12074         void* _res_ptr = untag_ptr(_res);
12075         CHECK_ACCESS(_res_ptr);
12076         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
12077         FREE(untag_ptr(_res));
12078         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
12079 }
12080
12081 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
12082         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12083         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
12084         return tag_ptr(ret_conv, true);
12085 }
12086 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
12087         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
12088         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
12089         return ret_conv;
12090 }
12091
12092 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
12093         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
12094         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12095         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
12096         return tag_ptr(ret_conv, true);
12097 }
12098
12099 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
12100         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
12101         return ret_conv;
12102 }
12103
12104 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
12105         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
12106         return ret_conv;
12107 }
12108
12109 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
12110         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
12111         COption_NoneZ_free(_res_conv);
12112 }
12113
12114 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12115         LDKCounterpartyChannelTransactionParameters o_conv;
12116         o_conv.inner = untag_ptr(o);
12117         o_conv.is_owned = ptr_is_owned(o);
12118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12119         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
12120         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12121         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12122         return tag_ptr(ret_conv, true);
12123 }
12124
12125 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12126         void* e_ptr = untag_ptr(e);
12127         CHECK_ACCESS(e_ptr);
12128         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12129         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12130         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12131         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
12132         return tag_ptr(ret_conv, true);
12133 }
12134
12135 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12136         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12137         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12138         return ret_conv;
12139 }
12140
12141 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12142         if (!ptr_is_owned(_res)) return;
12143         void* _res_ptr = untag_ptr(_res);
12144         CHECK_ACCESS(_res_ptr);
12145         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12146         FREE(untag_ptr(_res));
12147         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12148 }
12149
12150 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12151         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12152         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
12153         return tag_ptr(ret_conv, true);
12154 }
12155 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12156         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12157         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12158         return ret_conv;
12159 }
12160
12161 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12162         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12163         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12164         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12165         return tag_ptr(ret_conv, true);
12166 }
12167
12168 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12169         LDKChannelTransactionParameters o_conv;
12170         o_conv.inner = untag_ptr(o);
12171         o_conv.is_owned = ptr_is_owned(o);
12172         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12173         o_conv = ChannelTransactionParameters_clone(&o_conv);
12174         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12175         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12176         return tag_ptr(ret_conv, true);
12177 }
12178
12179 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12180         void* e_ptr = untag_ptr(e);
12181         CHECK_ACCESS(e_ptr);
12182         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12183         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12184         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12185         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
12186         return tag_ptr(ret_conv, true);
12187 }
12188
12189 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12190         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12191         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12192         return ret_conv;
12193 }
12194
12195 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12196         if (!ptr_is_owned(_res)) return;
12197         void* _res_ptr = untag_ptr(_res);
12198         CHECK_ACCESS(_res_ptr);
12199         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12200         FREE(untag_ptr(_res));
12201         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12202 }
12203
12204 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12205         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12206         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
12207         return tag_ptr(ret_conv, true);
12208 }
12209 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12210         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12211         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12212         return ret_conv;
12213 }
12214
12215 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12216         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12217         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12218         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12219         return tag_ptr(ret_conv, true);
12220 }
12221
12222 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
12223         LDKCVec_SignatureZ _res_constr;
12224         _res_constr.datalen = _res->arr_len;
12225         if (_res_constr.datalen > 0)
12226                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12227         else
12228                 _res_constr.data = NULL;
12229         int8_tArray* _res_vals = (void*) _res->elems;
12230         for (size_t m = 0; m < _res_constr.datalen; m++) {
12231                 int8_tArray _res_conv_12 = _res_vals[m];
12232                 LDKSignature _res_conv_12_ref;
12233                 CHECK(_res_conv_12->arr_len == 64);
12234                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
12235                 _res_constr.data[m] = _res_conv_12_ref;
12236         }
12237         FREE(_res);
12238         CVec_SignatureZ_free(_res_constr);
12239 }
12240
12241 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12242         LDKHolderCommitmentTransaction o_conv;
12243         o_conv.inner = untag_ptr(o);
12244         o_conv.is_owned = ptr_is_owned(o);
12245         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12246         o_conv = HolderCommitmentTransaction_clone(&o_conv);
12247         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12248         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
12249         return tag_ptr(ret_conv, true);
12250 }
12251
12252 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12253         void* e_ptr = untag_ptr(e);
12254         CHECK_ACCESS(e_ptr);
12255         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12256         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12257         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12258         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
12259         return tag_ptr(ret_conv, true);
12260 }
12261
12262 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12263         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12264         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12265         return ret_conv;
12266 }
12267
12268 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12269         if (!ptr_is_owned(_res)) return;
12270         void* _res_ptr = untag_ptr(_res);
12271         CHECK_ACCESS(_res_ptr);
12272         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12273         FREE(untag_ptr(_res));
12274         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12275 }
12276
12277 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12278         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12279         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12280         return tag_ptr(ret_conv, true);
12281 }
12282 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12283         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12284         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12285         return ret_conv;
12286 }
12287
12288 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12289         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12290         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12291         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12292         return tag_ptr(ret_conv, true);
12293 }
12294
12295 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12296         LDKBuiltCommitmentTransaction o_conv;
12297         o_conv.inner = untag_ptr(o);
12298         o_conv.is_owned = ptr_is_owned(o);
12299         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12300         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12301         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12302         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12303         return tag_ptr(ret_conv, true);
12304 }
12305
12306 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12307         void* e_ptr = untag_ptr(e);
12308         CHECK_ACCESS(e_ptr);
12309         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12310         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12311         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12312         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12313         return tag_ptr(ret_conv, true);
12314 }
12315
12316 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12317         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12318         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12319         return ret_conv;
12320 }
12321
12322 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12323         if (!ptr_is_owned(_res)) return;
12324         void* _res_ptr = untag_ptr(_res);
12325         CHECK_ACCESS(_res_ptr);
12326         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12327         FREE(untag_ptr(_res));
12328         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12329 }
12330
12331 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12332         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12333         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12334         return tag_ptr(ret_conv, true);
12335 }
12336 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12337         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12338         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12339         return ret_conv;
12340 }
12341
12342 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12343         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12344         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12345         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12346         return tag_ptr(ret_conv, true);
12347 }
12348
12349 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12350         LDKTrustedClosingTransaction o_conv;
12351         o_conv.inner = untag_ptr(o);
12352         o_conv.is_owned = ptr_is_owned(o);
12353         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12354         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12355         
12356         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12357         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12358         return tag_ptr(ret_conv, true);
12359 }
12360
12361 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12362         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12363         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12364         return tag_ptr(ret_conv, true);
12365 }
12366
12367 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12368         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12369         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12370         return ret_conv;
12371 }
12372
12373 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12374         if (!ptr_is_owned(_res)) return;
12375         void* _res_ptr = untag_ptr(_res);
12376         CHECK_ACCESS(_res_ptr);
12377         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12378         FREE(untag_ptr(_res));
12379         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12380 }
12381
12382 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12383         LDKCommitmentTransaction o_conv;
12384         o_conv.inner = untag_ptr(o);
12385         o_conv.is_owned = ptr_is_owned(o);
12386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12387         o_conv = CommitmentTransaction_clone(&o_conv);
12388         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12389         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12390         return tag_ptr(ret_conv, true);
12391 }
12392
12393 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12394         void* e_ptr = untag_ptr(e);
12395         CHECK_ACCESS(e_ptr);
12396         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12397         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12398         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12399         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12400         return tag_ptr(ret_conv, true);
12401 }
12402
12403 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12404         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12405         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12406         return ret_conv;
12407 }
12408
12409 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12410         if (!ptr_is_owned(_res)) return;
12411         void* _res_ptr = untag_ptr(_res);
12412         CHECK_ACCESS(_res_ptr);
12413         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12414         FREE(untag_ptr(_res));
12415         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12416 }
12417
12418 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12419         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12420         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12421         return tag_ptr(ret_conv, true);
12422 }
12423 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12424         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12425         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12426         return ret_conv;
12427 }
12428
12429 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12430         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12431         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12432         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12433         return tag_ptr(ret_conv, true);
12434 }
12435
12436 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12437         LDKTrustedCommitmentTransaction o_conv;
12438         o_conv.inner = untag_ptr(o);
12439         o_conv.is_owned = ptr_is_owned(o);
12440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12441         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12442         
12443         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12444         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12445         return tag_ptr(ret_conv, true);
12446 }
12447
12448 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12449         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12450         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12451         return tag_ptr(ret_conv, true);
12452 }
12453
12454 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12455         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12456         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12457         return ret_conv;
12458 }
12459
12460 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12461         if (!ptr_is_owned(_res)) return;
12462         void* _res_ptr = untag_ptr(_res);
12463         CHECK_ACCESS(_res_ptr);
12464         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12465         FREE(untag_ptr(_res));
12466         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12467 }
12468
12469 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12470         LDKCVec_SignatureZ o_constr;
12471         o_constr.datalen = o->arr_len;
12472         if (o_constr.datalen > 0)
12473                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12474         else
12475                 o_constr.data = NULL;
12476         int8_tArray* o_vals = (void*) o->elems;
12477         for (size_t m = 0; m < o_constr.datalen; m++) {
12478                 int8_tArray o_conv_12 = o_vals[m];
12479                 LDKSignature o_conv_12_ref;
12480                 CHECK(o_conv_12->arr_len == 64);
12481                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12482                 o_constr.data[m] = o_conv_12_ref;
12483         }
12484         FREE(o);
12485         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12486         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12487         return tag_ptr(ret_conv, true);
12488 }
12489
12490 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12491         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12492         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12493         return tag_ptr(ret_conv, true);
12494 }
12495
12496 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12497         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12498         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12499         return ret_conv;
12500 }
12501
12502 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12503         if (!ptr_is_owned(_res)) return;
12504         void* _res_ptr = untag_ptr(_res);
12505         CHECK_ACCESS(_res_ptr);
12506         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12507         FREE(untag_ptr(_res));
12508         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12509 }
12510
12511 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12512         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12513         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12514         return tag_ptr(ret_conv, true);
12515 }
12516 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12517         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12518         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12519         return ret_conv;
12520 }
12521
12522 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12523         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12524         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12525         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12526         return tag_ptr(ret_conv, true);
12527 }
12528
12529 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12530         LDKShutdownScript o_conv;
12531         o_conv.inner = untag_ptr(o);
12532         o_conv.is_owned = ptr_is_owned(o);
12533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12534         o_conv = ShutdownScript_clone(&o_conv);
12535         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12536         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12537         return tag_ptr(ret_conv, true);
12538 }
12539
12540 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12541         void* e_ptr = untag_ptr(e);
12542         CHECK_ACCESS(e_ptr);
12543         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12544         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12545         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12546         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12547         return tag_ptr(ret_conv, true);
12548 }
12549
12550 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
12551         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
12552         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12553         return ret_conv;
12554 }
12555
12556 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
12557         if (!ptr_is_owned(_res)) return;
12558         void* _res_ptr = untag_ptr(_res);
12559         CHECK_ACCESS(_res_ptr);
12560         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12561         FREE(untag_ptr(_res));
12562         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12563 }
12564
12565 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12566         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12567         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12568         return tag_ptr(ret_conv, true);
12569 }
12570 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
12571         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
12572         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12573         return ret_conv;
12574 }
12575
12576 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
12577         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
12578         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12579         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12580         return tag_ptr(ret_conv, true);
12581 }
12582
12583 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
12584         LDKShutdownScript o_conv;
12585         o_conv.inner = untag_ptr(o);
12586         o_conv.is_owned = ptr_is_owned(o);
12587         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12588         o_conv = ShutdownScript_clone(&o_conv);
12589         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12590         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12591         return tag_ptr(ret_conv, true);
12592 }
12593
12594 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
12595         LDKInvalidShutdownScript e_conv;
12596         e_conv.inner = untag_ptr(e);
12597         e_conv.is_owned = ptr_is_owned(e);
12598         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12599         e_conv = InvalidShutdownScript_clone(&e_conv);
12600         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12601         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12602         return tag_ptr(ret_conv, true);
12603 }
12604
12605 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
12606         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
12607         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12608         return ret_conv;
12609 }
12610
12611 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
12612         if (!ptr_is_owned(_res)) return;
12613         void* _res_ptr = untag_ptr(_res);
12614         CHECK_ACCESS(_res_ptr);
12615         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12616         FREE(untag_ptr(_res));
12617         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12618 }
12619
12620 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12621         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12622         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12623         return tag_ptr(ret_conv, true);
12624 }
12625 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
12626         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
12627         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12628         return ret_conv;
12629 }
12630
12631 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
12632         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
12633         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12634         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12635         return tag_ptr(ret_conv, true);
12636 }
12637
12638 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
12639         LDKCVec_PublicKeyZ _res_constr;
12640         _res_constr.datalen = _res->arr_len;
12641         if (_res_constr.datalen > 0)
12642                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
12643         else
12644                 _res_constr.data = NULL;
12645         int8_tArray* _res_vals = (void*) _res->elems;
12646         for (size_t m = 0; m < _res_constr.datalen; m++) {
12647                 int8_tArray _res_conv_12 = _res_vals[m];
12648                 LDKPublicKey _res_conv_12_ref;
12649                 CHECK(_res_conv_12->arr_len == 33);
12650                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
12651                 _res_constr.data[m] = _res_conv_12_ref;
12652         }
12653         FREE(_res);
12654         CVec_PublicKeyZ_free(_res_constr);
12655 }
12656
12657 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
12658         LDKBlindedPath o_conv;
12659         o_conv.inner = untag_ptr(o);
12660         o_conv.is_owned = ptr_is_owned(o);
12661         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12662         o_conv = BlindedPath_clone(&o_conv);
12663         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12664         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
12665         return tag_ptr(ret_conv, true);
12666 }
12667
12668 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
12669         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12670         *ret_conv = CResult_BlindedPathNoneZ_err();
12671         return tag_ptr(ret_conv, true);
12672 }
12673
12674 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
12675         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
12676         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
12677         return ret_conv;
12678 }
12679
12680 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
12681         if (!ptr_is_owned(_res)) return;
12682         void* _res_ptr = untag_ptr(_res);
12683         CHECK_ACCESS(_res_ptr);
12684         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
12685         FREE(untag_ptr(_res));
12686         CResult_BlindedPathNoneZ_free(_res_conv);
12687 }
12688
12689 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
12690         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12691         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
12692         return tag_ptr(ret_conv, true);
12693 }
12694 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
12695         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
12696         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
12697         return ret_conv;
12698 }
12699
12700 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
12701         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
12702         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12703         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
12704         return tag_ptr(ret_conv, true);
12705 }
12706
12707 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
12708         LDKBlindedPath o_conv;
12709         o_conv.inner = untag_ptr(o);
12710         o_conv.is_owned = ptr_is_owned(o);
12711         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12712         o_conv = BlindedPath_clone(&o_conv);
12713         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12714         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
12715         return tag_ptr(ret_conv, true);
12716 }
12717
12718 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
12719         void* e_ptr = untag_ptr(e);
12720         CHECK_ACCESS(e_ptr);
12721         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12722         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12723         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12724         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
12725         return tag_ptr(ret_conv, true);
12726 }
12727
12728 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
12729         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
12730         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
12731         return ret_conv;
12732 }
12733
12734 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
12735         if (!ptr_is_owned(_res)) return;
12736         void* _res_ptr = untag_ptr(_res);
12737         CHECK_ACCESS(_res_ptr);
12738         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
12739         FREE(untag_ptr(_res));
12740         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
12741 }
12742
12743 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
12744         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12745         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
12746         return tag_ptr(ret_conv, true);
12747 }
12748 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
12749         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
12750         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
12751         return ret_conv;
12752 }
12753
12754 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
12755         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
12756         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12757         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
12758         return tag_ptr(ret_conv, true);
12759 }
12760
12761 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
12762         LDKBlindedHop o_conv;
12763         o_conv.inner = untag_ptr(o);
12764         o_conv.is_owned = ptr_is_owned(o);
12765         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12766         o_conv = BlindedHop_clone(&o_conv);
12767         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12768         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
12769         return tag_ptr(ret_conv, true);
12770 }
12771
12772 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
12773         void* e_ptr = untag_ptr(e);
12774         CHECK_ACCESS(e_ptr);
12775         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12776         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12777         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12778         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
12779         return tag_ptr(ret_conv, true);
12780 }
12781
12782 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
12783         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
12784         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
12785         return ret_conv;
12786 }
12787
12788 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
12789         if (!ptr_is_owned(_res)) return;
12790         void* _res_ptr = untag_ptr(_res);
12791         CHECK_ACCESS(_res_ptr);
12792         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
12793         FREE(untag_ptr(_res));
12794         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
12795 }
12796
12797 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
12798         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12799         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
12800         return tag_ptr(ret_conv, true);
12801 }
12802 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12803         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
12804         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
12805         return ret_conv;
12806 }
12807
12808 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
12809         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
12810         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12811         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
12812         return tag_ptr(ret_conv, true);
12813 }
12814
12815 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
12816         LDKCVec_ChannelDetailsZ _res_constr;
12817         _res_constr.datalen = _res->arr_len;
12818         if (_res_constr.datalen > 0)
12819                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12820         else
12821                 _res_constr.data = NULL;
12822         uint64_t* _res_vals = _res->elems;
12823         for (size_t q = 0; q < _res_constr.datalen; q++) {
12824                 uint64_t _res_conv_16 = _res_vals[q];
12825                 LDKChannelDetails _res_conv_16_conv;
12826                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
12827                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
12828                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12829                 _res_constr.data[q] = _res_conv_16_conv;
12830         }
12831         FREE(_res);
12832         CVec_ChannelDetailsZ_free(_res_constr);
12833 }
12834
12835 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
12836         LDKRoute o_conv;
12837         o_conv.inner = untag_ptr(o);
12838         o_conv.is_owned = ptr_is_owned(o);
12839         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12840         o_conv = Route_clone(&o_conv);
12841         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12842         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12843         return tag_ptr(ret_conv, true);
12844 }
12845
12846 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
12847         LDKLightningError e_conv;
12848         e_conv.inner = untag_ptr(e);
12849         e_conv.is_owned = ptr_is_owned(e);
12850         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12851         e_conv = LightningError_clone(&e_conv);
12852         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12853         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12854         return tag_ptr(ret_conv, true);
12855 }
12856
12857 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
12858         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
12859         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12860         return ret_conv;
12861 }
12862
12863 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
12864         if (!ptr_is_owned(_res)) return;
12865         void* _res_ptr = untag_ptr(_res);
12866         CHECK_ACCESS(_res_ptr);
12867         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12868         FREE(untag_ptr(_res));
12869         CResult_RouteLightningErrorZ_free(_res_conv);
12870 }
12871
12872 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12873         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12874         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12875         return tag_ptr(ret_conv, true);
12876 }
12877 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
12878         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
12879         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12880         return ret_conv;
12881 }
12882
12883 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
12884         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
12885         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12886         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12887         return tag_ptr(ret_conv, true);
12888 }
12889
12890 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
12891         LDKCVec_RouteHopZ _res_constr;
12892         _res_constr.datalen = _res->arr_len;
12893         if (_res_constr.datalen > 0)
12894                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12895         else
12896                 _res_constr.data = NULL;
12897         uint64_t* _res_vals = _res->elems;
12898         for (size_t k = 0; k < _res_constr.datalen; k++) {
12899                 uint64_t _res_conv_10 = _res_vals[k];
12900                 LDKRouteHop _res_conv_10_conv;
12901                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
12902                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
12903                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12904                 _res_constr.data[k] = _res_conv_10_conv;
12905         }
12906         FREE(_res);
12907         CVec_RouteHopZ_free(_res_constr);
12908 }
12909
12910 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12911         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12912         *ret_copy = COption_u64Z_some(o);
12913         uint64_t ret_ref = tag_ptr(ret_copy, true);
12914         return ret_ref;
12915 }
12916
12917 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12918         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12919         *ret_copy = COption_u64Z_none();
12920         uint64_t ret_ref = tag_ptr(ret_copy, true);
12921         return ret_ref;
12922 }
12923
12924 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
12925         if (!ptr_is_owned(_res)) return;
12926         void* _res_ptr = untag_ptr(_res);
12927         CHECK_ACCESS(_res_ptr);
12928         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12929         FREE(untag_ptr(_res));
12930         COption_u64Z_free(_res_conv);
12931 }
12932
12933 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12934         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12935         *ret_copy = COption_u64Z_clone(arg);
12936         uint64_t ret_ref = tag_ptr(ret_copy, true);
12937         return ret_ref;
12938 }
12939 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12940         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12941         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12942         return ret_conv;
12943 }
12944
12945 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12946         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12947         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12948         *ret_copy = COption_u64Z_clone(orig_conv);
12949         uint64_t ret_ref = tag_ptr(ret_copy, true);
12950         return ret_ref;
12951 }
12952
12953 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
12954         LDKInFlightHtlcs o_conv;
12955         o_conv.inner = untag_ptr(o);
12956         o_conv.is_owned = ptr_is_owned(o);
12957         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12958         o_conv = InFlightHtlcs_clone(&o_conv);
12959         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12960         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
12961         return tag_ptr(ret_conv, true);
12962 }
12963
12964 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
12965         void* e_ptr = untag_ptr(e);
12966         CHECK_ACCESS(e_ptr);
12967         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12968         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12969         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12970         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
12971         return tag_ptr(ret_conv, true);
12972 }
12973
12974 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
12975         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
12976         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
12977         return ret_conv;
12978 }
12979
12980 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
12981         if (!ptr_is_owned(_res)) return;
12982         void* _res_ptr = untag_ptr(_res);
12983         CHECK_ACCESS(_res_ptr);
12984         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
12985         FREE(untag_ptr(_res));
12986         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
12987 }
12988
12989 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
12990         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12991         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
12992         return tag_ptr(ret_conv, true);
12993 }
12994 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
12995         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
12996         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
12997         return ret_conv;
12998 }
12999
13000 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
13001         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
13002         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13003         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
13004         return tag_ptr(ret_conv, true);
13005 }
13006
13007 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
13008         LDKRouteHop o_conv;
13009         o_conv.inner = untag_ptr(o);
13010         o_conv.is_owned = ptr_is_owned(o);
13011         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13012         o_conv = RouteHop_clone(&o_conv);
13013         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13014         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
13015         return tag_ptr(ret_conv, true);
13016 }
13017
13018 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
13019         void* e_ptr = untag_ptr(e);
13020         CHECK_ACCESS(e_ptr);
13021         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13022         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13023         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13024         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
13025         return tag_ptr(ret_conv, true);
13026 }
13027
13028 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
13029         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
13030         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
13031         return ret_conv;
13032 }
13033
13034 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
13035         if (!ptr_is_owned(_res)) return;
13036         void* _res_ptr = untag_ptr(_res);
13037         CHECK_ACCESS(_res_ptr);
13038         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
13039         FREE(untag_ptr(_res));
13040         CResult_RouteHopDecodeErrorZ_free(_res_conv);
13041 }
13042
13043 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
13044         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13045         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
13046         return tag_ptr(ret_conv, true);
13047 }
13048 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13049         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
13050         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
13051         return ret_conv;
13052 }
13053
13054 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
13055         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
13056         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13057         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
13058         return tag_ptr(ret_conv, true);
13059 }
13060
13061 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
13062         LDKCVec_CVec_RouteHopZZ _res_constr;
13063         _res_constr.datalen = _res->arr_len;
13064         if (_res_constr.datalen > 0)
13065                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13066         else
13067                 _res_constr.data = NULL;
13068         uint64_tArray* _res_vals = (void*) _res->elems;
13069         for (size_t m = 0; m < _res_constr.datalen; m++) {
13070                 uint64_tArray _res_conv_12 = _res_vals[m];
13071                 LDKCVec_RouteHopZ _res_conv_12_constr;
13072                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
13073                 if (_res_conv_12_constr.datalen > 0)
13074                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13075                 else
13076                         _res_conv_12_constr.data = NULL;
13077                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
13078                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
13079                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
13080                         LDKRouteHop _res_conv_12_conv_10_conv;
13081                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
13082                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
13083                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
13084                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
13085                 }
13086                 FREE(_res_conv_12);
13087                 _res_constr.data[m] = _res_conv_12_constr;
13088         }
13089         FREE(_res);
13090         CVec_CVec_RouteHopZZ_free(_res_constr);
13091 }
13092
13093 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
13094         LDKRoute o_conv;
13095         o_conv.inner = untag_ptr(o);
13096         o_conv.is_owned = ptr_is_owned(o);
13097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13098         o_conv = Route_clone(&o_conv);
13099         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13100         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
13101         return tag_ptr(ret_conv, true);
13102 }
13103
13104 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
13105         void* e_ptr = untag_ptr(e);
13106         CHECK_ACCESS(e_ptr);
13107         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13108         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13109         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13110         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
13111         return tag_ptr(ret_conv, true);
13112 }
13113
13114 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
13115         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
13116         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
13117         return ret_conv;
13118 }
13119
13120 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
13121         if (!ptr_is_owned(_res)) return;
13122         void* _res_ptr = untag_ptr(_res);
13123         CHECK_ACCESS(_res_ptr);
13124         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
13125         FREE(untag_ptr(_res));
13126         CResult_RouteDecodeErrorZ_free(_res_conv);
13127 }
13128
13129 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
13130         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13131         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
13132         return tag_ptr(ret_conv, true);
13133 }
13134 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
13135         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
13136         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
13137         return ret_conv;
13138 }
13139
13140 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
13141         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
13142         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13143         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
13144         return tag_ptr(ret_conv, true);
13145 }
13146
13147 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
13148         LDKRouteParameters o_conv;
13149         o_conv.inner = untag_ptr(o);
13150         o_conv.is_owned = ptr_is_owned(o);
13151         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13152         o_conv = RouteParameters_clone(&o_conv);
13153         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13154         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
13155         return tag_ptr(ret_conv, true);
13156 }
13157
13158 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
13159         void* e_ptr = untag_ptr(e);
13160         CHECK_ACCESS(e_ptr);
13161         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13162         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13163         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13164         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
13165         return tag_ptr(ret_conv, true);
13166 }
13167
13168 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
13169         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
13170         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
13171         return ret_conv;
13172 }
13173
13174 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
13175         if (!ptr_is_owned(_res)) return;
13176         void* _res_ptr = untag_ptr(_res);
13177         CHECK_ACCESS(_res_ptr);
13178         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
13179         FREE(untag_ptr(_res));
13180         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
13181 }
13182
13183 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
13184         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13185         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
13186         return tag_ptr(ret_conv, true);
13187 }
13188 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13189         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
13190         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
13191         return ret_conv;
13192 }
13193
13194 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
13195         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
13196         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13197         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
13198         return tag_ptr(ret_conv, true);
13199 }
13200
13201 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
13202         LDKCVec_RouteHintZ _res_constr;
13203         _res_constr.datalen = _res->arr_len;
13204         if (_res_constr.datalen > 0)
13205                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13206         else
13207                 _res_constr.data = NULL;
13208         uint64_t* _res_vals = _res->elems;
13209         for (size_t l = 0; l < _res_constr.datalen; l++) {
13210                 uint64_t _res_conv_11 = _res_vals[l];
13211                 LDKRouteHint _res_conv_11_conv;
13212                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
13213                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
13214                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
13215                 _res_constr.data[l] = _res_conv_11_conv;
13216         }
13217         FREE(_res);
13218         CVec_RouteHintZ_free(_res_constr);
13219 }
13220
13221 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
13222         LDKCVec_u64Z _res_constr;
13223         _res_constr.datalen = _res->arr_len;
13224         if (_res_constr.datalen > 0)
13225                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13226         else
13227                 _res_constr.data = NULL;
13228         int64_t* _res_vals = _res->elems;
13229         for (size_t i = 0; i < _res_constr.datalen; i++) {
13230                 int64_t _res_conv_8 = _res_vals[i];
13231                 _res_constr.data[i] = _res_conv_8;
13232         }
13233         FREE(_res);
13234         CVec_u64Z_free(_res_constr);
13235 }
13236
13237 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
13238         LDKPaymentParameters o_conv;
13239         o_conv.inner = untag_ptr(o);
13240         o_conv.is_owned = ptr_is_owned(o);
13241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13242         o_conv = PaymentParameters_clone(&o_conv);
13243         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13244         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
13245         return tag_ptr(ret_conv, true);
13246 }
13247
13248 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
13249         void* e_ptr = untag_ptr(e);
13250         CHECK_ACCESS(e_ptr);
13251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13253         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13254         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
13255         return tag_ptr(ret_conv, true);
13256 }
13257
13258 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
13259         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
13260         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
13261         return ret_conv;
13262 }
13263
13264 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
13265         if (!ptr_is_owned(_res)) return;
13266         void* _res_ptr = untag_ptr(_res);
13267         CHECK_ACCESS(_res_ptr);
13268         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
13269         FREE(untag_ptr(_res));
13270         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
13271 }
13272
13273 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
13274         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13275         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
13276         return tag_ptr(ret_conv, true);
13277 }
13278 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13279         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
13280         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
13281         return ret_conv;
13282 }
13283
13284 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
13285         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
13286         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13287         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
13288         return tag_ptr(ret_conv, true);
13289 }
13290
13291 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
13292         LDKCVec_RouteHintHopZ _res_constr;
13293         _res_constr.datalen = _res->arr_len;
13294         if (_res_constr.datalen > 0)
13295                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
13296         else
13297                 _res_constr.data = NULL;
13298         uint64_t* _res_vals = _res->elems;
13299         for (size_t o = 0; o < _res_constr.datalen; o++) {
13300                 uint64_t _res_conv_14 = _res_vals[o];
13301                 LDKRouteHintHop _res_conv_14_conv;
13302                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
13303                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
13304                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
13305                 _res_constr.data[o] = _res_conv_14_conv;
13306         }
13307         FREE(_res);
13308         CVec_RouteHintHopZ_free(_res_constr);
13309 }
13310
13311 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
13312         LDKRouteHint o_conv;
13313         o_conv.inner = untag_ptr(o);
13314         o_conv.is_owned = ptr_is_owned(o);
13315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13316         o_conv = RouteHint_clone(&o_conv);
13317         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13318         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
13319         return tag_ptr(ret_conv, true);
13320 }
13321
13322 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
13323         void* e_ptr = untag_ptr(e);
13324         CHECK_ACCESS(e_ptr);
13325         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13326         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13327         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13328         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
13329         return tag_ptr(ret_conv, true);
13330 }
13331
13332 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
13333         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
13334         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
13335         return ret_conv;
13336 }
13337
13338 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
13339         if (!ptr_is_owned(_res)) return;
13340         void* _res_ptr = untag_ptr(_res);
13341         CHECK_ACCESS(_res_ptr);
13342         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
13343         FREE(untag_ptr(_res));
13344         CResult_RouteHintDecodeErrorZ_free(_res_conv);
13345 }
13346
13347 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
13348         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13349         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
13350         return tag_ptr(ret_conv, true);
13351 }
13352 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
13353         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
13354         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
13355         return ret_conv;
13356 }
13357
13358 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
13359         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
13360         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13361         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
13362         return tag_ptr(ret_conv, true);
13363 }
13364
13365 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
13366         LDKRouteHintHop o_conv;
13367         o_conv.inner = untag_ptr(o);
13368         o_conv.is_owned = ptr_is_owned(o);
13369         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13370         o_conv = RouteHintHop_clone(&o_conv);
13371         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13372         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
13373         return tag_ptr(ret_conv, true);
13374 }
13375
13376 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
13377         void* e_ptr = untag_ptr(e);
13378         CHECK_ACCESS(e_ptr);
13379         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13380         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13381         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13382         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
13383         return tag_ptr(ret_conv, true);
13384 }
13385
13386 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
13387         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
13388         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
13389         return ret_conv;
13390 }
13391
13392 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
13393         if (!ptr_is_owned(_res)) return;
13394         void* _res_ptr = untag_ptr(_res);
13395         CHECK_ACCESS(_res_ptr);
13396         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
13397         FREE(untag_ptr(_res));
13398         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
13399 }
13400
13401 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
13402         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13403         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
13404         return tag_ptr(ret_conv, true);
13405 }
13406 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13407         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
13408         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
13409         return ret_conv;
13410 }
13411
13412 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
13413         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
13414         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13415         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
13416         return tag_ptr(ret_conv, true);
13417 }
13418
13419 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
13420         void* o_ptr = untag_ptr(o);
13421         CHECK_ACCESS(o_ptr);
13422         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
13423         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
13424         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13425         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
13426         return tag_ptr(ret_conv, true);
13427 }
13428
13429 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
13430         void* e_ptr = untag_ptr(e);
13431         CHECK_ACCESS(e_ptr);
13432         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13433         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13434         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13435         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
13436         return tag_ptr(ret_conv, true);
13437 }
13438
13439 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
13440         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
13441         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
13442         return ret_conv;
13443 }
13444
13445 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
13446         if (!ptr_is_owned(_res)) return;
13447         void* _res_ptr = untag_ptr(_res);
13448         CHECK_ACCESS(_res_ptr);
13449         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
13450         FREE(untag_ptr(_res));
13451         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
13452 }
13453
13454 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
13455         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13456         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
13457         return tag_ptr(ret_conv, true);
13458 }
13459 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
13460         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
13461         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
13462         return ret_conv;
13463 }
13464
13465 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
13466         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
13467         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13468         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
13469         return tag_ptr(ret_conv, true);
13470 }
13471
13472 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
13473         void* o_ptr = untag_ptr(o);
13474         CHECK_ACCESS(o_ptr);
13475         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13476         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
13477         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13478         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13479         uint64_t ret_ref = tag_ptr(ret_copy, true);
13480         return ret_ref;
13481 }
13482
13483 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
13484         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13485         *ret_copy = COption_NetworkUpdateZ_none();
13486         uint64_t ret_ref = tag_ptr(ret_copy, true);
13487         return ret_ref;
13488 }
13489
13490 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
13491         if (!ptr_is_owned(_res)) return;
13492         void* _res_ptr = untag_ptr(_res);
13493         CHECK_ACCESS(_res_ptr);
13494         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13495         FREE(untag_ptr(_res));
13496         COption_NetworkUpdateZ_free(_res_conv);
13497 }
13498
13499 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13500         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13501         *ret_copy = COption_NetworkUpdateZ_clone(arg);
13502         uint64_t ret_ref = tag_ptr(ret_copy, true);
13503         return ret_ref;
13504 }
13505 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
13506         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
13507         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13508         return ret_conv;
13509 }
13510
13511 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
13512         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
13513         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13514         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13515         uint64_t ret_ref = tag_ptr(ret_copy, true);
13516         return ret_ref;
13517 }
13518
13519 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
13520         void* o_ptr = untag_ptr(o);
13521         CHECK_ACCESS(o_ptr);
13522         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
13523         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
13524         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13525         *ret_copy = COption_PathFailureZ_some(o_conv);
13526         uint64_t ret_ref = tag_ptr(ret_copy, true);
13527         return ret_ref;
13528 }
13529
13530 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
13531         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13532         *ret_copy = COption_PathFailureZ_none();
13533         uint64_t ret_ref = tag_ptr(ret_copy, true);
13534         return ret_ref;
13535 }
13536
13537 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
13538         if (!ptr_is_owned(_res)) return;
13539         void* _res_ptr = untag_ptr(_res);
13540         CHECK_ACCESS(_res_ptr);
13541         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
13542         FREE(untag_ptr(_res));
13543         COption_PathFailureZ_free(_res_conv);
13544 }
13545
13546 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
13547         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13548         *ret_copy = COption_PathFailureZ_clone(arg);
13549         uint64_t ret_ref = tag_ptr(ret_copy, true);
13550         return ret_ref;
13551 }
13552 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
13553         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
13554         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
13555         return ret_conv;
13556 }
13557
13558 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
13559         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
13560         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13561         *ret_copy = COption_PathFailureZ_clone(orig_conv);
13562         uint64_t ret_ref = tag_ptr(ret_copy, true);
13563         return ret_ref;
13564 }
13565
13566 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
13567         void* o_ptr = untag_ptr(o);
13568         CHECK_ACCESS(o_ptr);
13569         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
13570         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
13571         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
13572         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
13573         return tag_ptr(ret_conv, true);
13574 }
13575
13576 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
13577         void* e_ptr = untag_ptr(e);
13578         CHECK_ACCESS(e_ptr);
13579         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13580         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13581         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
13582         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
13583         return tag_ptr(ret_conv, true);
13584 }
13585
13586 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
13587         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
13588         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
13589         return ret_conv;
13590 }
13591
13592 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
13593         if (!ptr_is_owned(_res)) return;
13594         void* _res_ptr = untag_ptr(_res);
13595         CHECK_ACCESS(_res_ptr);
13596         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
13597         FREE(untag_ptr(_res));
13598         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
13599 }
13600
13601 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
13602         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
13603         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
13604         return tag_ptr(ret_conv, true);
13605 }
13606 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
13607         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
13608         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
13609         return ret_conv;
13610 }
13611
13612 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
13613         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
13614         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
13615         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
13616         return tag_ptr(ret_conv, true);
13617 }
13618
13619 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
13620         void* o_ptr = untag_ptr(o);
13621         CHECK_ACCESS(o_ptr);
13622         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
13623         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
13624         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13625         *ret_copy = COption_ClosureReasonZ_some(o_conv);
13626         uint64_t ret_ref = tag_ptr(ret_copy, true);
13627         return ret_ref;
13628 }
13629
13630 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
13631         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13632         *ret_copy = COption_ClosureReasonZ_none();
13633         uint64_t ret_ref = tag_ptr(ret_copy, true);
13634         return ret_ref;
13635 }
13636
13637 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
13638         if (!ptr_is_owned(_res)) return;
13639         void* _res_ptr = untag_ptr(_res);
13640         CHECK_ACCESS(_res_ptr);
13641         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
13642         FREE(untag_ptr(_res));
13643         COption_ClosureReasonZ_free(_res_conv);
13644 }
13645
13646 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
13647         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13648         *ret_copy = COption_ClosureReasonZ_clone(arg);
13649         uint64_t ret_ref = tag_ptr(ret_copy, true);
13650         return ret_ref;
13651 }
13652 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
13653         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
13654         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
13655         return ret_conv;
13656 }
13657
13658 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
13659         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
13660         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13661         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
13662         uint64_t ret_ref = tag_ptr(ret_copy, true);
13663         return ret_ref;
13664 }
13665
13666 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
13667         void* o_ptr = untag_ptr(o);
13668         CHECK_ACCESS(o_ptr);
13669         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
13670         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
13671         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13672         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
13673         return tag_ptr(ret_conv, true);
13674 }
13675
13676 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
13677         void* e_ptr = untag_ptr(e);
13678         CHECK_ACCESS(e_ptr);
13679         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13680         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13681         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13682         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
13683         return tag_ptr(ret_conv, true);
13684 }
13685
13686 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
13687         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
13688         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
13689         return ret_conv;
13690 }
13691
13692 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
13693         if (!ptr_is_owned(_res)) return;
13694         void* _res_ptr = untag_ptr(_res);
13695         CHECK_ACCESS(_res_ptr);
13696         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13697         FREE(untag_ptr(_res));
13698         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13699 }
13700
13701 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13702         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13703         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13704         return tag_ptr(ret_conv, true);
13705 }
13706 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
13707         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
13708         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13709         return ret_conv;
13710 }
13711
13712 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
13713         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
13714         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13715         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13716         return tag_ptr(ret_conv, true);
13717 }
13718
13719 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
13720         void* o_ptr = untag_ptr(o);
13721         CHECK_ACCESS(o_ptr);
13722         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
13723         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
13724         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13725         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
13726         uint64_t ret_ref = tag_ptr(ret_copy, true);
13727         return ret_ref;
13728 }
13729
13730 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
13731         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13732         *ret_copy = COption_HTLCDestinationZ_none();
13733         uint64_t ret_ref = tag_ptr(ret_copy, true);
13734         return ret_ref;
13735 }
13736
13737 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
13738         if (!ptr_is_owned(_res)) return;
13739         void* _res_ptr = untag_ptr(_res);
13740         CHECK_ACCESS(_res_ptr);
13741         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
13742         FREE(untag_ptr(_res));
13743         COption_HTLCDestinationZ_free(_res_conv);
13744 }
13745
13746 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
13747         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13748         *ret_copy = COption_HTLCDestinationZ_clone(arg);
13749         uint64_t ret_ref = tag_ptr(ret_copy, true);
13750         return ret_ref;
13751 }
13752 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
13753         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
13754         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
13755         return ret_conv;
13756 }
13757
13758 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
13759         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
13760         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13761         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
13762         uint64_t ret_ref = tag_ptr(ret_copy, true);
13763         return ret_ref;
13764 }
13765
13766 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
13767         void* o_ptr = untag_ptr(o);
13768         CHECK_ACCESS(o_ptr);
13769         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
13770         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
13771         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13772         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
13773         return tag_ptr(ret_conv, true);
13774 }
13775
13776 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
13777         void* e_ptr = untag_ptr(e);
13778         CHECK_ACCESS(e_ptr);
13779         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13780         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13781         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13782         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
13783         return tag_ptr(ret_conv, true);
13784 }
13785
13786 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
13787         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
13788         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
13789         return ret_conv;
13790 }
13791
13792 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
13793         if (!ptr_is_owned(_res)) return;
13794         void* _res_ptr = untag_ptr(_res);
13795         CHECK_ACCESS(_res_ptr);
13796         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
13797         FREE(untag_ptr(_res));
13798         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
13799 }
13800
13801 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
13802         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13803         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
13804         return tag_ptr(ret_conv, true);
13805 }
13806 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
13807         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
13808         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
13809         return ret_conv;
13810 }
13811
13812 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
13813         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
13814         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13815         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
13816         return tag_ptr(ret_conv, true);
13817 }
13818
13819 uint64_t  __attribute__((export_name("TS_COption_u128Z_some"))) TS_COption_u128Z_some(int8_tArray o) {
13820         LDKU128 o_ref;
13821         CHECK(o->arr_len == 16);
13822         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
13823         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13824         *ret_copy = COption_u128Z_some(o_ref);
13825         uint64_t ret_ref = tag_ptr(ret_copy, true);
13826         return ret_ref;
13827 }
13828
13829 uint64_t  __attribute__((export_name("TS_COption_u128Z_none"))) TS_COption_u128Z_none() {
13830         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13831         *ret_copy = COption_u128Z_none();
13832         uint64_t ret_ref = tag_ptr(ret_copy, true);
13833         return ret_ref;
13834 }
13835
13836 void  __attribute__((export_name("TS_COption_u128Z_free"))) TS_COption_u128Z_free(uint64_t _res) {
13837         if (!ptr_is_owned(_res)) return;
13838         void* _res_ptr = untag_ptr(_res);
13839         CHECK_ACCESS(_res_ptr);
13840         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
13841         FREE(untag_ptr(_res));
13842         COption_u128Z_free(_res_conv);
13843 }
13844
13845 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
13846         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13847         *ret_copy = COption_u128Z_clone(arg);
13848         uint64_t ret_ref = tag_ptr(ret_copy, true);
13849         return ret_ref;
13850 }
13851 int64_t  __attribute__((export_name("TS_COption_u128Z_clone_ptr"))) TS_COption_u128Z_clone_ptr(uint64_t arg) {
13852         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
13853         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
13854         return ret_conv;
13855 }
13856
13857 uint64_t  __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128Z_clone(uint64_t orig) {
13858         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
13859         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13860         *ret_copy = COption_u128Z_clone(orig_conv);
13861         uint64_t ret_ref = tag_ptr(ret_copy, true);
13862         return ret_ref;
13863 }
13864
13865 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
13866         LDKCVec_SpendableOutputDescriptorZ _res_constr;
13867         _res_constr.datalen = _res->arr_len;
13868         if (_res_constr.datalen > 0)
13869                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13870         else
13871                 _res_constr.data = NULL;
13872         uint64_t* _res_vals = _res->elems;
13873         for (size_t b = 0; b < _res_constr.datalen; b++) {
13874                 uint64_t _res_conv_27 = _res_vals[b];
13875                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
13876                 CHECK_ACCESS(_res_conv_27_ptr);
13877                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13878                 FREE(untag_ptr(_res_conv_27));
13879                 _res_constr.data[b] = _res_conv_27_conv;
13880         }
13881         FREE(_res);
13882         CVec_SpendableOutputDescriptorZ_free(_res_constr);
13883 }
13884
13885 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
13886         void* o_ptr = untag_ptr(o);
13887         CHECK_ACCESS(o_ptr);
13888         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13889         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
13890         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13891         *ret_copy = COption_EventZ_some(o_conv);
13892         uint64_t ret_ref = tag_ptr(ret_copy, true);
13893         return ret_ref;
13894 }
13895
13896 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
13897         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13898         *ret_copy = COption_EventZ_none();
13899         uint64_t ret_ref = tag_ptr(ret_copy, true);
13900         return ret_ref;
13901 }
13902
13903 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
13904         if (!ptr_is_owned(_res)) return;
13905         void* _res_ptr = untag_ptr(_res);
13906         CHECK_ACCESS(_res_ptr);
13907         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13908         FREE(untag_ptr(_res));
13909         COption_EventZ_free(_res_conv);
13910 }
13911
13912 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13913         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13914         *ret_copy = COption_EventZ_clone(arg);
13915         uint64_t ret_ref = tag_ptr(ret_copy, true);
13916         return ret_ref;
13917 }
13918 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
13919         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
13920         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
13921         return ret_conv;
13922 }
13923
13924 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
13925         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
13926         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13927         *ret_copy = COption_EventZ_clone(orig_conv);
13928         uint64_t ret_ref = tag_ptr(ret_copy, true);
13929         return ret_ref;
13930 }
13931
13932 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
13933         void* o_ptr = untag_ptr(o);
13934         CHECK_ACCESS(o_ptr);
13935         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13936         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
13937         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13938         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13939         return tag_ptr(ret_conv, true);
13940 }
13941
13942 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
13943         void* e_ptr = untag_ptr(e);
13944         CHECK_ACCESS(e_ptr);
13945         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13946         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13947         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13948         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13949         return tag_ptr(ret_conv, true);
13950 }
13951
13952 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
13953         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
13954         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13955         return ret_conv;
13956 }
13957
13958 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
13959         if (!ptr_is_owned(_res)) return;
13960         void* _res_ptr = untag_ptr(_res);
13961         CHECK_ACCESS(_res_ptr);
13962         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13963         FREE(untag_ptr(_res));
13964         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13965 }
13966
13967 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13968         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13969         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13970         return tag_ptr(ret_conv, true);
13971 }
13972 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
13973         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
13974         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13975         return ret_conv;
13976 }
13977
13978 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
13979         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
13980         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13981         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13982         return tag_ptr(ret_conv, true);
13983 }
13984
13985 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
13986         LDKCVec_MessageSendEventZ _res_constr;
13987         _res_constr.datalen = _res->arr_len;
13988         if (_res_constr.datalen > 0)
13989                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13990         else
13991                 _res_constr.data = NULL;
13992         uint64_t* _res_vals = _res->elems;
13993         for (size_t s = 0; s < _res_constr.datalen; s++) {
13994                 uint64_t _res_conv_18 = _res_vals[s];
13995                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
13996                 CHECK_ACCESS(_res_conv_18_ptr);
13997                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13998                 FREE(untag_ptr(_res_conv_18));
13999                 _res_constr.data[s] = _res_conv_18_conv;
14000         }
14001         FREE(_res);
14002         CVec_MessageSendEventZ_free(_res_constr);
14003 }
14004
14005 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
14006         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14007         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
14008         return tag_ptr(ret_conv, true);
14009 }
14010 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
14011         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
14012         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
14013         return ret_conv;
14014 }
14015
14016 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
14017         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
14018         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14019         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
14020         return tag_ptr(ret_conv, true);
14021 }
14022
14023 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
14024         LDKTransaction b_ref;
14025         b_ref.datalen = b->arr_len;
14026         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
14027         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
14028         b_ref.data_is_owned = true;
14029         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14030         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
14031         return tag_ptr(ret_conv, true);
14032 }
14033
14034 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
14035         if (!ptr_is_owned(_res)) return;
14036         void* _res_ptr = untag_ptr(_res);
14037         CHECK_ACCESS(_res_ptr);
14038         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
14039         FREE(untag_ptr(_res));
14040         C2Tuple_usizeTransactionZ_free(_res_conv);
14041 }
14042
14043 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
14044         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
14045         _res_constr.datalen = _res->arr_len;
14046         if (_res_constr.datalen > 0)
14047                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14048         else
14049                 _res_constr.data = NULL;
14050         uint64_t* _res_vals = _res->elems;
14051         for (size_t c = 0; c < _res_constr.datalen; c++) {
14052                 uint64_t _res_conv_28 = _res_vals[c];
14053                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
14054                 CHECK_ACCESS(_res_conv_28_ptr);
14055                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
14056                 FREE(untag_ptr(_res_conv_28));
14057                 _res_constr.data[c] = _res_conv_28_conv;
14058         }
14059         FREE(_res);
14060         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
14061 }
14062
14063 static inline uint64_t C2Tuple_TxidBlockHashZ_clone_ptr(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR arg) {
14064         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
14065         *ret_conv = C2Tuple_TxidBlockHashZ_clone(arg);
14066         return tag_ptr(ret_conv, true);
14067 }
14068 int64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone_ptr"))) TS_C2Tuple_TxidBlockHashZ_clone_ptr(uint64_t arg) {
14069         LDKC2Tuple_TxidBlockHashZ* arg_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(arg);
14070         int64_t ret_conv = C2Tuple_TxidBlockHashZ_clone_ptr(arg_conv);
14071         return ret_conv;
14072 }
14073
14074 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone"))) TS_C2Tuple_TxidBlockHashZ_clone(uint64_t orig) {
14075         LDKC2Tuple_TxidBlockHashZ* orig_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(orig);
14076         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
14077         *ret_conv = C2Tuple_TxidBlockHashZ_clone(orig_conv);
14078         return tag_ptr(ret_conv, true);
14079 }
14080
14081 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_new"))) TS_C2Tuple_TxidBlockHashZ_new(int8_tArray a, int8_tArray b) {
14082         LDKThirtyTwoBytes a_ref;
14083         CHECK(a->arr_len == 32);
14084         memcpy(a_ref.data, a->elems, 32); FREE(a);
14085         LDKThirtyTwoBytes b_ref;
14086         CHECK(b->arr_len == 32);
14087         memcpy(b_ref.data, b->elems, 32); FREE(b);
14088         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
14089         *ret_conv = C2Tuple_TxidBlockHashZ_new(a_ref, b_ref);
14090         return tag_ptr(ret_conv, true);
14091 }
14092
14093 void  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_free"))) TS_C2Tuple_TxidBlockHashZ_free(uint64_t _res) {
14094         if (!ptr_is_owned(_res)) return;
14095         void* _res_ptr = untag_ptr(_res);
14096         CHECK_ACCESS(_res_ptr);
14097         LDKC2Tuple_TxidBlockHashZ _res_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_ptr);
14098         FREE(untag_ptr(_res));
14099         C2Tuple_TxidBlockHashZ_free(_res_conv);
14100 }
14101
14102 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidBlockHashZZ_free"))) TS_CVec_C2Tuple_TxidBlockHashZZ_free(uint64_tArray _res) {
14103         LDKCVec_C2Tuple_TxidBlockHashZZ _res_constr;
14104         _res_constr.datalen = _res->arr_len;
14105         if (_res_constr.datalen > 0)
14106                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
14107         else
14108                 _res_constr.data = NULL;
14109         uint64_t* _res_vals = _res->elems;
14110         for (size_t z = 0; z < _res_constr.datalen; z++) {
14111                 uint64_t _res_conv_25 = _res_vals[z];
14112                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
14113                 CHECK_ACCESS(_res_conv_25_ptr);
14114                 LDKC2Tuple_TxidBlockHashZ _res_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_conv_25_ptr);
14115                 FREE(untag_ptr(_res_conv_25));
14116                 _res_constr.data[z] = _res_conv_25_conv;
14117         }
14118         FREE(_res);
14119         CVec_C2Tuple_TxidBlockHashZZ_free(_res_constr);
14120 }
14121
14122 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
14123         LDKCVec_MonitorEventZ _res_constr;
14124         _res_constr.datalen = _res->arr_len;
14125         if (_res_constr.datalen > 0)
14126                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14127         else
14128                 _res_constr.data = NULL;
14129         uint64_t* _res_vals = _res->elems;
14130         for (size_t o = 0; o < _res_constr.datalen; o++) {
14131                 uint64_t _res_conv_14 = _res_vals[o];
14132                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
14133                 CHECK_ACCESS(_res_conv_14_ptr);
14134                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
14135                 FREE(untag_ptr(_res_conv_14));
14136                 _res_constr.data[o] = _res_conv_14_conv;
14137         }
14138         FREE(_res);
14139         CVec_MonitorEventZ_free(_res_constr);
14140 }
14141
14142 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
14143         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14144         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
14145         return tag_ptr(ret_conv, true);
14146 }
14147 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
14148         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
14149         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
14150         return ret_conv;
14151 }
14152
14153 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
14154         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
14155         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14156         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
14157         return tag_ptr(ret_conv, true);
14158 }
14159
14160 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
14161         LDKOutPoint a_conv;
14162         a_conv.inner = untag_ptr(a);
14163         a_conv.is_owned = ptr_is_owned(a);
14164         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14165         a_conv = OutPoint_clone(&a_conv);
14166         LDKCVec_MonitorEventZ b_constr;
14167         b_constr.datalen = b->arr_len;
14168         if (b_constr.datalen > 0)
14169                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14170         else
14171                 b_constr.data = NULL;
14172         uint64_t* b_vals = b->elems;
14173         for (size_t o = 0; o < b_constr.datalen; o++) {
14174                 uint64_t b_conv_14 = b_vals[o];
14175                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
14176                 CHECK_ACCESS(b_conv_14_ptr);
14177                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
14178                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
14179                 b_constr.data[o] = b_conv_14_conv;
14180         }
14181         FREE(b);
14182         LDKPublicKey c_ref;
14183         CHECK(c->arr_len == 33);
14184         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
14185         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14186         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
14187         return tag_ptr(ret_conv, true);
14188 }
14189
14190 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
14191         if (!ptr_is_owned(_res)) return;
14192         void* _res_ptr = untag_ptr(_res);
14193         CHECK_ACCESS(_res_ptr);
14194         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
14195         FREE(untag_ptr(_res));
14196         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
14197 }
14198
14199 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
14200         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
14201         _res_constr.datalen = _res->arr_len;
14202         if (_res_constr.datalen > 0)
14203                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
14204         else
14205                 _res_constr.data = NULL;
14206         uint64_t* _res_vals = _res->elems;
14207         for (size_t x = 0; x < _res_constr.datalen; x++) {
14208                 uint64_t _res_conv_49 = _res_vals[x];
14209                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
14210                 CHECK_ACCESS(_res_conv_49_ptr);
14211                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
14212                 FREE(untag_ptr(_res_conv_49));
14213                 _res_constr.data[x] = _res_conv_49_conv;
14214         }
14215         FREE(_res);
14216         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
14217 }
14218
14219 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
14220         LDKFixedPenaltyScorer o_conv;
14221         o_conv.inner = untag_ptr(o);
14222         o_conv.is_owned = ptr_is_owned(o);
14223         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14224         o_conv = FixedPenaltyScorer_clone(&o_conv);
14225         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14226         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
14227         return tag_ptr(ret_conv, true);
14228 }
14229
14230 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
14231         void* e_ptr = untag_ptr(e);
14232         CHECK_ACCESS(e_ptr);
14233         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14234         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14235         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14236         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
14237         return tag_ptr(ret_conv, true);
14238 }
14239
14240 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
14241         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
14242         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
14243         return ret_conv;
14244 }
14245
14246 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
14247         if (!ptr_is_owned(_res)) return;
14248         void* _res_ptr = untag_ptr(_res);
14249         CHECK_ACCESS(_res_ptr);
14250         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
14251         FREE(untag_ptr(_res));
14252         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
14253 }
14254
14255 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
14256         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14257         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
14258         return tag_ptr(ret_conv, true);
14259 }
14260 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
14261         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
14262         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
14263         return ret_conv;
14264 }
14265
14266 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
14267         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
14268         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14269         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
14270         return tag_ptr(ret_conv, true);
14271 }
14272
14273 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
14274         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14275         *ret_conv = C2Tuple_u64u64Z_clone(arg);
14276         return tag_ptr(ret_conv, true);
14277 }
14278 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
14279         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
14280         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
14281         return ret_conv;
14282 }
14283
14284 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
14285         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
14286         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14287         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
14288         return tag_ptr(ret_conv, true);
14289 }
14290
14291 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
14292         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14293         *ret_conv = C2Tuple_u64u64Z_new(a, b);
14294         return tag_ptr(ret_conv, true);
14295 }
14296
14297 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
14298         if (!ptr_is_owned(_res)) return;
14299         void* _res_ptr = untag_ptr(_res);
14300         CHECK_ACCESS(_res_ptr);
14301         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
14302         FREE(untag_ptr(_res));
14303         C2Tuple_u64u64Z_free(_res_conv);
14304 }
14305
14306 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
14307         void* o_ptr = untag_ptr(o);
14308         CHECK_ACCESS(o_ptr);
14309         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
14310         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
14311         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14312         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
14313         uint64_t ret_ref = tag_ptr(ret_copy, true);
14314         return ret_ref;
14315 }
14316
14317 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
14318         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14319         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
14320         uint64_t ret_ref = tag_ptr(ret_copy, true);
14321         return ret_ref;
14322 }
14323
14324 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
14325         if (!ptr_is_owned(_res)) return;
14326         void* _res_ptr = untag_ptr(_res);
14327         CHECK_ACCESS(_res_ptr);
14328         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
14329         FREE(untag_ptr(_res));
14330         COption_C2Tuple_u64u64ZZ_free(_res_conv);
14331 }
14332
14333 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
14334         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14335         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
14336         uint64_t ret_ref = tag_ptr(ret_copy, true);
14337         return ret_ref;
14338 }
14339 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
14340         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
14341         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
14342         return ret_conv;
14343 }
14344
14345 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
14346         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
14347         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14348         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
14349         uint64_t ret_ref = tag_ptr(ret_copy, true);
14350         return ret_ref;
14351 }
14352
14353 static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) {
14354         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14355         *ret_conv = C2Tuple_Z_clone(arg);
14356         return tag_ptr(ret_conv, true);
14357 }
14358 int64_t  __attribute__((export_name("TS_C2Tuple_Z_clone_ptr"))) TS_C2Tuple_Z_clone_ptr(uint64_t arg) {
14359         LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg);
14360         int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv);
14361         return ret_conv;
14362 }
14363
14364 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_clone"))) TS_C2Tuple_Z_clone(uint64_t orig) {
14365         LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig);
14366         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14367         *ret_conv = C2Tuple_Z_clone(orig_conv);
14368         return tag_ptr(ret_conv, true);
14369 }
14370
14371 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
14372         LDKEightU16s a_ref;
14373         CHECK(a->arr_len == 8);
14374         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
14375         LDKEightU16s b_ref;
14376         CHECK(b->arr_len == 8);
14377         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
14378         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14379         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
14380         return tag_ptr(ret_conv, true);
14381 }
14382
14383 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
14384         if (!ptr_is_owned(_res)) return;
14385         void* _res_ptr = untag_ptr(_res);
14386         CHECK_ACCESS(_res_ptr);
14387         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
14388         FREE(untag_ptr(_res));
14389         C2Tuple_Z_free(_res_conv);
14390 }
14391
14392 static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) {
14393         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14394         *ret_conv = C2Tuple__u168_u168Z_clone(arg);
14395         return tag_ptr(ret_conv, true);
14396 }
14397 int64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone_ptr"))) TS_C2Tuple__u168_u168Z_clone_ptr(uint64_t arg) {
14398         LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg);
14399         int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv);
14400         return ret_conv;
14401 }
14402
14403 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone"))) TS_C2Tuple__u168_u168Z_clone(uint64_t orig) {
14404         LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig);
14405         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14406         *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv);
14407         return tag_ptr(ret_conv, true);
14408 }
14409
14410 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_new"))) TS_C2Tuple__u168_u168Z_new(int16_tArray a, int16_tArray b) {
14411         LDKEightU16s a_ref;
14412         CHECK(a->arr_len == 8);
14413         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
14414         LDKEightU16s b_ref;
14415         CHECK(b->arr_len == 8);
14416         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
14417         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14418         *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref);
14419         return tag_ptr(ret_conv, true);
14420 }
14421
14422 void  __attribute__((export_name("TS_C2Tuple__u168_u168Z_free"))) TS_C2Tuple__u168_u168Z_free(uint64_t _res) {
14423         if (!ptr_is_owned(_res)) return;
14424         void* _res_ptr = untag_ptr(_res);
14425         CHECK_ACCESS(_res_ptr);
14426         LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr);
14427         FREE(untag_ptr(_res));
14428         C2Tuple__u168_u168Z_free(_res_conv);
14429 }
14430
14431 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_some"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_some(uint64_t o) {
14432         void* o_ptr = untag_ptr(o);
14433         CHECK_ACCESS(o_ptr);
14434         LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr);
14435         o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o));
14436         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14437         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv);
14438         uint64_t ret_ref = tag_ptr(ret_copy, true);
14439         return ret_ref;
14440 }
14441
14442 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_none"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_none() {
14443         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14444         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none();
14445         uint64_t ret_ref = tag_ptr(ret_copy, true);
14446         return ret_ref;
14447 }
14448
14449 void  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_free"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_free(uint64_t _res) {
14450         if (!ptr_is_owned(_res)) return;
14451         void* _res_ptr = untag_ptr(_res);
14452         CHECK_ACCESS(_res_ptr);
14453         LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr);
14454         FREE(untag_ptr(_res));
14455         COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv);
14456 }
14457
14458 static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) {
14459         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14460         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg);
14461         uint64_t ret_ref = tag_ptr(ret_copy, true);
14462         return ret_ref;
14463 }
14464 int64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(uint64_t arg) {
14465         LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg);
14466         int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv);
14467         return ret_conv;
14468 }
14469
14470 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone(uint64_t orig) {
14471         LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig);
14472         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14473         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv);
14474         uint64_t ret_ref = tag_ptr(ret_copy, true);
14475         return ret_ref;
14476 }
14477
14478 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
14479         LDKCVec_NodeIdZ _res_constr;
14480         _res_constr.datalen = _res->arr_len;
14481         if (_res_constr.datalen > 0)
14482                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
14483         else
14484                 _res_constr.data = NULL;
14485         uint64_t* _res_vals = _res->elems;
14486         for (size_t i = 0; i < _res_constr.datalen; i++) {
14487                 uint64_t _res_conv_8 = _res_vals[i];
14488                 LDKNodeId _res_conv_8_conv;
14489                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
14490                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
14491                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
14492                 _res_constr.data[i] = _res_conv_8_conv;
14493         }
14494         FREE(_res);
14495         CVec_NodeIdZ_free(_res_constr);
14496 }
14497
14498 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
14499         LDKProbabilisticScorer o_conv;
14500         o_conv.inner = untag_ptr(o);
14501         o_conv.is_owned = ptr_is_owned(o);
14502         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14503         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
14504         
14505         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14506         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
14507         return tag_ptr(ret_conv, true);
14508 }
14509
14510 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
14511         void* e_ptr = untag_ptr(e);
14512         CHECK_ACCESS(e_ptr);
14513         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14514         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14515         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14516         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
14517         return tag_ptr(ret_conv, true);
14518 }
14519
14520 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
14521         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
14522         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
14523         return ret_conv;
14524 }
14525
14526 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
14527         if (!ptr_is_owned(_res)) return;
14528         void* _res_ptr = untag_ptr(_res);
14529         CHECK_ACCESS(_res_ptr);
14530         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
14531         FREE(untag_ptr(_res));
14532         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
14533 }
14534
14535 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
14536         LDKInitFeatures o_conv;
14537         o_conv.inner = untag_ptr(o);
14538         o_conv.is_owned = ptr_is_owned(o);
14539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14540         o_conv = InitFeatures_clone(&o_conv);
14541         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14542         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
14543         return tag_ptr(ret_conv, true);
14544 }
14545
14546 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
14547         void* e_ptr = untag_ptr(e);
14548         CHECK_ACCESS(e_ptr);
14549         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14550         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14551         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14552         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
14553         return tag_ptr(ret_conv, true);
14554 }
14555
14556 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14557         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
14558         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
14559         return ret_conv;
14560 }
14561
14562 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
14563         if (!ptr_is_owned(_res)) return;
14564         void* _res_ptr = untag_ptr(_res);
14565         CHECK_ACCESS(_res_ptr);
14566         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
14567         FREE(untag_ptr(_res));
14568         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
14569 }
14570
14571 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14572         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14573         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
14574         return tag_ptr(ret_conv, true);
14575 }
14576 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14577         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
14578         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14579         return ret_conv;
14580 }
14581
14582 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
14583         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
14584         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14585         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
14586         return tag_ptr(ret_conv, true);
14587 }
14588
14589 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
14590         LDKChannelFeatures o_conv;
14591         o_conv.inner = untag_ptr(o);
14592         o_conv.is_owned = ptr_is_owned(o);
14593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14594         o_conv = ChannelFeatures_clone(&o_conv);
14595         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14596         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
14597         return tag_ptr(ret_conv, true);
14598 }
14599
14600 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
14601         void* e_ptr = untag_ptr(e);
14602         CHECK_ACCESS(e_ptr);
14603         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14604         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14605         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14606         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
14607         return tag_ptr(ret_conv, true);
14608 }
14609
14610 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14611         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
14612         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
14613         return ret_conv;
14614 }
14615
14616 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
14617         if (!ptr_is_owned(_res)) return;
14618         void* _res_ptr = untag_ptr(_res);
14619         CHECK_ACCESS(_res_ptr);
14620         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
14621         FREE(untag_ptr(_res));
14622         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
14623 }
14624
14625 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14626         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14627         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
14628         return tag_ptr(ret_conv, true);
14629 }
14630 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14631         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
14632         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14633         return ret_conv;
14634 }
14635
14636 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
14637         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
14638         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14639         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
14640         return tag_ptr(ret_conv, true);
14641 }
14642
14643 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
14644         LDKNodeFeatures o_conv;
14645         o_conv.inner = untag_ptr(o);
14646         o_conv.is_owned = ptr_is_owned(o);
14647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14648         o_conv = NodeFeatures_clone(&o_conv);
14649         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14650         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
14651         return tag_ptr(ret_conv, true);
14652 }
14653
14654 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
14655         void* e_ptr = untag_ptr(e);
14656         CHECK_ACCESS(e_ptr);
14657         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14658         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14659         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14660         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
14661         return tag_ptr(ret_conv, true);
14662 }
14663
14664 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14665         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
14666         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
14667         return ret_conv;
14668 }
14669
14670 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
14671         if (!ptr_is_owned(_res)) return;
14672         void* _res_ptr = untag_ptr(_res);
14673         CHECK_ACCESS(_res_ptr);
14674         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
14675         FREE(untag_ptr(_res));
14676         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
14677 }
14678
14679 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14680         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14681         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
14682         return tag_ptr(ret_conv, true);
14683 }
14684 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14685         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
14686         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14687         return ret_conv;
14688 }
14689
14690 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14691         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
14692         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14693         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
14694         return tag_ptr(ret_conv, true);
14695 }
14696
14697 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
14698         LDKInvoiceFeatures o_conv;
14699         o_conv.inner = untag_ptr(o);
14700         o_conv.is_owned = ptr_is_owned(o);
14701         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14702         o_conv = InvoiceFeatures_clone(&o_conv);
14703         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14704         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
14705         return tag_ptr(ret_conv, true);
14706 }
14707
14708 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
14709         void* e_ptr = untag_ptr(e);
14710         CHECK_ACCESS(e_ptr);
14711         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14712         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14713         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14714         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
14715         return tag_ptr(ret_conv, true);
14716 }
14717
14718 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14719         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
14720         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
14721         return ret_conv;
14722 }
14723
14724 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
14725         if (!ptr_is_owned(_res)) return;
14726         void* _res_ptr = untag_ptr(_res);
14727         CHECK_ACCESS(_res_ptr);
14728         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
14729         FREE(untag_ptr(_res));
14730         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
14731 }
14732
14733 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14734         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14735         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
14736         return tag_ptr(ret_conv, true);
14737 }
14738 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14739         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
14740         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14741         return ret_conv;
14742 }
14743
14744 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
14745         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
14746         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14747         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
14748         return tag_ptr(ret_conv, true);
14749 }
14750
14751 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
14752         LDKBlindedHopFeatures o_conv;
14753         o_conv.inner = untag_ptr(o);
14754         o_conv.is_owned = ptr_is_owned(o);
14755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14756         o_conv = BlindedHopFeatures_clone(&o_conv);
14757         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14758         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
14759         return tag_ptr(ret_conv, true);
14760 }
14761
14762 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
14763         void* e_ptr = untag_ptr(e);
14764         CHECK_ACCESS(e_ptr);
14765         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14766         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14767         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14768         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
14769         return tag_ptr(ret_conv, true);
14770 }
14771
14772 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14773         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
14774         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
14775         return ret_conv;
14776 }
14777
14778 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
14779         if (!ptr_is_owned(_res)) return;
14780         void* _res_ptr = untag_ptr(_res);
14781         CHECK_ACCESS(_res_ptr);
14782         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
14783         FREE(untag_ptr(_res));
14784         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
14785 }
14786
14787 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14788         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14789         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
14790         return tag_ptr(ret_conv, true);
14791 }
14792 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14793         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
14794         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14795         return ret_conv;
14796 }
14797
14798 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
14799         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
14800         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14801         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
14802         return tag_ptr(ret_conv, true);
14803 }
14804
14805 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
14806         LDKChannelTypeFeatures o_conv;
14807         o_conv.inner = untag_ptr(o);
14808         o_conv.is_owned = ptr_is_owned(o);
14809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14810         o_conv = ChannelTypeFeatures_clone(&o_conv);
14811         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14812         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14813         return tag_ptr(ret_conv, true);
14814 }
14815
14816 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14817         void* e_ptr = untag_ptr(e);
14818         CHECK_ACCESS(e_ptr);
14819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14821         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14822         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14823         return tag_ptr(ret_conv, true);
14824 }
14825
14826 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14827         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14828         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14829         return ret_conv;
14830 }
14831
14832 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14833         if (!ptr_is_owned(_res)) return;
14834         void* _res_ptr = untag_ptr(_res);
14835         CHECK_ACCESS(_res_ptr);
14836         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14837         FREE(untag_ptr(_res));
14838         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14839 }
14840
14841 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14842         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14843         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14844         return tag_ptr(ret_conv, true);
14845 }
14846 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14847         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14848         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14849         return ret_conv;
14850 }
14851
14852 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14853         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14854         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14855         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14856         return tag_ptr(ret_conv, true);
14857 }
14858
14859 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
14860         LDKNodeId o_conv;
14861         o_conv.inner = untag_ptr(o);
14862         o_conv.is_owned = ptr_is_owned(o);
14863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14864         o_conv = NodeId_clone(&o_conv);
14865         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14866         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14867         return tag_ptr(ret_conv, true);
14868 }
14869
14870 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
14871         void* e_ptr = untag_ptr(e);
14872         CHECK_ACCESS(e_ptr);
14873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14875         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14876         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14877         return tag_ptr(ret_conv, true);
14878 }
14879
14880 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
14881         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
14882         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
14883         return ret_conv;
14884 }
14885
14886 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
14887         if (!ptr_is_owned(_res)) return;
14888         void* _res_ptr = untag_ptr(_res);
14889         CHECK_ACCESS(_res_ptr);
14890         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14891         FREE(untag_ptr(_res));
14892         CResult_NodeIdDecodeErrorZ_free(_res_conv);
14893 }
14894
14895 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
14896         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14897         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
14898         return tag_ptr(ret_conv, true);
14899 }
14900 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
14901         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
14902         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
14903         return ret_conv;
14904 }
14905
14906 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
14907         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
14908         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14909         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14910         return tag_ptr(ret_conv, true);
14911 }
14912
14913 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
14914         void* o_ptr = untag_ptr(o);
14915         CHECK_ACCESS(o_ptr);
14916         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
14917         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
14918         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14919         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
14920         return tag_ptr(ret_conv, true);
14921 }
14922
14923 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
14924         void* e_ptr = untag_ptr(e);
14925         CHECK_ACCESS(e_ptr);
14926         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14927         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14928         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14929         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
14930         return tag_ptr(ret_conv, true);
14931 }
14932
14933 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
14934         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
14935         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
14936         return ret_conv;
14937 }
14938
14939 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
14940         if (!ptr_is_owned(_res)) return;
14941         void* _res_ptr = untag_ptr(_res);
14942         CHECK_ACCESS(_res_ptr);
14943         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
14944         FREE(untag_ptr(_res));
14945         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14946 }
14947
14948 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14949         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14950         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14951         return tag_ptr(ret_conv, true);
14952 }
14953 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
14954         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
14955         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14956         return ret_conv;
14957 }
14958
14959 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
14960         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
14961         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14962         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14963         return tag_ptr(ret_conv, true);
14964 }
14965
14966 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
14967         void* o_ptr = untag_ptr(o);
14968         CHECK_ACCESS(o_ptr);
14969         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
14970         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
14971                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14972                 LDKUtxoLookup_JCalls_cloned(&o_conv);
14973         }
14974         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
14975         *ret_copy = COption_UtxoLookupZ_some(o_conv);
14976         uint64_t ret_ref = tag_ptr(ret_copy, true);
14977         return ret_ref;
14978 }
14979
14980 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
14981         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
14982         *ret_copy = COption_UtxoLookupZ_none();
14983         uint64_t ret_ref = tag_ptr(ret_copy, true);
14984         return ret_ref;
14985 }
14986
14987 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
14988         if (!ptr_is_owned(_res)) return;
14989         void* _res_ptr = untag_ptr(_res);
14990         CHECK_ACCESS(_res_ptr);
14991         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
14992         FREE(untag_ptr(_res));
14993         COption_UtxoLookupZ_free(_res_conv);
14994 }
14995
14996 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
14997         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14998         *ret_conv = CResult_boolLightningErrorZ_ok(o);
14999         return tag_ptr(ret_conv, true);
15000 }
15001
15002 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
15003         LDKLightningError e_conv;
15004         e_conv.inner = untag_ptr(e);
15005         e_conv.is_owned = ptr_is_owned(e);
15006         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15007         e_conv = LightningError_clone(&e_conv);
15008         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15009         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
15010         return tag_ptr(ret_conv, true);
15011 }
15012
15013 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
15014         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
15015         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
15016         return ret_conv;
15017 }
15018
15019 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
15020         if (!ptr_is_owned(_res)) return;
15021         void* _res_ptr = untag_ptr(_res);
15022         CHECK_ACCESS(_res_ptr);
15023         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
15024         FREE(untag_ptr(_res));
15025         CResult_boolLightningErrorZ_free(_res_conv);
15026 }
15027
15028 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
15029         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15030         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
15031         return tag_ptr(ret_conv, true);
15032 }
15033 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
15034         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
15035         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
15036         return ret_conv;
15037 }
15038
15039 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
15040         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
15041         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15042         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
15043         return tag_ptr(ret_conv, true);
15044 }
15045
15046 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
15047         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15048         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
15049         return tag_ptr(ret_conv, true);
15050 }
15051 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
15052         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
15053         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
15054         return ret_conv;
15055 }
15056
15057 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
15058         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
15059         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15060         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
15061         return tag_ptr(ret_conv, true);
15062 }
15063
15064 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
15065         LDKChannelAnnouncement a_conv;
15066         a_conv.inner = untag_ptr(a);
15067         a_conv.is_owned = ptr_is_owned(a);
15068         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15069         a_conv = ChannelAnnouncement_clone(&a_conv);
15070         LDKChannelUpdate b_conv;
15071         b_conv.inner = untag_ptr(b);
15072         b_conv.is_owned = ptr_is_owned(b);
15073         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15074         b_conv = ChannelUpdate_clone(&b_conv);
15075         LDKChannelUpdate c_conv;
15076         c_conv.inner = untag_ptr(c);
15077         c_conv.is_owned = ptr_is_owned(c);
15078         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
15079         c_conv = ChannelUpdate_clone(&c_conv);
15080         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15081         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
15082         return tag_ptr(ret_conv, true);
15083 }
15084
15085 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
15086         if (!ptr_is_owned(_res)) return;
15087         void* _res_ptr = untag_ptr(_res);
15088         CHECK_ACCESS(_res_ptr);
15089         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
15090         FREE(untag_ptr(_res));
15091         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
15092 }
15093
15094 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
15095         void* o_ptr = untag_ptr(o);
15096         CHECK_ACCESS(o_ptr);
15097         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
15098         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
15099         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15100         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
15101         uint64_t ret_ref = tag_ptr(ret_copy, true);
15102         return ret_ref;
15103 }
15104
15105 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
15106         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15107         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
15108         uint64_t ret_ref = tag_ptr(ret_copy, true);
15109         return ret_ref;
15110 }
15111
15112 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
15113         if (!ptr_is_owned(_res)) return;
15114         void* _res_ptr = untag_ptr(_res);
15115         CHECK_ACCESS(_res_ptr);
15116         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
15117         FREE(untag_ptr(_res));
15118         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
15119 }
15120
15121 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
15122         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15123         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
15124         uint64_t ret_ref = tag_ptr(ret_copy, true);
15125         return ret_ref;
15126 }
15127 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
15128         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
15129         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
15130         return ret_conv;
15131 }
15132
15133 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
15134         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
15135         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15136         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
15137         uint64_t ret_ref = tag_ptr(ret_copy, true);
15138         return ret_ref;
15139 }
15140
15141 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
15142         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15143         *ret_conv = CResult_NoneLightningErrorZ_ok();
15144         return tag_ptr(ret_conv, true);
15145 }
15146
15147 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
15148         LDKLightningError e_conv;
15149         e_conv.inner = untag_ptr(e);
15150         e_conv.is_owned = ptr_is_owned(e);
15151         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15152         e_conv = LightningError_clone(&e_conv);
15153         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15154         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
15155         return tag_ptr(ret_conv, true);
15156 }
15157
15158 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
15159         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
15160         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
15161         return ret_conv;
15162 }
15163
15164 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
15165         if (!ptr_is_owned(_res)) return;
15166         void* _res_ptr = untag_ptr(_res);
15167         CHECK_ACCESS(_res_ptr);
15168         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
15169         FREE(untag_ptr(_res));
15170         CResult_NoneLightningErrorZ_free(_res_conv);
15171 }
15172
15173 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
15174         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15175         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
15176         return tag_ptr(ret_conv, true);
15177 }
15178 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
15179         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
15180         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
15181         return ret_conv;
15182 }
15183
15184 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
15185         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
15186         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15187         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
15188         return tag_ptr(ret_conv, true);
15189 }
15190
15191 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
15192         LDKChannelUpdateInfo o_conv;
15193         o_conv.inner = untag_ptr(o);
15194         o_conv.is_owned = ptr_is_owned(o);
15195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15196         o_conv = ChannelUpdateInfo_clone(&o_conv);
15197         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15198         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
15199         return tag_ptr(ret_conv, true);
15200 }
15201
15202 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
15203         void* e_ptr = untag_ptr(e);
15204         CHECK_ACCESS(e_ptr);
15205         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15206         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15207         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15208         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
15209         return tag_ptr(ret_conv, true);
15210 }
15211
15212 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
15213         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
15214         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
15215         return ret_conv;
15216 }
15217
15218 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
15219         if (!ptr_is_owned(_res)) return;
15220         void* _res_ptr = untag_ptr(_res);
15221         CHECK_ACCESS(_res_ptr);
15222         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
15223         FREE(untag_ptr(_res));
15224         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
15225 }
15226
15227 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
15228         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15229         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
15230         return tag_ptr(ret_conv, true);
15231 }
15232 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15233         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
15234         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
15235         return ret_conv;
15236 }
15237
15238 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
15239         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
15240         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15241         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
15242         return tag_ptr(ret_conv, true);
15243 }
15244
15245 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
15246         LDKChannelInfo o_conv;
15247         o_conv.inner = untag_ptr(o);
15248         o_conv.is_owned = ptr_is_owned(o);
15249         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15250         o_conv = ChannelInfo_clone(&o_conv);
15251         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15252         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
15253         return tag_ptr(ret_conv, true);
15254 }
15255
15256 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
15257         void* e_ptr = untag_ptr(e);
15258         CHECK_ACCESS(e_ptr);
15259         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15260         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15261         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15262         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
15263         return tag_ptr(ret_conv, true);
15264 }
15265
15266 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
15267         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
15268         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
15269         return ret_conv;
15270 }
15271
15272 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
15273         if (!ptr_is_owned(_res)) return;
15274         void* _res_ptr = untag_ptr(_res);
15275         CHECK_ACCESS(_res_ptr);
15276         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
15277         FREE(untag_ptr(_res));
15278         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
15279 }
15280
15281 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
15282         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15283         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
15284         return tag_ptr(ret_conv, true);
15285 }
15286 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15287         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
15288         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
15289         return ret_conv;
15290 }
15291
15292 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
15293         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
15294         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15295         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
15296         return tag_ptr(ret_conv, true);
15297 }
15298
15299 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
15300         LDKRoutingFees o_conv;
15301         o_conv.inner = untag_ptr(o);
15302         o_conv.is_owned = ptr_is_owned(o);
15303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15304         o_conv = RoutingFees_clone(&o_conv);
15305         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15306         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
15307         return tag_ptr(ret_conv, true);
15308 }
15309
15310 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
15311         void* e_ptr = untag_ptr(e);
15312         CHECK_ACCESS(e_ptr);
15313         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15314         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15315         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15316         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
15317         return tag_ptr(ret_conv, true);
15318 }
15319
15320 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
15321         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
15322         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
15323         return ret_conv;
15324 }
15325
15326 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
15327         if (!ptr_is_owned(_res)) return;
15328         void* _res_ptr = untag_ptr(_res);
15329         CHECK_ACCESS(_res_ptr);
15330         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
15331         FREE(untag_ptr(_res));
15332         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
15333 }
15334
15335 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
15336         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15337         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
15338         return tag_ptr(ret_conv, true);
15339 }
15340 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
15341         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
15342         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
15343         return ret_conv;
15344 }
15345
15346 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
15347         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
15348         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15349         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
15350         return tag_ptr(ret_conv, true);
15351 }
15352
15353 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
15354         LDKCVec_NetAddressZ _res_constr;
15355         _res_constr.datalen = _res->arr_len;
15356         if (_res_constr.datalen > 0)
15357                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15358         else
15359                 _res_constr.data = NULL;
15360         uint64_t* _res_vals = _res->elems;
15361         for (size_t m = 0; m < _res_constr.datalen; m++) {
15362                 uint64_t _res_conv_12 = _res_vals[m];
15363                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
15364                 CHECK_ACCESS(_res_conv_12_ptr);
15365                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
15366                 FREE(untag_ptr(_res_conv_12));
15367                 _res_constr.data[m] = _res_conv_12_conv;
15368         }
15369         FREE(_res);
15370         CVec_NetAddressZ_free(_res_constr);
15371 }
15372
15373 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
15374         LDKNodeAnnouncementInfo o_conv;
15375         o_conv.inner = untag_ptr(o);
15376         o_conv.is_owned = ptr_is_owned(o);
15377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15378         o_conv = NodeAnnouncementInfo_clone(&o_conv);
15379         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15380         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
15381         return tag_ptr(ret_conv, true);
15382 }
15383
15384 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
15385         void* e_ptr = untag_ptr(e);
15386         CHECK_ACCESS(e_ptr);
15387         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15388         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15389         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15390         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
15391         return tag_ptr(ret_conv, true);
15392 }
15393
15394 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
15395         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
15396         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
15397         return ret_conv;
15398 }
15399
15400 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
15401         if (!ptr_is_owned(_res)) return;
15402         void* _res_ptr = untag_ptr(_res);
15403         CHECK_ACCESS(_res_ptr);
15404         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
15405         FREE(untag_ptr(_res));
15406         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
15407 }
15408
15409 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
15410         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15411         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
15412         return tag_ptr(ret_conv, true);
15413 }
15414 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15415         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
15416         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
15417         return ret_conv;
15418 }
15419
15420 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
15421         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
15422         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15423         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
15424         return tag_ptr(ret_conv, true);
15425 }
15426
15427 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
15428         LDKNodeAlias o_conv;
15429         o_conv.inner = untag_ptr(o);
15430         o_conv.is_owned = ptr_is_owned(o);
15431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15432         o_conv = NodeAlias_clone(&o_conv);
15433         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15434         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
15435         return tag_ptr(ret_conv, true);
15436 }
15437
15438 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
15439         void* e_ptr = untag_ptr(e);
15440         CHECK_ACCESS(e_ptr);
15441         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15442         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15443         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15444         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
15445         return tag_ptr(ret_conv, true);
15446 }
15447
15448 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
15449         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
15450         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
15451         return ret_conv;
15452 }
15453
15454 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
15455         if (!ptr_is_owned(_res)) return;
15456         void* _res_ptr = untag_ptr(_res);
15457         CHECK_ACCESS(_res_ptr);
15458         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
15459         FREE(untag_ptr(_res));
15460         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
15461 }
15462
15463 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
15464         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15465         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
15466         return tag_ptr(ret_conv, true);
15467 }
15468 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
15469         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
15470         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
15471         return ret_conv;
15472 }
15473
15474 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
15475         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
15476         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15477         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
15478         return tag_ptr(ret_conv, true);
15479 }
15480
15481 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
15482         LDKNodeInfo o_conv;
15483         o_conv.inner = untag_ptr(o);
15484         o_conv.is_owned = ptr_is_owned(o);
15485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15486         o_conv = NodeInfo_clone(&o_conv);
15487         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15488         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
15489         return tag_ptr(ret_conv, true);
15490 }
15491
15492 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
15493         void* e_ptr = untag_ptr(e);
15494         CHECK_ACCESS(e_ptr);
15495         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15496         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15497         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15498         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
15499         return tag_ptr(ret_conv, true);
15500 }
15501
15502 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
15503         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
15504         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
15505         return ret_conv;
15506 }
15507
15508 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
15509         if (!ptr_is_owned(_res)) return;
15510         void* _res_ptr = untag_ptr(_res);
15511         CHECK_ACCESS(_res_ptr);
15512         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
15513         FREE(untag_ptr(_res));
15514         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
15515 }
15516
15517 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
15518         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15519         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
15520         return tag_ptr(ret_conv, true);
15521 }
15522 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15523         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
15524         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
15525         return ret_conv;
15526 }
15527
15528 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
15529         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
15530         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15531         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
15532         return tag_ptr(ret_conv, true);
15533 }
15534
15535 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
15536         LDKNetworkGraph o_conv;
15537         o_conv.inner = untag_ptr(o);
15538         o_conv.is_owned = ptr_is_owned(o);
15539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15540         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
15541         
15542         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15543         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
15544         return tag_ptr(ret_conv, true);
15545 }
15546
15547 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
15548         void* e_ptr = untag_ptr(e);
15549         CHECK_ACCESS(e_ptr);
15550         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15551         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15552         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15553         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
15554         return tag_ptr(ret_conv, true);
15555 }
15556
15557 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
15558         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
15559         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
15560         return ret_conv;
15561 }
15562
15563 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
15564         if (!ptr_is_owned(_res)) return;
15565         void* _res_ptr = untag_ptr(_res);
15566         CHECK_ACCESS(_res_ptr);
15567         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
15568         FREE(untag_ptr(_res));
15569         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
15570 }
15571
15572 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
15573         LDKCVec_NetAddressZ o_constr;
15574         o_constr.datalen = o->arr_len;
15575         if (o_constr.datalen > 0)
15576                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15577         else
15578                 o_constr.data = NULL;
15579         uint64_t* o_vals = o->elems;
15580         for (size_t m = 0; m < o_constr.datalen; m++) {
15581                 uint64_t o_conv_12 = o_vals[m];
15582                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
15583                 CHECK_ACCESS(o_conv_12_ptr);
15584                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
15585                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
15586                 o_constr.data[m] = o_conv_12_conv;
15587         }
15588         FREE(o);
15589         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15590         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
15591         uint64_t ret_ref = tag_ptr(ret_copy, true);
15592         return ret_ref;
15593 }
15594
15595 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
15596         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15597         *ret_copy = COption_CVec_NetAddressZZ_none();
15598         uint64_t ret_ref = tag_ptr(ret_copy, true);
15599         return ret_ref;
15600 }
15601
15602 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
15603         if (!ptr_is_owned(_res)) return;
15604         void* _res_ptr = untag_ptr(_res);
15605         CHECK_ACCESS(_res_ptr);
15606         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
15607         FREE(untag_ptr(_res));
15608         COption_CVec_NetAddressZZ_free(_res_conv);
15609 }
15610
15611 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
15612         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15613         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
15614         uint64_t ret_ref = tag_ptr(ret_copy, true);
15615         return ret_ref;
15616 }
15617 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
15618         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
15619         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
15620         return ret_conv;
15621 }
15622
15623 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
15624         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
15625         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15626         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
15627         uint64_t ret_ref = tag_ptr(ret_copy, true);
15628         return ret_ref;
15629 }
15630
15631 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15632         LDKDelayedPaymentOutputDescriptor o_conv;
15633         o_conv.inner = untag_ptr(o);
15634         o_conv.is_owned = ptr_is_owned(o);
15635         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15636         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
15637         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15638         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15639         return tag_ptr(ret_conv, true);
15640 }
15641
15642 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15643         void* e_ptr = untag_ptr(e);
15644         CHECK_ACCESS(e_ptr);
15645         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15646         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15647         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15648         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15649         return tag_ptr(ret_conv, true);
15650 }
15651
15652 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15653         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15654         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15655         return ret_conv;
15656 }
15657
15658 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15659         if (!ptr_is_owned(_res)) return;
15660         void* _res_ptr = untag_ptr(_res);
15661         CHECK_ACCESS(_res_ptr);
15662         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15663         FREE(untag_ptr(_res));
15664         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15665 }
15666
15667 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15668         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15669         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15670         return tag_ptr(ret_conv, true);
15671 }
15672 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15673         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15674         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15675         return ret_conv;
15676 }
15677
15678 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15679         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15680         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15681         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15682         return tag_ptr(ret_conv, true);
15683 }
15684
15685 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15686         LDKStaticPaymentOutputDescriptor o_conv;
15687         o_conv.inner = untag_ptr(o);
15688         o_conv.is_owned = ptr_is_owned(o);
15689         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15690         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15691         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15692         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15693         return tag_ptr(ret_conv, true);
15694 }
15695
15696 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15697         void* e_ptr = untag_ptr(e);
15698         CHECK_ACCESS(e_ptr);
15699         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15700         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15701         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15702         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15703         return tag_ptr(ret_conv, true);
15704 }
15705
15706 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15707         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15708         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15709         return ret_conv;
15710 }
15711
15712 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15713         if (!ptr_is_owned(_res)) return;
15714         void* _res_ptr = untag_ptr(_res);
15715         CHECK_ACCESS(_res_ptr);
15716         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15717         FREE(untag_ptr(_res));
15718         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15719 }
15720
15721 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15722         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15723         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15724         return tag_ptr(ret_conv, true);
15725 }
15726 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15727         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15728         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15729         return ret_conv;
15730 }
15731
15732 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15733         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15734         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15735         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15736         return tag_ptr(ret_conv, true);
15737 }
15738
15739 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15740         void* o_ptr = untag_ptr(o);
15741         CHECK_ACCESS(o_ptr);
15742         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15743         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
15744         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15745         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15746         return tag_ptr(ret_conv, true);
15747 }
15748
15749 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15750         void* e_ptr = untag_ptr(e);
15751         CHECK_ACCESS(e_ptr);
15752         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15753         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15754         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15755         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15756         return tag_ptr(ret_conv, true);
15757 }
15758
15759 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15760         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15761         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15762         return ret_conv;
15763 }
15764
15765 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15766         if (!ptr_is_owned(_res)) return;
15767         void* _res_ptr = untag_ptr(_res);
15768         CHECK_ACCESS(_res_ptr);
15769         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15770         FREE(untag_ptr(_res));
15771         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15772 }
15773
15774 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15775         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15776         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15777         return tag_ptr(ret_conv, true);
15778 }
15779 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15780         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15781         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15782         return ret_conv;
15783 }
15784
15785 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15786         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15787         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15788         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15789         return tag_ptr(ret_conv, true);
15790 }
15791
15792 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
15793         LDKCVec_PaymentPreimageZ _res_constr;
15794         _res_constr.datalen = _res->arr_len;
15795         if (_res_constr.datalen > 0)
15796                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
15797         else
15798                 _res_constr.data = NULL;
15799         int8_tArray* _res_vals = (void*) _res->elems;
15800         for (size_t m = 0; m < _res_constr.datalen; m++) {
15801                 int8_tArray _res_conv_12 = _res_vals[m];
15802                 LDKThirtyTwoBytes _res_conv_12_ref;
15803                 CHECK(_res_conv_12->arr_len == 32);
15804                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15805                 _res_constr.data[m] = _res_conv_12_ref;
15806         }
15807         FREE(_res);
15808         CVec_PaymentPreimageZ_free(_res_constr);
15809 }
15810
15811 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15812         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15813         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15814         return tag_ptr(ret_conv, true);
15815 }
15816 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
15817         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
15818         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15819         return ret_conv;
15820 }
15821
15822 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
15823         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
15824         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15825         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15826         return tag_ptr(ret_conv, true);
15827 }
15828
15829 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15830         LDKSignature a_ref;
15831         CHECK(a->arr_len == 64);
15832         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15833         LDKCVec_SignatureZ b_constr;
15834         b_constr.datalen = b->arr_len;
15835         if (b_constr.datalen > 0)
15836                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15837         else
15838                 b_constr.data = NULL;
15839         int8_tArray* b_vals = (void*) b->elems;
15840         for (size_t m = 0; m < b_constr.datalen; m++) {
15841                 int8_tArray b_conv_12 = b_vals[m];
15842                 LDKSignature b_conv_12_ref;
15843                 CHECK(b_conv_12->arr_len == 64);
15844                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
15845                 b_constr.data[m] = b_conv_12_ref;
15846         }
15847         FREE(b);
15848         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15849         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15850         return tag_ptr(ret_conv, true);
15851 }
15852
15853 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
15854         if (!ptr_is_owned(_res)) return;
15855         void* _res_ptr = untag_ptr(_res);
15856         CHECK_ACCESS(_res_ptr);
15857         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15858         FREE(untag_ptr(_res));
15859         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15860 }
15861
15862 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
15863         void* o_ptr = untag_ptr(o);
15864         CHECK_ACCESS(o_ptr);
15865         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15866         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
15867         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15868         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15869         return tag_ptr(ret_conv, true);
15870 }
15871
15872 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15873         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15874         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15875         return tag_ptr(ret_conv, true);
15876 }
15877
15878 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
15879         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
15880         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15881         return ret_conv;
15882 }
15883
15884 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
15885         if (!ptr_is_owned(_res)) return;
15886         void* _res_ptr = untag_ptr(_res);
15887         CHECK_ACCESS(_res_ptr);
15888         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15889         FREE(untag_ptr(_res));
15890         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15891 }
15892
15893 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15894         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15895         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15896         return tag_ptr(ret_conv, true);
15897 }
15898 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
15899         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
15900         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15901         return ret_conv;
15902 }
15903
15904 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
15905         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
15906         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15907         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15908         return tag_ptr(ret_conv, true);
15909 }
15910
15911 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15912         LDKSignature o_ref;
15913         CHECK(o->arr_len == 64);
15914         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
15915         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15916         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15917         return tag_ptr(ret_conv, true);
15918 }
15919
15920 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15921         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15922         *ret_conv = CResult_SignatureNoneZ_err();
15923         return tag_ptr(ret_conv, true);
15924 }
15925
15926 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
15927         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
15928         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
15929         return ret_conv;
15930 }
15931
15932 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
15933         if (!ptr_is_owned(_res)) return;
15934         void* _res_ptr = untag_ptr(_res);
15935         CHECK_ACCESS(_res_ptr);
15936         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15937         FREE(untag_ptr(_res));
15938         CResult_SignatureNoneZ_free(_res_conv);
15939 }
15940
15941 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15942         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15943         *ret_conv = CResult_SignatureNoneZ_clone(arg);
15944         return tag_ptr(ret_conv, true);
15945 }
15946 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
15947         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
15948         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15949         return ret_conv;
15950 }
15951
15952 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
15953         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
15954         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15955         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15956         return tag_ptr(ret_conv, true);
15957 }
15958
15959 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
15960         LDKPublicKey o_ref;
15961         CHECK(o->arr_len == 33);
15962         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
15963         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15964         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
15965         return tag_ptr(ret_conv, true);
15966 }
15967
15968 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
15969         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15970         *ret_conv = CResult_PublicKeyNoneZ_err();
15971         return tag_ptr(ret_conv, true);
15972 }
15973
15974 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
15975         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
15976         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
15977         return ret_conv;
15978 }
15979
15980 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
15981         if (!ptr_is_owned(_res)) return;
15982         void* _res_ptr = untag_ptr(_res);
15983         CHECK_ACCESS(_res_ptr);
15984         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
15985         FREE(untag_ptr(_res));
15986         CResult_PublicKeyNoneZ_free(_res_conv);
15987 }
15988
15989 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
15990         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15991         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
15992         return tag_ptr(ret_conv, true);
15993 }
15994 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
15995         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
15996         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
15997         return ret_conv;
15998 }
15999
16000 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
16001         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16002         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16003         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16004         return tag_ptr(ret_conv, true);
16005 }
16006
16007 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
16008         void* o_ptr = untag_ptr(o);
16009         CHECK_ACCESS(o_ptr);
16010         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16011         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16012         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16013         *ret_copy = COption_ScalarZ_some(o_conv);
16014         uint64_t ret_ref = tag_ptr(ret_copy, true);
16015         return ret_ref;
16016 }
16017
16018 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
16019         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16020         *ret_copy = COption_ScalarZ_none();
16021         uint64_t ret_ref = tag_ptr(ret_copy, true);
16022         return ret_ref;
16023 }
16024
16025 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
16026         if (!ptr_is_owned(_res)) return;
16027         void* _res_ptr = untag_ptr(_res);
16028         CHECK_ACCESS(_res_ptr);
16029         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
16030         FREE(untag_ptr(_res));
16031         COption_ScalarZ_free(_res_conv);
16032 }
16033
16034 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
16035         LDKThirtyTwoBytes o_ref;
16036         CHECK(o->arr_len == 32);
16037         memcpy(o_ref.data, o->elems, 32); FREE(o);
16038         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16039         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
16040         return tag_ptr(ret_conv, true);
16041 }
16042
16043 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
16044         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16045         *ret_conv = CResult_SharedSecretNoneZ_err();
16046         return tag_ptr(ret_conv, true);
16047 }
16048
16049 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
16050         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
16051         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
16052         return ret_conv;
16053 }
16054
16055 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
16056         if (!ptr_is_owned(_res)) return;
16057         void* _res_ptr = untag_ptr(_res);
16058         CHECK_ACCESS(_res_ptr);
16059         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
16060         FREE(untag_ptr(_res));
16061         CResult_SharedSecretNoneZ_free(_res_conv);
16062 }
16063
16064 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16065         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16066         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16067         return tag_ptr(ret_conv, true);
16068 }
16069 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16070         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16071         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16072         return ret_conv;
16073 }
16074
16075 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16076         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16077         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16078         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16079         return tag_ptr(ret_conv, true);
16080 }
16081
16082 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16083         LDKCVec_U5Z _res_constr;
16084         _res_constr.datalen = _res->arr_len;
16085         if (_res_constr.datalen > 0)
16086                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16087         else
16088                 _res_constr.data = NULL;
16089         int8_t* _res_vals = (void*) _res->elems;
16090         for (size_t h = 0; h < _res_constr.datalen; h++) {
16091                 int8_t _res_conv_7 = _res_vals[h];
16092                 
16093                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16094         }
16095         FREE(_res);
16096         CVec_U5Z_free(_res_constr);
16097 }
16098
16099 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16100         LDKRecoverableSignature o_ref;
16101         CHECK(o->arr_len == 68);
16102         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16103         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16104         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16105         return tag_ptr(ret_conv, true);
16106 }
16107
16108 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16109         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16110         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16111         return tag_ptr(ret_conv, true);
16112 }
16113
16114 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16115         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16116         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16117         return ret_conv;
16118 }
16119
16120 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16121         if (!ptr_is_owned(_res)) return;
16122         void* _res_ptr = untag_ptr(_res);
16123         CHECK_ACCESS(_res_ptr);
16124         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16125         FREE(untag_ptr(_res));
16126         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16127 }
16128
16129 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16130         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16131         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16132         return tag_ptr(ret_conv, true);
16133 }
16134 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16135         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16136         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16137         return ret_conv;
16138 }
16139
16140 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16141         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16142         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16143         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16144         return tag_ptr(ret_conv, true);
16145 }
16146
16147 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16148         void* o_ptr = untag_ptr(o);
16149         CHECK_ACCESS(o_ptr);
16150         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16151         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16152                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16153                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16154         }
16155         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16156         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16157         return tag_ptr(ret_conv, true);
16158 }
16159
16160 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16161         void* e_ptr = untag_ptr(e);
16162         CHECK_ACCESS(e_ptr);
16163         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16164         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16165         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16166         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16167         return tag_ptr(ret_conv, true);
16168 }
16169
16170 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16171         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16172         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16173         return ret_conv;
16174 }
16175
16176 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16177         if (!ptr_is_owned(_res)) return;
16178         void* _res_ptr = untag_ptr(_res);
16179         CHECK_ACCESS(_res_ptr);
16180         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16181         FREE(untag_ptr(_res));
16182         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16183 }
16184
16185 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16186         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16187         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16188         return tag_ptr(ret_conv, true);
16189 }
16190 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16191         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16192         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16193         return ret_conv;
16194 }
16195
16196 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16197         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16198         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16199         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16200         return tag_ptr(ret_conv, true);
16201 }
16202
16203 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
16204         LDKCVec_u8Z _res_ref;
16205         _res_ref.datalen = _res->arr_len;
16206         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
16207         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16208         CVec_u8Z_free(_res_ref);
16209 }
16210
16211 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16212         LDKCVec_CVec_u8ZZ _res_constr;
16213         _res_constr.datalen = _res->arr_len;
16214         if (_res_constr.datalen > 0)
16215                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16216         else
16217                 _res_constr.data = NULL;
16218         int8_tArray* _res_vals = (void*) _res->elems;
16219         for (size_t m = 0; m < _res_constr.datalen; m++) {
16220                 int8_tArray _res_conv_12 = _res_vals[m];
16221                 LDKCVec_u8Z _res_conv_12_ref;
16222                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16223                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16224                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16225                 _res_constr.data[m] = _res_conv_12_ref;
16226         }
16227         FREE(_res);
16228         CVec_CVec_u8ZZ_free(_res_constr);
16229 }
16230
16231 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16232         LDKCVec_CVec_u8ZZ o_constr;
16233         o_constr.datalen = o->arr_len;
16234         if (o_constr.datalen > 0)
16235                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16236         else
16237                 o_constr.data = NULL;
16238         int8_tArray* o_vals = (void*) o->elems;
16239         for (size_t m = 0; m < o_constr.datalen; m++) {
16240                 int8_tArray o_conv_12 = o_vals[m];
16241                 LDKCVec_u8Z o_conv_12_ref;
16242                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16243                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16244                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16245                 o_constr.data[m] = o_conv_12_ref;
16246         }
16247         FREE(o);
16248         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16249         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16250         return tag_ptr(ret_conv, true);
16251 }
16252
16253 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16254         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16255         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16256         return tag_ptr(ret_conv, true);
16257 }
16258
16259 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16260         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16261         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16262         return ret_conv;
16263 }
16264
16265 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16266         if (!ptr_is_owned(_res)) return;
16267         void* _res_ptr = untag_ptr(_res);
16268         CHECK_ACCESS(_res_ptr);
16269         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16270         FREE(untag_ptr(_res));
16271         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16272 }
16273
16274 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16275         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16276         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16277         return tag_ptr(ret_conv, true);
16278 }
16279 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16280         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16281         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16282         return ret_conv;
16283 }
16284
16285 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16286         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16287         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16288         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16289         return tag_ptr(ret_conv, true);
16290 }
16291
16292 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16293         LDKInMemorySigner o_conv;
16294         o_conv.inner = untag_ptr(o);
16295         o_conv.is_owned = ptr_is_owned(o);
16296         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16297         o_conv = InMemorySigner_clone(&o_conv);
16298         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16299         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16300         return tag_ptr(ret_conv, true);
16301 }
16302
16303 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16304         void* e_ptr = untag_ptr(e);
16305         CHECK_ACCESS(e_ptr);
16306         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16307         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16308         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16309         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16310         return tag_ptr(ret_conv, true);
16311 }
16312
16313 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16314         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16315         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16316         return ret_conv;
16317 }
16318
16319 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16320         if (!ptr_is_owned(_res)) return;
16321         void* _res_ptr = untag_ptr(_res);
16322         CHECK_ACCESS(_res_ptr);
16323         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16324         FREE(untag_ptr(_res));
16325         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16326 }
16327
16328 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16329         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16330         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16331         return tag_ptr(ret_conv, true);
16332 }
16333 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16334         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16335         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16336         return ret_conv;
16337 }
16338
16339 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16340         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16341         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16342         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16343         return tag_ptr(ret_conv, true);
16344 }
16345
16346 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16347         LDKCVec_TxOutZ _res_constr;
16348         _res_constr.datalen = _res->arr_len;
16349         if (_res_constr.datalen > 0)
16350                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16351         else
16352                 _res_constr.data = NULL;
16353         uint64_t* _res_vals = _res->elems;
16354         for (size_t h = 0; h < _res_constr.datalen; h++) {
16355                 uint64_t _res_conv_7 = _res_vals[h];
16356                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16357                 CHECK_ACCESS(_res_conv_7_ptr);
16358                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16359                 FREE(untag_ptr(_res_conv_7));
16360                 _res_constr.data[h] = _res_conv_7_conv;
16361         }
16362         FREE(_res);
16363         CVec_TxOutZ_free(_res_constr);
16364 }
16365
16366 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16367         LDKTransaction o_ref;
16368         o_ref.datalen = o->arr_len;
16369         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16370         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16371         o_ref.data_is_owned = true;
16372         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16373         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16374         return tag_ptr(ret_conv, true);
16375 }
16376
16377 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16378         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16379         *ret_conv = CResult_TransactionNoneZ_err();
16380         return tag_ptr(ret_conv, true);
16381 }
16382
16383 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16384         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16385         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16386         return ret_conv;
16387 }
16388
16389 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16390         if (!ptr_is_owned(_res)) return;
16391         void* _res_ptr = untag_ptr(_res);
16392         CHECK_ACCESS(_res_ptr);
16393         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16394         FREE(untag_ptr(_res));
16395         CResult_TransactionNoneZ_free(_res_conv);
16396 }
16397
16398 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16399         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16400         *ret_conv = CResult_TransactionNoneZ_clone(arg);
16401         return tag_ptr(ret_conv, true);
16402 }
16403 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
16404         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
16405         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16406         return ret_conv;
16407 }
16408
16409 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
16410         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
16411         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16412         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16413         return tag_ptr(ret_conv, true);
16414 }
16415
16416 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
16417         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16418         *ret_copy = COption_u16Z_some(o);
16419         uint64_t ret_ref = tag_ptr(ret_copy, true);
16420         return ret_ref;
16421 }
16422
16423 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
16424         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16425         *ret_copy = COption_u16Z_none();
16426         uint64_t ret_ref = tag_ptr(ret_copy, true);
16427         return ret_ref;
16428 }
16429
16430 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
16431         if (!ptr_is_owned(_res)) return;
16432         void* _res_ptr = untag_ptr(_res);
16433         CHECK_ACCESS(_res_ptr);
16434         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
16435         FREE(untag_ptr(_res));
16436         COption_u16Z_free(_res_conv);
16437 }
16438
16439 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
16440         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16441         *ret_copy = COption_u16Z_clone(arg);
16442         uint64_t ret_ref = tag_ptr(ret_copy, true);
16443         return ret_ref;
16444 }
16445 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
16446         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
16447         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
16448         return ret_conv;
16449 }
16450
16451 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
16452         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
16453         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16454         *ret_copy = COption_u16Z_clone(orig_conv);
16455         uint64_t ret_ref = tag_ptr(ret_copy, true);
16456         return ret_ref;
16457 }
16458
16459 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
16460         LDKThirtyTwoBytes o_ref;
16461         CHECK(o->arr_len == 32);
16462         memcpy(o_ref.data, o->elems, 32); FREE(o);
16463         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16464         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
16465         return tag_ptr(ret_conv, true);
16466 }
16467
16468 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
16469         void* e_ptr = untag_ptr(e);
16470         CHECK_ACCESS(e_ptr);
16471         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16472         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16473         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16474         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
16475         return tag_ptr(ret_conv, true);
16476 }
16477
16478 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
16479         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
16480         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
16481         return ret_conv;
16482 }
16483
16484 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
16485         if (!ptr_is_owned(_res)) return;
16486         void* _res_ptr = untag_ptr(_res);
16487         CHECK_ACCESS(_res_ptr);
16488         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
16489         FREE(untag_ptr(_res));
16490         CResult__u832APIErrorZ_free(_res_conv);
16491 }
16492
16493 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
16494         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16495         *ret_conv = CResult__u832APIErrorZ_clone(arg);
16496         return tag_ptr(ret_conv, true);
16497 }
16498 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
16499         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
16500         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
16501         return ret_conv;
16502 }
16503
16504 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
16505         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
16506         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16507         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
16508         return tag_ptr(ret_conv, true);
16509 }
16510
16511 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
16512         LDKCVec_RecentPaymentDetailsZ _res_constr;
16513         _res_constr.datalen = _res->arr_len;
16514         if (_res_constr.datalen > 0)
16515                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
16516         else
16517                 _res_constr.data = NULL;
16518         uint64_t* _res_vals = _res->elems;
16519         for (size_t w = 0; w < _res_constr.datalen; w++) {
16520                 uint64_t _res_conv_22 = _res_vals[w];
16521                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
16522                 CHECK_ACCESS(_res_conv_22_ptr);
16523                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
16524                 FREE(untag_ptr(_res_conv_22));
16525                 _res_constr.data[w] = _res_conv_22_conv;
16526         }
16527         FREE(_res);
16528         CVec_RecentPaymentDetailsZ_free(_res_constr);
16529 }
16530
16531 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
16532         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16533         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
16534         return tag_ptr(ret_conv, true);
16535 }
16536
16537 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
16538         void* e_ptr = untag_ptr(e);
16539         CHECK_ACCESS(e_ptr);
16540         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16541         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16542         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16543         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
16544         return tag_ptr(ret_conv, true);
16545 }
16546
16547 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
16548         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
16549         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
16550         return ret_conv;
16551 }
16552
16553 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
16554         if (!ptr_is_owned(_res)) return;
16555         void* _res_ptr = untag_ptr(_res);
16556         CHECK_ACCESS(_res_ptr);
16557         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
16558         FREE(untag_ptr(_res));
16559         CResult_NonePaymentSendFailureZ_free(_res_conv);
16560 }
16561
16562 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
16563         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16564         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
16565         return tag_ptr(ret_conv, true);
16566 }
16567 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
16568         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
16569         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
16570         return ret_conv;
16571 }
16572
16573 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
16574         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
16575         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16576         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
16577         return tag_ptr(ret_conv, true);
16578 }
16579
16580 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
16581         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
16582         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
16583         return tag_ptr(ret_conv, true);
16584 }
16585
16586 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
16587         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
16588         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
16589         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
16590         return tag_ptr(ret_conv, true);
16591 }
16592
16593 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
16594         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
16595         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
16596         return ret_conv;
16597 }
16598
16599 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
16600         if (!ptr_is_owned(_res)) return;
16601         void* _res_ptr = untag_ptr(_res);
16602         CHECK_ACCESS(_res_ptr);
16603         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
16604         FREE(untag_ptr(_res));
16605         CResult_NoneRetryableSendFailureZ_free(_res_conv);
16606 }
16607
16608 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
16609         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
16610         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
16611         return tag_ptr(ret_conv, true);
16612 }
16613 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
16614         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
16615         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
16616         return ret_conv;
16617 }
16618
16619 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
16620         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
16621         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
16622         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
16623         return tag_ptr(ret_conv, true);
16624 }
16625
16626 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
16627         LDKThirtyTwoBytes o_ref;
16628         CHECK(o->arr_len == 32);
16629         memcpy(o_ref.data, o->elems, 32); FREE(o);
16630         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16631         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
16632         return tag_ptr(ret_conv, true);
16633 }
16634
16635 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
16636         void* e_ptr = untag_ptr(e);
16637         CHECK_ACCESS(e_ptr);
16638         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16639         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16640         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16641         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
16642         return tag_ptr(ret_conv, true);
16643 }
16644
16645 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
16646         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
16647         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
16648         return ret_conv;
16649 }
16650
16651 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
16652         if (!ptr_is_owned(_res)) return;
16653         void* _res_ptr = untag_ptr(_res);
16654         CHECK_ACCESS(_res_ptr);
16655         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
16656         FREE(untag_ptr(_res));
16657         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
16658 }
16659
16660 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
16661         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16662         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
16663         return tag_ptr(ret_conv, true);
16664 }
16665 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16666         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
16667         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
16668         return ret_conv;
16669 }
16670
16671 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
16672         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
16673         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16674         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
16675         return tag_ptr(ret_conv, true);
16676 }
16677
16678 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_ok(int8_tArray o) {
16679         LDKThirtyTwoBytes o_ref;
16680         CHECK(o->arr_len == 32);
16681         memcpy(o_ref.data, o->elems, 32); FREE(o);
16682         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
16683         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
16684         return tag_ptr(ret_conv, true);
16685 }
16686
16687 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_err(uint32_t e) {
16688         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
16689         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
16690         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
16691         return tag_ptr(ret_conv, true);
16692 }
16693
16694 jboolean  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_is_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_is_ok(uint64_t o) {
16695         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
16696         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
16697         return ret_conv;
16698 }
16699
16700 void  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_free"))) TS_CResult_PaymentHashRetryableSendFailureZ_free(uint64_t _res) {
16701         if (!ptr_is_owned(_res)) return;
16702         void* _res_ptr = untag_ptr(_res);
16703         CHECK_ACCESS(_res_ptr);
16704         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
16705         FREE(untag_ptr(_res));
16706         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
16707 }
16708
16709 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
16710         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
16711         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
16712         return tag_ptr(ret_conv, true);
16713 }
16714 int64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr(uint64_t arg) {
16715         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
16716         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
16717         return ret_conv;
16718 }
16719
16720 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone(uint64_t orig) {
16721         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
16722         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
16723         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
16724         return tag_ptr(ret_conv, true);
16725 }
16726
16727 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
16728         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16729         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
16730         return tag_ptr(ret_conv, true);
16731 }
16732 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
16733         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
16734         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16735         return ret_conv;
16736 }
16737
16738 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
16739         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
16740         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16741         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16742         return tag_ptr(ret_conv, true);
16743 }
16744
16745 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
16746         LDKThirtyTwoBytes a_ref;
16747         CHECK(a->arr_len == 32);
16748         memcpy(a_ref.data, a->elems, 32); FREE(a);
16749         LDKThirtyTwoBytes b_ref;
16750         CHECK(b->arr_len == 32);
16751         memcpy(b_ref.data, b->elems, 32); FREE(b);
16752         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16753         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16754         return tag_ptr(ret_conv, true);
16755 }
16756
16757 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
16758         if (!ptr_is_owned(_res)) return;
16759         void* _res_ptr = untag_ptr(_res);
16760         CHECK_ACCESS(_res_ptr);
16761         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16762         FREE(untag_ptr(_res));
16763         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16764 }
16765
16766 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
16767         void* o_ptr = untag_ptr(o);
16768         CHECK_ACCESS(o_ptr);
16769         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16770         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
16771         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16772         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16773         return tag_ptr(ret_conv, true);
16774 }
16775
16776 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
16777         void* e_ptr = untag_ptr(e);
16778         CHECK_ACCESS(e_ptr);
16779         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16780         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16781         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16782         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16783         return tag_ptr(ret_conv, true);
16784 }
16785
16786 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
16787         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
16788         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16789         return ret_conv;
16790 }
16791
16792 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
16793         if (!ptr_is_owned(_res)) return;
16794         void* _res_ptr = untag_ptr(_res);
16795         CHECK_ACCESS(_res_ptr);
16796         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16797         FREE(untag_ptr(_res));
16798         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16799 }
16800
16801 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16802         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16803         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16804         return tag_ptr(ret_conv, true);
16805 }
16806 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16807         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
16808         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16809         return ret_conv;
16810 }
16811
16812 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
16813         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
16814         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16815         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16816         return tag_ptr(ret_conv, true);
16817 }
16818
16819 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
16820         LDKCVec_ThirtyTwoBytesZ _res_constr;
16821         _res_constr.datalen = _res->arr_len;
16822         if (_res_constr.datalen > 0)
16823                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
16824         else
16825                 _res_constr.data = NULL;
16826         int8_tArray* _res_vals = (void*) _res->elems;
16827         for (size_t m = 0; m < _res_constr.datalen; m++) {
16828                 int8_tArray _res_conv_12 = _res_vals[m];
16829                 LDKThirtyTwoBytes _res_conv_12_ref;
16830                 CHECK(_res_conv_12->arr_len == 32);
16831                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16832                 _res_constr.data[m] = _res_conv_12_ref;
16833         }
16834         FREE(_res);
16835         CVec_ThirtyTwoBytesZ_free(_res_constr);
16836 }
16837
16838 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16839         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16840         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16841         return tag_ptr(ret_conv, true);
16842 }
16843 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
16844         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
16845         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16846         return ret_conv;
16847 }
16848
16849 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
16850         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
16851         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16852         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16853         return tag_ptr(ret_conv, true);
16854 }
16855
16856 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
16857         LDKThirtyTwoBytes a_ref;
16858         CHECK(a->arr_len == 32);
16859         memcpy(a_ref.data, a->elems, 32); FREE(a);
16860         LDKThirtyTwoBytes b_ref;
16861         CHECK(b->arr_len == 32);
16862         memcpy(b_ref.data, b->elems, 32); FREE(b);
16863         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16864         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16865         return tag_ptr(ret_conv, true);
16866 }
16867
16868 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
16869         if (!ptr_is_owned(_res)) return;
16870         void* _res_ptr = untag_ptr(_res);
16871         CHECK_ACCESS(_res_ptr);
16872         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16873         FREE(untag_ptr(_res));
16874         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16875 }
16876
16877 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
16878         void* o_ptr = untag_ptr(o);
16879         CHECK_ACCESS(o_ptr);
16880         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16881         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16882         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16883         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16884         return tag_ptr(ret_conv, true);
16885 }
16886
16887 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16888         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16889         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16890         return tag_ptr(ret_conv, true);
16891 }
16892
16893 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
16894         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
16895         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16896         return ret_conv;
16897 }
16898
16899 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
16900         if (!ptr_is_owned(_res)) return;
16901         void* _res_ptr = untag_ptr(_res);
16902         CHECK_ACCESS(_res_ptr);
16903         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16904         FREE(untag_ptr(_res));
16905         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16906 }
16907
16908 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16909         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16910         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16911         return tag_ptr(ret_conv, true);
16912 }
16913 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
16914         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
16915         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16916         return ret_conv;
16917 }
16918
16919 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
16920         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
16921         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16922         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16923         return tag_ptr(ret_conv, true);
16924 }
16925
16926 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
16927         void* o_ptr = untag_ptr(o);
16928         CHECK_ACCESS(o_ptr);
16929         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16930         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16931         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16932         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16933         return tag_ptr(ret_conv, true);
16934 }
16935
16936 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
16937         void* e_ptr = untag_ptr(e);
16938         CHECK_ACCESS(e_ptr);
16939         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16940         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16941         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16942         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16943         return tag_ptr(ret_conv, true);
16944 }
16945
16946 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
16947         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
16948         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16949         return ret_conv;
16950 }
16951
16952 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
16953         if (!ptr_is_owned(_res)) return;
16954         void* _res_ptr = untag_ptr(_res);
16955         CHECK_ACCESS(_res_ptr);
16956         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16957         FREE(untag_ptr(_res));
16958         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16959 }
16960
16961 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16962         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16963         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16964         return tag_ptr(ret_conv, true);
16965 }
16966 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
16967         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
16968         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16969         return ret_conv;
16970 }
16971
16972 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
16973         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
16974         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16975         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16976         return tag_ptr(ret_conv, true);
16977 }
16978
16979 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16980         LDKThirtyTwoBytes o_ref;
16981         CHECK(o->arr_len == 32);
16982         memcpy(o_ref.data, o->elems, 32); FREE(o);
16983         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16984         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16985         return tag_ptr(ret_conv, true);
16986 }
16987
16988 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16989         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16990         *ret_conv = CResult_PaymentSecretNoneZ_err();
16991         return tag_ptr(ret_conv, true);
16992 }
16993
16994 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
16995         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
16996         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16997         return ret_conv;
16998 }
16999
17000 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
17001         if (!ptr_is_owned(_res)) return;
17002         void* _res_ptr = untag_ptr(_res);
17003         CHECK_ACCESS(_res_ptr);
17004         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
17005         FREE(untag_ptr(_res));
17006         CResult_PaymentSecretNoneZ_free(_res_conv);
17007 }
17008
17009 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
17010         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17011         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
17012         return tag_ptr(ret_conv, true);
17013 }
17014 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
17015         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
17016         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
17017         return ret_conv;
17018 }
17019
17020 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
17021         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
17022         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17023         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
17024         return tag_ptr(ret_conv, true);
17025 }
17026
17027 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
17028         LDKThirtyTwoBytes o_ref;
17029         CHECK(o->arr_len == 32);
17030         memcpy(o_ref.data, o->elems, 32); FREE(o);
17031         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17032         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
17033         return tag_ptr(ret_conv, true);
17034 }
17035
17036 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
17037         void* e_ptr = untag_ptr(e);
17038         CHECK_ACCESS(e_ptr);
17039         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17040         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17041         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17042         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
17043         return tag_ptr(ret_conv, true);
17044 }
17045
17046 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
17047         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
17048         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
17049         return ret_conv;
17050 }
17051
17052 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
17053         if (!ptr_is_owned(_res)) return;
17054         void* _res_ptr = untag_ptr(_res);
17055         CHECK_ACCESS(_res_ptr);
17056         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
17057         FREE(untag_ptr(_res));
17058         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
17059 }
17060
17061 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
17062         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17063         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
17064         return tag_ptr(ret_conv, true);
17065 }
17066 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
17067         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
17068         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
17069         return ret_conv;
17070 }
17071
17072 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
17073         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
17074         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17075         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
17076         return tag_ptr(ret_conv, true);
17077 }
17078
17079 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
17080         LDKThirtyTwoBytes o_ref;
17081         CHECK(o->arr_len == 32);
17082         memcpy(o_ref.data, o->elems, 32); FREE(o);
17083         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17084         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
17085         return tag_ptr(ret_conv, true);
17086 }
17087
17088 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
17089         void* e_ptr = untag_ptr(e);
17090         CHECK_ACCESS(e_ptr);
17091         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17092         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17093         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17094         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17095         return tag_ptr(ret_conv, true);
17096 }
17097
17098 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
17099         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
17100         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17101         return ret_conv;
17102 }
17103
17104 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
17105         if (!ptr_is_owned(_res)) return;
17106         void* _res_ptr = untag_ptr(_res);
17107         CHECK_ACCESS(_res_ptr);
17108         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17109         FREE(untag_ptr(_res));
17110         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17111 }
17112
17113 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17114         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17115         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17116         return tag_ptr(ret_conv, true);
17117 }
17118 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
17119         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
17120         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17121         return ret_conv;
17122 }
17123
17124 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
17125         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
17126         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17127         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17128         return tag_ptr(ret_conv, true);
17129 }
17130
17131 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
17132         LDKCounterpartyForwardingInfo o_conv;
17133         o_conv.inner = untag_ptr(o);
17134         o_conv.is_owned = ptr_is_owned(o);
17135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17136         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17137         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17138         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17139         return tag_ptr(ret_conv, true);
17140 }
17141
17142 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
17143         void* e_ptr = untag_ptr(e);
17144         CHECK_ACCESS(e_ptr);
17145         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17146         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17147         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17148         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17149         return tag_ptr(ret_conv, true);
17150 }
17151
17152 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
17153         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
17154         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17155         return ret_conv;
17156 }
17157
17158 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
17159         if (!ptr_is_owned(_res)) return;
17160         void* _res_ptr = untag_ptr(_res);
17161         CHECK_ACCESS(_res_ptr);
17162         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17163         FREE(untag_ptr(_res));
17164         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17165 }
17166
17167 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17168         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17169         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17170         return tag_ptr(ret_conv, true);
17171 }
17172 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17173         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
17174         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17175         return ret_conv;
17176 }
17177
17178 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
17179         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
17180         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17181         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17182         return tag_ptr(ret_conv, true);
17183 }
17184
17185 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
17186         LDKChannelCounterparty o_conv;
17187         o_conv.inner = untag_ptr(o);
17188         o_conv.is_owned = ptr_is_owned(o);
17189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17190         o_conv = ChannelCounterparty_clone(&o_conv);
17191         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17192         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17193         return tag_ptr(ret_conv, true);
17194 }
17195
17196 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
17197         void* e_ptr = untag_ptr(e);
17198         CHECK_ACCESS(e_ptr);
17199         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17200         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17201         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17202         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17203         return tag_ptr(ret_conv, true);
17204 }
17205
17206 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
17207         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
17208         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17209         return ret_conv;
17210 }
17211
17212 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
17213         if (!ptr_is_owned(_res)) return;
17214         void* _res_ptr = untag_ptr(_res);
17215         CHECK_ACCESS(_res_ptr);
17216         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
17217         FREE(untag_ptr(_res));
17218         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
17219 }
17220
17221 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
17222         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17223         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
17224         return tag_ptr(ret_conv, true);
17225 }
17226 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
17227         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
17228         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
17229         return ret_conv;
17230 }
17231
17232 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
17233         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
17234         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17235         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
17236         return tag_ptr(ret_conv, true);
17237 }
17238
17239 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
17240         LDKChannelDetails o_conv;
17241         o_conv.inner = untag_ptr(o);
17242         o_conv.is_owned = ptr_is_owned(o);
17243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17244         o_conv = ChannelDetails_clone(&o_conv);
17245         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17246         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
17247         return tag_ptr(ret_conv, true);
17248 }
17249
17250 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
17251         void* e_ptr = untag_ptr(e);
17252         CHECK_ACCESS(e_ptr);
17253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17255         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17256         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
17257         return tag_ptr(ret_conv, true);
17258 }
17259
17260 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
17261         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
17262         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
17263         return ret_conv;
17264 }
17265
17266 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
17267         if (!ptr_is_owned(_res)) return;
17268         void* _res_ptr = untag_ptr(_res);
17269         CHECK_ACCESS(_res_ptr);
17270         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
17271         FREE(untag_ptr(_res));
17272         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
17273 }
17274
17275 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
17276         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17277         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
17278         return tag_ptr(ret_conv, true);
17279 }
17280 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
17281         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
17282         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
17283         return ret_conv;
17284 }
17285
17286 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
17287         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
17288         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17289         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
17290         return tag_ptr(ret_conv, true);
17291 }
17292
17293 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
17294         LDKPhantomRouteHints o_conv;
17295         o_conv.inner = untag_ptr(o);
17296         o_conv.is_owned = ptr_is_owned(o);
17297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17298         o_conv = PhantomRouteHints_clone(&o_conv);
17299         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17300         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
17301         return tag_ptr(ret_conv, true);
17302 }
17303
17304 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
17305         void* e_ptr = untag_ptr(e);
17306         CHECK_ACCESS(e_ptr);
17307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17309         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17310         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
17311         return tag_ptr(ret_conv, true);
17312 }
17313
17314 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
17315         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
17316         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
17317         return ret_conv;
17318 }
17319
17320 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
17321         if (!ptr_is_owned(_res)) return;
17322         void* _res_ptr = untag_ptr(_res);
17323         CHECK_ACCESS(_res_ptr);
17324         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
17325         FREE(untag_ptr(_res));
17326         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
17327 }
17328
17329 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
17330         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17331         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
17332         return tag_ptr(ret_conv, true);
17333 }
17334 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
17335         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
17336         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
17337         return ret_conv;
17338 }
17339
17340 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
17341         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
17342         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17343         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
17344         return tag_ptr(ret_conv, true);
17345 }
17346
17347 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
17348         LDKCVec_ChannelMonitorZ _res_constr;
17349         _res_constr.datalen = _res->arr_len;
17350         if (_res_constr.datalen > 0)
17351                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17352         else
17353                 _res_constr.data = NULL;
17354         uint64_t* _res_vals = _res->elems;
17355         for (size_t q = 0; q < _res_constr.datalen; q++) {
17356                 uint64_t _res_conv_16 = _res_vals[q];
17357                 LDKChannelMonitor _res_conv_16_conv;
17358                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17359                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17360                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17361                 _res_constr.data[q] = _res_conv_16_conv;
17362         }
17363         FREE(_res);
17364         CVec_ChannelMonitorZ_free(_res_constr);
17365 }
17366
17367 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
17368         LDKThirtyTwoBytes a_ref;
17369         CHECK(a->arr_len == 32);
17370         memcpy(a_ref.data, a->elems, 32); FREE(a);
17371         LDKChannelManager b_conv;
17372         b_conv.inner = untag_ptr(b);
17373         b_conv.is_owned = ptr_is_owned(b);
17374         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17375         // WARNING: we need a move here but no clone is available for LDKChannelManager
17376         
17377         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
17378         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
17379         return tag_ptr(ret_conv, true);
17380 }
17381
17382 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
17383         if (!ptr_is_owned(_res)) return;
17384         void* _res_ptr = untag_ptr(_res);
17385         CHECK_ACCESS(_res_ptr);
17386         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
17387         FREE(untag_ptr(_res));
17388         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
17389 }
17390
17391 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
17392         void* o_ptr = untag_ptr(o);
17393         CHECK_ACCESS(o_ptr);
17394         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
17395         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
17396         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17397         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
17398         return tag_ptr(ret_conv, true);
17399 }
17400
17401 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
17402         void* e_ptr = untag_ptr(e);
17403         CHECK_ACCESS(e_ptr);
17404         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17405         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17406         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17407         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
17408         return tag_ptr(ret_conv, true);
17409 }
17410
17411 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
17412         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
17413         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
17414         return ret_conv;
17415 }
17416
17417 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
17418         if (!ptr_is_owned(_res)) return;
17419         void* _res_ptr = untag_ptr(_res);
17420         CHECK_ACCESS(_res_ptr);
17421         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
17422         FREE(untag_ptr(_res));
17423         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
17424 }
17425
17426 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
17427         LDKChannelConfig o_conv;
17428         o_conv.inner = untag_ptr(o);
17429         o_conv.is_owned = ptr_is_owned(o);
17430         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17431         o_conv = ChannelConfig_clone(&o_conv);
17432         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17433         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
17434         return tag_ptr(ret_conv, true);
17435 }
17436
17437 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
17438         void* e_ptr = untag_ptr(e);
17439         CHECK_ACCESS(e_ptr);
17440         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17441         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17442         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17443         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
17444         return tag_ptr(ret_conv, true);
17445 }
17446
17447 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
17448         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
17449         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
17450         return ret_conv;
17451 }
17452
17453 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
17454         if (!ptr_is_owned(_res)) return;
17455         void* _res_ptr = untag_ptr(_res);
17456         CHECK_ACCESS(_res_ptr);
17457         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
17458         FREE(untag_ptr(_res));
17459         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
17460 }
17461
17462 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
17463         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17464         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
17465         return tag_ptr(ret_conv, true);
17466 }
17467 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
17468         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
17469         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
17470         return ret_conv;
17471 }
17472
17473 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
17474         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
17475         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17476         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
17477         return tag_ptr(ret_conv, true);
17478 }
17479
17480 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
17481         void* o_ptr = untag_ptr(o);
17482         CHECK_ACCESS(o_ptr);
17483         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
17484         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
17485         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
17486         *ret_copy = COption_APIErrorZ_some(o_conv);
17487         uint64_t ret_ref = tag_ptr(ret_copy, true);
17488         return ret_ref;
17489 }
17490
17491 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
17492         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
17493         *ret_copy = COption_APIErrorZ_none();
17494         uint64_t ret_ref = tag_ptr(ret_copy, true);
17495         return ret_ref;
17496 }
17497
17498 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
17499         if (!ptr_is_owned(_res)) return;
17500         void* _res_ptr = untag_ptr(_res);
17501         CHECK_ACCESS(_res_ptr);
17502         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
17503         FREE(untag_ptr(_res));
17504         COption_APIErrorZ_free(_res_conv);
17505 }
17506
17507 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
17508         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
17509         *ret_copy = COption_APIErrorZ_clone(arg);
17510         uint64_t ret_ref = tag_ptr(ret_copy, true);
17511         return ret_ref;
17512 }
17513 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
17514         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
17515         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
17516         return ret_conv;
17517 }
17518
17519 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
17520         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
17521         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
17522         *ret_copy = COption_APIErrorZ_clone(orig_conv);
17523         uint64_t ret_ref = tag_ptr(ret_copy, true);
17524         return ret_ref;
17525 }
17526
17527 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
17528         void* o_ptr = untag_ptr(o);
17529         CHECK_ACCESS(o_ptr);
17530         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
17531         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
17532         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
17533         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
17534         return tag_ptr(ret_conv, true);
17535 }
17536
17537 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
17538         void* e_ptr = untag_ptr(e);
17539         CHECK_ACCESS(e_ptr);
17540         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17541         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17542         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
17543         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
17544         return tag_ptr(ret_conv, true);
17545 }
17546
17547 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
17548         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
17549         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
17550         return ret_conv;
17551 }
17552
17553 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
17554         if (!ptr_is_owned(_res)) return;
17555         void* _res_ptr = untag_ptr(_res);
17556         CHECK_ACCESS(_res_ptr);
17557         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
17558         FREE(untag_ptr(_res));
17559         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
17560 }
17561
17562 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
17563         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
17564         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
17565         return tag_ptr(ret_conv, true);
17566 }
17567 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
17568         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
17569         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
17570         return ret_conv;
17571 }
17572
17573 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
17574         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
17575         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
17576         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
17577         return tag_ptr(ret_conv, true);
17578 }
17579
17580 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
17581         LDKOutPoint o_conv;
17582         o_conv.inner = untag_ptr(o);
17583         o_conv.is_owned = ptr_is_owned(o);
17584         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17585         o_conv = OutPoint_clone(&o_conv);
17586         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17587         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
17588         return tag_ptr(ret_conv, true);
17589 }
17590
17591 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
17592         void* e_ptr = untag_ptr(e);
17593         CHECK_ACCESS(e_ptr);
17594         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17595         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17596         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17597         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
17598         return tag_ptr(ret_conv, true);
17599 }
17600
17601 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
17602         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
17603         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
17604         return ret_conv;
17605 }
17606
17607 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
17608         if (!ptr_is_owned(_res)) return;
17609         void* _res_ptr = untag_ptr(_res);
17610         CHECK_ACCESS(_res_ptr);
17611         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
17612         FREE(untag_ptr(_res));
17613         CResult_OutPointDecodeErrorZ_free(_res_conv);
17614 }
17615
17616 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
17617         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17618         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
17619         return tag_ptr(ret_conv, true);
17620 }
17621 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
17622         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
17623         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
17624         return ret_conv;
17625 }
17626
17627 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
17628         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
17629         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17630         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
17631         return tag_ptr(ret_conv, true);
17632 }
17633
17634 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
17635         void* o_ptr = untag_ptr(o);
17636         CHECK_ACCESS(o_ptr);
17637         LDKType o_conv = *(LDKType*)(o_ptr);
17638         if (o_conv.free == LDKType_JCalls_free) {
17639                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17640                 LDKType_JCalls_cloned(&o_conv);
17641         }
17642         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17643         *ret_copy = COption_TypeZ_some(o_conv);
17644         uint64_t ret_ref = tag_ptr(ret_copy, true);
17645         return ret_ref;
17646 }
17647
17648 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
17649         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17650         *ret_copy = COption_TypeZ_none();
17651         uint64_t ret_ref = tag_ptr(ret_copy, true);
17652         return ret_ref;
17653 }
17654
17655 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
17656         if (!ptr_is_owned(_res)) return;
17657         void* _res_ptr = untag_ptr(_res);
17658         CHECK_ACCESS(_res_ptr);
17659         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
17660         FREE(untag_ptr(_res));
17661         COption_TypeZ_free(_res_conv);
17662 }
17663
17664 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
17665         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17666         *ret_copy = COption_TypeZ_clone(arg);
17667         uint64_t ret_ref = tag_ptr(ret_copy, true);
17668         return ret_ref;
17669 }
17670 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
17671         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
17672         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
17673         return ret_conv;
17674 }
17675
17676 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
17677         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
17678         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17679         *ret_copy = COption_TypeZ_clone(orig_conv);
17680         uint64_t ret_ref = tag_ptr(ret_copy, true);
17681         return ret_ref;
17682 }
17683
17684 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
17685         void* o_ptr = untag_ptr(o);
17686         CHECK_ACCESS(o_ptr);
17687         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
17688         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
17689         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17690         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
17691         return tag_ptr(ret_conv, true);
17692 }
17693
17694 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
17695         void* e_ptr = untag_ptr(e);
17696         CHECK_ACCESS(e_ptr);
17697         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17698         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17699         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17700         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
17701         return tag_ptr(ret_conv, true);
17702 }
17703
17704 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
17705         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
17706         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
17707         return ret_conv;
17708 }
17709
17710 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
17711         if (!ptr_is_owned(_res)) return;
17712         void* _res_ptr = untag_ptr(_res);
17713         CHECK_ACCESS(_res_ptr);
17714         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
17715         FREE(untag_ptr(_res));
17716         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
17717 }
17718
17719 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
17720         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17721         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
17722         return tag_ptr(ret_conv, true);
17723 }
17724 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
17725         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
17726         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
17727         return ret_conv;
17728 }
17729
17730 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
17731         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
17732         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17733         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
17734         return tag_ptr(ret_conv, true);
17735 }
17736
17737 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
17738         LDKThirtyTwoBytes o_ref;
17739         CHECK(o->arr_len == 32);
17740         memcpy(o_ref.data, o->elems, 32); FREE(o);
17741         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17742         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
17743         return tag_ptr(ret_conv, true);
17744 }
17745
17746 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
17747         void* e_ptr = untag_ptr(e);
17748         CHECK_ACCESS(e_ptr);
17749         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
17750         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
17751         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17752         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
17753         return tag_ptr(ret_conv, true);
17754 }
17755
17756 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
17757         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
17758         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
17759         return ret_conv;
17760 }
17761
17762 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
17763         if (!ptr_is_owned(_res)) return;
17764         void* _res_ptr = untag_ptr(_res);
17765         CHECK_ACCESS(_res_ptr);
17766         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
17767         FREE(untag_ptr(_res));
17768         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
17769 }
17770
17771 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
17772         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17773         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
17774         return tag_ptr(ret_conv, true);
17775 }
17776 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
17777         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
17778         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
17779         return ret_conv;
17780 }
17781
17782 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
17783         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
17784         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17785         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
17786         return tag_ptr(ret_conv, true);
17787 }
17788
17789 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
17790         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17791         *ret_conv = CResult_NonePaymentErrorZ_ok();
17792         return tag_ptr(ret_conv, true);
17793 }
17794
17795 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
17796         void* e_ptr = untag_ptr(e);
17797         CHECK_ACCESS(e_ptr);
17798         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
17799         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
17800         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17801         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
17802         return tag_ptr(ret_conv, true);
17803 }
17804
17805 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
17806         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
17807         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
17808         return ret_conv;
17809 }
17810
17811 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
17812         if (!ptr_is_owned(_res)) return;
17813         void* _res_ptr = untag_ptr(_res);
17814         CHECK_ACCESS(_res_ptr);
17815         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
17816         FREE(untag_ptr(_res));
17817         CResult_NonePaymentErrorZ_free(_res_conv);
17818 }
17819
17820 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
17821         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17822         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
17823         return tag_ptr(ret_conv, true);
17824 }
17825 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
17826         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
17827         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
17828         return ret_conv;
17829 }
17830
17831 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
17832         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
17833         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17834         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
17835         return tag_ptr(ret_conv, true);
17836 }
17837
17838 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
17839         LDKStr o_conv = str_ref_to_owned_c(o);
17840         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17841         *ret_conv = CResult_StringErrorZ_ok(o_conv);
17842         return tag_ptr(ret_conv, true);
17843 }
17844
17845 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
17846         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17847         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17848         *ret_conv = CResult_StringErrorZ_err(e_conv);
17849         return tag_ptr(ret_conv, true);
17850 }
17851
17852 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
17853         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
17854         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
17855         return ret_conv;
17856 }
17857
17858 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
17859         if (!ptr_is_owned(_res)) return;
17860         void* _res_ptr = untag_ptr(_res);
17861         CHECK_ACCESS(_res_ptr);
17862         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17863         FREE(untag_ptr(_res));
17864         CResult_StringErrorZ_free(_res_conv);
17865 }
17866
17867 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
17868         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17869         *ret_conv = CResult_StringErrorZ_clone(arg);
17870         return tag_ptr(ret_conv, true);
17871 }
17872 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
17873         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
17874         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
17875         return ret_conv;
17876 }
17877
17878 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
17879         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
17880         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17881         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
17882         return tag_ptr(ret_conv, true);
17883 }
17884
17885 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
17886         LDKPublicKey o_ref;
17887         CHECK(o->arr_len == 33);
17888         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
17889         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17890         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
17891         return tag_ptr(ret_conv, true);
17892 }
17893
17894 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
17895         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17896         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17897         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
17898         return tag_ptr(ret_conv, true);
17899 }
17900
17901 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
17902         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
17903         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
17904         return ret_conv;
17905 }
17906
17907 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
17908         if (!ptr_is_owned(_res)) return;
17909         void* _res_ptr = untag_ptr(_res);
17910         CHECK_ACCESS(_res_ptr);
17911         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
17912         FREE(untag_ptr(_res));
17913         CResult_PublicKeyErrorZ_free(_res_conv);
17914 }
17915
17916 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
17917         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17918         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
17919         return tag_ptr(ret_conv, true);
17920 }
17921 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
17922         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
17923         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
17924         return ret_conv;
17925 }
17926
17927 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
17928         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
17929         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17930         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
17931         return tag_ptr(ret_conv, true);
17932 }
17933
17934 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
17935         LDKChannelMonitorUpdate o_conv;
17936         o_conv.inner = untag_ptr(o);
17937         o_conv.is_owned = ptr_is_owned(o);
17938         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17939         o_conv = ChannelMonitorUpdate_clone(&o_conv);
17940         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17941         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17942         return tag_ptr(ret_conv, true);
17943 }
17944
17945 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
17946         void* e_ptr = untag_ptr(e);
17947         CHECK_ACCESS(e_ptr);
17948         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17949         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17950         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17951         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17952         return tag_ptr(ret_conv, true);
17953 }
17954
17955 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
17956         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
17957         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17958         return ret_conv;
17959 }
17960
17961 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
17962         if (!ptr_is_owned(_res)) return;
17963         void* _res_ptr = untag_ptr(_res);
17964         CHECK_ACCESS(_res_ptr);
17965         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17966         FREE(untag_ptr(_res));
17967         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17968 }
17969
17970 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17971         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17972         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17973         return tag_ptr(ret_conv, true);
17974 }
17975 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17976         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
17977         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17978         return ret_conv;
17979 }
17980
17981 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
17982         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
17983         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17984         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17985         return tag_ptr(ret_conv, true);
17986 }
17987
17988 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
17989         void* o_ptr = untag_ptr(o);
17990         CHECK_ACCESS(o_ptr);
17991         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17992         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
17993         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17994         *ret_copy = COption_MonitorEventZ_some(o_conv);
17995         uint64_t ret_ref = tag_ptr(ret_copy, true);
17996         return ret_ref;
17997 }
17998
17999 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
18000         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18001         *ret_copy = COption_MonitorEventZ_none();
18002         uint64_t ret_ref = tag_ptr(ret_copy, true);
18003         return ret_ref;
18004 }
18005
18006 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
18007         if (!ptr_is_owned(_res)) return;
18008         void* _res_ptr = untag_ptr(_res);
18009         CHECK_ACCESS(_res_ptr);
18010         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
18011         FREE(untag_ptr(_res));
18012         COption_MonitorEventZ_free(_res_conv);
18013 }
18014
18015 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
18016         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18017         *ret_copy = COption_MonitorEventZ_clone(arg);
18018         uint64_t ret_ref = tag_ptr(ret_copy, true);
18019         return ret_ref;
18020 }
18021 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
18022         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
18023         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
18024         return ret_conv;
18025 }
18026
18027 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
18028         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
18029         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18030         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
18031         uint64_t ret_ref = tag_ptr(ret_copy, true);
18032         return ret_ref;
18033 }
18034
18035 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
18036         void* o_ptr = untag_ptr(o);
18037         CHECK_ACCESS(o_ptr);
18038         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
18039         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
18040         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18041         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
18042         return tag_ptr(ret_conv, true);
18043 }
18044
18045 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
18046         void* e_ptr = untag_ptr(e);
18047         CHECK_ACCESS(e_ptr);
18048         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18049         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18050         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18051         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
18052         return tag_ptr(ret_conv, true);
18053 }
18054
18055 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
18056         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
18057         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
18058         return ret_conv;
18059 }
18060
18061 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
18062         if (!ptr_is_owned(_res)) return;
18063         void* _res_ptr = untag_ptr(_res);
18064         CHECK_ACCESS(_res_ptr);
18065         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
18066         FREE(untag_ptr(_res));
18067         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
18068 }
18069
18070 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
18071         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18072         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
18073         return tag_ptr(ret_conv, true);
18074 }
18075 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
18076         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
18077         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
18078         return ret_conv;
18079 }
18080
18081 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
18082         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
18083         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18084         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
18085         return tag_ptr(ret_conv, true);
18086 }
18087
18088 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
18089         LDKHTLCUpdate o_conv;
18090         o_conv.inner = untag_ptr(o);
18091         o_conv.is_owned = ptr_is_owned(o);
18092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18093         o_conv = HTLCUpdate_clone(&o_conv);
18094         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18095         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
18096         return tag_ptr(ret_conv, true);
18097 }
18098
18099 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
18100         void* e_ptr = untag_ptr(e);
18101         CHECK_ACCESS(e_ptr);
18102         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18103         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18104         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18105         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
18106         return tag_ptr(ret_conv, true);
18107 }
18108
18109 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
18110         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
18111         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
18112         return ret_conv;
18113 }
18114
18115 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
18116         if (!ptr_is_owned(_res)) return;
18117         void* _res_ptr = untag_ptr(_res);
18118         CHECK_ACCESS(_res_ptr);
18119         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
18120         FREE(untag_ptr(_res));
18121         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
18122 }
18123
18124 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
18125         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18126         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
18127         return tag_ptr(ret_conv, true);
18128 }
18129 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18130         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
18131         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
18132         return ret_conv;
18133 }
18134
18135 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
18136         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
18137         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18138         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
18139         return tag_ptr(ret_conv, true);
18140 }
18141
18142 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
18143         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18144         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
18145         return tag_ptr(ret_conv, true);
18146 }
18147 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
18148         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
18149         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
18150         return ret_conv;
18151 }
18152
18153 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
18154         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
18155         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18156         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
18157         return tag_ptr(ret_conv, true);
18158 }
18159
18160 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
18161         LDKOutPoint a_conv;
18162         a_conv.inner = untag_ptr(a);
18163         a_conv.is_owned = ptr_is_owned(a);
18164         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18165         a_conv = OutPoint_clone(&a_conv);
18166         LDKCVec_u8Z b_ref;
18167         b_ref.datalen = b->arr_len;
18168         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18169         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18170         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18171         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
18172         return tag_ptr(ret_conv, true);
18173 }
18174
18175 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
18176         if (!ptr_is_owned(_res)) return;
18177         void* _res_ptr = untag_ptr(_res);
18178         CHECK_ACCESS(_res_ptr);
18179         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
18180         FREE(untag_ptr(_res));
18181         C2Tuple_OutPointScriptZ_free(_res_conv);
18182 }
18183
18184 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
18185         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18186         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
18187         return tag_ptr(ret_conv, true);
18188 }
18189 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
18190         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
18191         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
18192         return ret_conv;
18193 }
18194
18195 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
18196         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
18197         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18198         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
18199         return tag_ptr(ret_conv, true);
18200 }
18201
18202 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
18203         LDKCVec_u8Z b_ref;
18204         b_ref.datalen = b->arr_len;
18205         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18206         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18207         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18208         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
18209         return tag_ptr(ret_conv, true);
18210 }
18211
18212 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
18213         if (!ptr_is_owned(_res)) return;
18214         void* _res_ptr = untag_ptr(_res);
18215         CHECK_ACCESS(_res_ptr);
18216         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
18217         FREE(untag_ptr(_res));
18218         C2Tuple_u32ScriptZ_free(_res_conv);
18219 }
18220
18221 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
18222         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
18223         _res_constr.datalen = _res->arr_len;
18224         if (_res_constr.datalen > 0)
18225                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18226         else
18227                 _res_constr.data = NULL;
18228         uint64_t* _res_vals = _res->elems;
18229         for (size_t v = 0; v < _res_constr.datalen; v++) {
18230                 uint64_t _res_conv_21 = _res_vals[v];
18231                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
18232                 CHECK_ACCESS(_res_conv_21_ptr);
18233                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
18234                 FREE(untag_ptr(_res_conv_21));
18235                 _res_constr.data[v] = _res_conv_21_conv;
18236         }
18237         FREE(_res);
18238         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
18239 }
18240
18241 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
18242         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18243         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
18244         return tag_ptr(ret_conv, true);
18245 }
18246 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
18247         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
18248         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
18249         return ret_conv;
18250 }
18251
18252 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
18253         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
18254         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18255         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
18256         return tag_ptr(ret_conv, true);
18257 }
18258
18259 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
18260         LDKThirtyTwoBytes a_ref;
18261         CHECK(a->arr_len == 32);
18262         memcpy(a_ref.data, a->elems, 32); FREE(a);
18263         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
18264         b_constr.datalen = b->arr_len;
18265         if (b_constr.datalen > 0)
18266                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18267         else
18268                 b_constr.data = NULL;
18269         uint64_t* b_vals = b->elems;
18270         for (size_t v = 0; v < b_constr.datalen; v++) {
18271                 uint64_t b_conv_21 = b_vals[v];
18272                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
18273                 CHECK_ACCESS(b_conv_21_ptr);
18274                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
18275                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
18276                 b_constr.data[v] = b_conv_21_conv;
18277         }
18278         FREE(b);
18279         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18280         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
18281         return tag_ptr(ret_conv, true);
18282 }
18283
18284 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
18285         if (!ptr_is_owned(_res)) return;
18286         void* _res_ptr = untag_ptr(_res);
18287         CHECK_ACCESS(_res_ptr);
18288         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
18289         FREE(untag_ptr(_res));
18290         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
18291 }
18292
18293 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
18294         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
18295         _res_constr.datalen = _res->arr_len;
18296         if (_res_constr.datalen > 0)
18297                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
18298         else
18299                 _res_constr.data = NULL;
18300         uint64_t* _res_vals = _res->elems;
18301         for (size_t o = 0; o < _res_constr.datalen; o++) {
18302                 uint64_t _res_conv_40 = _res_vals[o];
18303                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18304                 CHECK_ACCESS(_res_conv_40_ptr);
18305                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
18306                 FREE(untag_ptr(_res_conv_40));
18307                 _res_constr.data[o] = _res_conv_40_conv;
18308         }
18309         FREE(_res);
18310         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
18311 }
18312
18313 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
18314         LDKCVec_EventZ _res_constr;
18315         _res_constr.datalen = _res->arr_len;
18316         if (_res_constr.datalen > 0)
18317                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
18318         else
18319                 _res_constr.data = NULL;
18320         uint64_t* _res_vals = _res->elems;
18321         for (size_t h = 0; h < _res_constr.datalen; h++) {
18322                 uint64_t _res_conv_7 = _res_vals[h];
18323                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18324                 CHECK_ACCESS(_res_conv_7_ptr);
18325                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
18326                 FREE(untag_ptr(_res_conv_7));
18327                 _res_constr.data[h] = _res_conv_7_conv;
18328         }
18329         FREE(_res);
18330         CVec_EventZ_free(_res_constr);
18331 }
18332
18333 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
18334         LDKCVec_TransactionZ _res_constr;
18335         _res_constr.datalen = _res->arr_len;
18336         if (_res_constr.datalen > 0)
18337                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18338         else
18339                 _res_constr.data = NULL;
18340         int8_tArray* _res_vals = (void*) _res->elems;
18341         for (size_t m = 0; m < _res_constr.datalen; m++) {
18342                 int8_tArray _res_conv_12 = _res_vals[m];
18343                 LDKTransaction _res_conv_12_ref;
18344                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18345                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18346                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18347                 _res_conv_12_ref.data_is_owned = true;
18348                 _res_constr.data[m] = _res_conv_12_ref;
18349         }
18350         FREE(_res);
18351         CVec_TransactionZ_free(_res_constr);
18352 }
18353
18354 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18355         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18356         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18357         return tag_ptr(ret_conv, true);
18358 }
18359 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18360         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18361         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18362         return ret_conv;
18363 }
18364
18365 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18366         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18367         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18368         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18369         return tag_ptr(ret_conv, true);
18370 }
18371
18372 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18373         void* b_ptr = untag_ptr(b);
18374         CHECK_ACCESS(b_ptr);
18375         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18376         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18377         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18378         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18379         return tag_ptr(ret_conv, true);
18380 }
18381
18382 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18383         if (!ptr_is_owned(_res)) return;
18384         void* _res_ptr = untag_ptr(_res);
18385         CHECK_ACCESS(_res_ptr);
18386         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18387         FREE(untag_ptr(_res));
18388         C2Tuple_u32TxOutZ_free(_res_conv);
18389 }
18390
18391 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18392         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18393         _res_constr.datalen = _res->arr_len;
18394         if (_res_constr.datalen > 0)
18395                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18396         else
18397                 _res_constr.data = NULL;
18398         uint64_t* _res_vals = _res->elems;
18399         for (size_t u = 0; u < _res_constr.datalen; u++) {
18400                 uint64_t _res_conv_20 = _res_vals[u];
18401                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18402                 CHECK_ACCESS(_res_conv_20_ptr);
18403                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18404                 FREE(untag_ptr(_res_conv_20));
18405                 _res_constr.data[u] = _res_conv_20_conv;
18406         }
18407         FREE(_res);
18408         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18409 }
18410
18411 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18412         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18413         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18414         return tag_ptr(ret_conv, true);
18415 }
18416 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
18417         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
18418         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18419         return ret_conv;
18420 }
18421
18422 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
18423         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
18424         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18425         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18426         return tag_ptr(ret_conv, true);
18427 }
18428
18429 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
18430         LDKThirtyTwoBytes a_ref;
18431         CHECK(a->arr_len == 32);
18432         memcpy(a_ref.data, a->elems, 32); FREE(a);
18433         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18434         b_constr.datalen = b->arr_len;
18435         if (b_constr.datalen > 0)
18436                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18437         else
18438                 b_constr.data = NULL;
18439         uint64_t* b_vals = b->elems;
18440         for (size_t u = 0; u < b_constr.datalen; u++) {
18441                 uint64_t b_conv_20 = b_vals[u];
18442                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
18443                 CHECK_ACCESS(b_conv_20_ptr);
18444                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18445                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
18446                 b_constr.data[u] = b_conv_20_conv;
18447         }
18448         FREE(b);
18449         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18450         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18451         return tag_ptr(ret_conv, true);
18452 }
18453
18454 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
18455         if (!ptr_is_owned(_res)) return;
18456         void* _res_ptr = untag_ptr(_res);
18457         CHECK_ACCESS(_res_ptr);
18458         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18459         FREE(untag_ptr(_res));
18460         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18461 }
18462
18463 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
18464         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18465         _res_constr.datalen = _res->arr_len;
18466         if (_res_constr.datalen > 0)
18467                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18468         else
18469                 _res_constr.data = NULL;
18470         uint64_t* _res_vals = _res->elems;
18471         for (size_t n = 0; n < _res_constr.datalen; n++) {
18472                 uint64_t _res_conv_39 = _res_vals[n];
18473                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
18474                 CHECK_ACCESS(_res_conv_39_ptr);
18475                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18476                 FREE(untag_ptr(_res_conv_39));
18477                 _res_constr.data[n] = _res_conv_39_conv;
18478         }
18479         FREE(_res);
18480         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18481 }
18482
18483 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
18484         LDKCVec_BalanceZ _res_constr;
18485         _res_constr.datalen = _res->arr_len;
18486         if (_res_constr.datalen > 0)
18487                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18488         else
18489                 _res_constr.data = NULL;
18490         uint64_t* _res_vals = _res->elems;
18491         for (size_t j = 0; j < _res_constr.datalen; j++) {
18492                 uint64_t _res_conv_9 = _res_vals[j];
18493                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
18494                 CHECK_ACCESS(_res_conv_9_ptr);
18495                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18496                 FREE(untag_ptr(_res_conv_9));
18497                 _res_constr.data[j] = _res_conv_9_conv;
18498         }
18499         FREE(_res);
18500         CVec_BalanceZ_free(_res_constr);
18501 }
18502
18503 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18504         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18505         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18506         return tag_ptr(ret_conv, true);
18507 }
18508 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
18509         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18510         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18511         return ret_conv;
18512 }
18513
18514 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
18515         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18516         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18517         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18518         return tag_ptr(ret_conv, true);
18519 }
18520
18521 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
18522         LDKThirtyTwoBytes a_ref;
18523         CHECK(a->arr_len == 32);
18524         memcpy(a_ref.data, a->elems, 32); FREE(a);
18525         LDKChannelMonitor b_conv;
18526         b_conv.inner = untag_ptr(b);
18527         b_conv.is_owned = ptr_is_owned(b);
18528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18529         b_conv = ChannelMonitor_clone(&b_conv);
18530         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18531         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18532         return tag_ptr(ret_conv, true);
18533 }
18534
18535 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
18536         if (!ptr_is_owned(_res)) return;
18537         void* _res_ptr = untag_ptr(_res);
18538         CHECK_ACCESS(_res_ptr);
18539         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18540         FREE(untag_ptr(_res));
18541         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18542 }
18543
18544 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
18545         void* o_ptr = untag_ptr(o);
18546         CHECK_ACCESS(o_ptr);
18547         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18548         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
18549         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18550         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18551         return tag_ptr(ret_conv, true);
18552 }
18553
18554 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
18555         void* e_ptr = untag_ptr(e);
18556         CHECK_ACCESS(e_ptr);
18557         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18558         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18559         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18560         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18561         return tag_ptr(ret_conv, true);
18562 }
18563
18564 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
18565         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
18566         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18567         return ret_conv;
18568 }
18569
18570 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
18571         if (!ptr_is_owned(_res)) return;
18572         void* _res_ptr = untag_ptr(_res);
18573         CHECK_ACCESS(_res_ptr);
18574         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18575         FREE(untag_ptr(_res));
18576         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18577 }
18578
18579 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18580         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18581         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18582         return tag_ptr(ret_conv, true);
18583 }
18584 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18585         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
18586         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18587         return ret_conv;
18588 }
18589
18590 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
18591         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
18592         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18593         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18594         return tag_ptr(ret_conv, true);
18595 }
18596
18597 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18598         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18599         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18600         return tag_ptr(ret_conv, true);
18601 }
18602 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
18603         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
18604         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18605         return ret_conv;
18606 }
18607
18608 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
18609         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
18610         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18611         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18612         return tag_ptr(ret_conv, true);
18613 }
18614
18615 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
18616         LDKPublicKey a_ref;
18617         CHECK(a->arr_len == 33);
18618         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18619         void* b_ptr = untag_ptr(b);
18620         CHECK_ACCESS(b_ptr);
18621         LDKType b_conv = *(LDKType*)(b_ptr);
18622         if (b_conv.free == LDKType_JCalls_free) {
18623                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18624                 LDKType_JCalls_cloned(&b_conv);
18625         }
18626         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18627         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18628         return tag_ptr(ret_conv, true);
18629 }
18630
18631 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
18632         if (!ptr_is_owned(_res)) return;
18633         void* _res_ptr = untag_ptr(_res);
18634         CHECK_ACCESS(_res_ptr);
18635         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18636         FREE(untag_ptr(_res));
18637         C2Tuple_PublicKeyTypeZ_free(_res_conv);
18638 }
18639
18640 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
18641         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18642         _res_constr.datalen = _res->arr_len;
18643         if (_res_constr.datalen > 0)
18644                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18645         else
18646                 _res_constr.data = NULL;
18647         uint64_t* _res_vals = _res->elems;
18648         for (size_t z = 0; z < _res_constr.datalen; z++) {
18649                 uint64_t _res_conv_25 = _res_vals[z];
18650                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
18651                 CHECK_ACCESS(_res_conv_25_ptr);
18652                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18653                 FREE(untag_ptr(_res_conv_25));
18654                 _res_constr.data[z] = _res_conv_25_conv;
18655         }
18656         FREE(_res);
18657         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18658 }
18659
18660 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
18661         void* o_ptr = untag_ptr(o);
18662         CHECK_ACCESS(o_ptr);
18663         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
18664         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
18665                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18666                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
18667         }
18668         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18669         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
18670         uint64_t ret_ref = tag_ptr(ret_copy, true);
18671         return ret_ref;
18672 }
18673
18674 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
18675         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18676         *ret_copy = COption_CustomOnionMessageContentsZ_none();
18677         uint64_t ret_ref = tag_ptr(ret_copy, true);
18678         return ret_ref;
18679 }
18680
18681 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
18682         if (!ptr_is_owned(_res)) return;
18683         void* _res_ptr = untag_ptr(_res);
18684         CHECK_ACCESS(_res_ptr);
18685         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
18686         FREE(untag_ptr(_res));
18687         COption_CustomOnionMessageContentsZ_free(_res_conv);
18688 }
18689
18690 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
18691         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18692         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
18693         uint64_t ret_ref = tag_ptr(ret_copy, true);
18694         return ret_ref;
18695 }
18696 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
18697         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
18698         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
18699         return ret_conv;
18700 }
18701
18702 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
18703         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
18704         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18705         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
18706         uint64_t ret_ref = tag_ptr(ret_copy, true);
18707         return ret_ref;
18708 }
18709
18710 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
18711         void* o_ptr = untag_ptr(o);
18712         CHECK_ACCESS(o_ptr);
18713         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
18714         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
18715         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18716         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
18717         return tag_ptr(ret_conv, true);
18718 }
18719
18720 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
18721         void* e_ptr = untag_ptr(e);
18722         CHECK_ACCESS(e_ptr);
18723         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18724         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18725         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18726         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
18727         return tag_ptr(ret_conv, true);
18728 }
18729
18730 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
18731         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
18732         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
18733         return ret_conv;
18734 }
18735
18736 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
18737         if (!ptr_is_owned(_res)) return;
18738         void* _res_ptr = untag_ptr(_res);
18739         CHECK_ACCESS(_res_ptr);
18740         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
18741         FREE(untag_ptr(_res));
18742         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
18743 }
18744
18745 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
18746         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18747         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
18748         return tag_ptr(ret_conv, true);
18749 }
18750 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
18751         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
18752         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
18753         return ret_conv;
18754 }
18755
18756 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
18757         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
18758         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18759         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
18760         return tag_ptr(ret_conv, true);
18761 }
18762
18763 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
18764         void* o_ptr = untag_ptr(o);
18765         CHECK_ACCESS(o_ptr);
18766         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18767         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18768         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18769         *ret_copy = COption_NetAddressZ_some(o_conv);
18770         uint64_t ret_ref = tag_ptr(ret_copy, true);
18771         return ret_ref;
18772 }
18773
18774 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
18775         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18776         *ret_copy = COption_NetAddressZ_none();
18777         uint64_t ret_ref = tag_ptr(ret_copy, true);
18778         return ret_ref;
18779 }
18780
18781 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
18782         if (!ptr_is_owned(_res)) return;
18783         void* _res_ptr = untag_ptr(_res);
18784         CHECK_ACCESS(_res_ptr);
18785         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
18786         FREE(untag_ptr(_res));
18787         COption_NetAddressZ_free(_res_conv);
18788 }
18789
18790 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
18791         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18792         *ret_copy = COption_NetAddressZ_clone(arg);
18793         uint64_t ret_ref = tag_ptr(ret_copy, true);
18794         return ret_ref;
18795 }
18796 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
18797         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
18798         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
18799         return ret_conv;
18800 }
18801
18802 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
18803         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
18804         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18805         *ret_copy = COption_NetAddressZ_clone(orig_conv);
18806         uint64_t ret_ref = tag_ptr(ret_copy, true);
18807         return ret_ref;
18808 }
18809
18810 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
18811         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
18812         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
18813         return tag_ptr(ret_conv, true);
18814 }
18815 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(uint64_t arg) {
18816         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
18817         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
18818         return ret_conv;
18819 }
18820
18821 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone(uint64_t orig) {
18822         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
18823         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
18824         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
18825         return tag_ptr(ret_conv, true);
18826 }
18827
18828 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new(int8_tArray a, uint64_t b) {
18829         LDKPublicKey a_ref;
18830         CHECK(a->arr_len == 33);
18831         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18832         void* b_ptr = untag_ptr(b);
18833         CHECK_ACCESS(b_ptr);
18834         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
18835         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
18836         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
18837         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
18838         return tag_ptr(ret_conv, true);
18839 }
18840
18841 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free(uint64_t _res) {
18842         if (!ptr_is_owned(_res)) return;
18843         void* _res_ptr = untag_ptr(_res);
18844         CHECK_ACCESS(_res_ptr);
18845         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
18846         FREE(untag_ptr(_res));
18847         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
18848 }
18849
18850 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(uint64_tArray _res) {
18851         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
18852         _res_constr.datalen = _res->arr_len;
18853         if (_res_constr.datalen > 0)
18854                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
18855         else
18856                 _res_constr.data = NULL;
18857         uint64_t* _res_vals = _res->elems;
18858         for (size_t o = 0; o < _res_constr.datalen; o++) {
18859                 uint64_t _res_conv_40 = _res_vals[o];
18860                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18861                 CHECK_ACCESS(_res_conv_40_ptr);
18862                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
18863                 FREE(untag_ptr(_res_conv_40));
18864                 _res_constr.data[o] = _res_conv_40_conv;
18865         }
18866         FREE(_res);
18867         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
18868 }
18869
18870 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
18871         LDKCVec_u8Z o_ref;
18872         o_ref.datalen = o->arr_len;
18873         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18874         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18875         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18876         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18877         return tag_ptr(ret_conv, true);
18878 }
18879
18880 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
18881         LDKPeerHandleError e_conv;
18882         e_conv.inner = untag_ptr(e);
18883         e_conv.is_owned = ptr_is_owned(e);
18884         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18885         e_conv = PeerHandleError_clone(&e_conv);
18886         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18887         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18888         return tag_ptr(ret_conv, true);
18889 }
18890
18891 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
18892         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
18893         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18894         return ret_conv;
18895 }
18896
18897 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
18898         if (!ptr_is_owned(_res)) return;
18899         void* _res_ptr = untag_ptr(_res);
18900         CHECK_ACCESS(_res_ptr);
18901         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18902         FREE(untag_ptr(_res));
18903         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18904 }
18905
18906 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18907         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18908         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18909         return tag_ptr(ret_conv, true);
18910 }
18911 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18912         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
18913         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18914         return ret_conv;
18915 }
18916
18917 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
18918         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
18919         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18920         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18921         return tag_ptr(ret_conv, true);
18922 }
18923
18924 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
18925         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18926         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18927         return tag_ptr(ret_conv, true);
18928 }
18929
18930 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
18931         LDKPeerHandleError e_conv;
18932         e_conv.inner = untag_ptr(e);
18933         e_conv.is_owned = ptr_is_owned(e);
18934         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18935         e_conv = PeerHandleError_clone(&e_conv);
18936         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18937         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18938         return tag_ptr(ret_conv, true);
18939 }
18940
18941 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
18942         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
18943         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18944         return ret_conv;
18945 }
18946
18947 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
18948         if (!ptr_is_owned(_res)) return;
18949         void* _res_ptr = untag_ptr(_res);
18950         CHECK_ACCESS(_res_ptr);
18951         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18952         FREE(untag_ptr(_res));
18953         CResult_NonePeerHandleErrorZ_free(_res_conv);
18954 }
18955
18956 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18957         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18958         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18959         return tag_ptr(ret_conv, true);
18960 }
18961 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
18962         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
18963         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18964         return ret_conv;
18965 }
18966
18967 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
18968         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
18969         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18970         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18971         return tag_ptr(ret_conv, true);
18972 }
18973
18974 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
18975         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18976         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18977         return tag_ptr(ret_conv, true);
18978 }
18979
18980 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
18981         LDKPeerHandleError e_conv;
18982         e_conv.inner = untag_ptr(e);
18983         e_conv.is_owned = ptr_is_owned(e);
18984         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18985         e_conv = PeerHandleError_clone(&e_conv);
18986         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18987         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18988         return tag_ptr(ret_conv, true);
18989 }
18990
18991 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
18992         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
18993         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18994         return ret_conv;
18995 }
18996
18997 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
18998         if (!ptr_is_owned(_res)) return;
18999         void* _res_ptr = untag_ptr(_res);
19000         CHECK_ACCESS(_res_ptr);
19001         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
19002         FREE(untag_ptr(_res));
19003         CResult_boolPeerHandleErrorZ_free(_res_conv);
19004 }
19005
19006 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
19007         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19008         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
19009         return tag_ptr(ret_conv, true);
19010 }
19011 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19012         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
19013         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
19014         return ret_conv;
19015 }
19016
19017 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
19018         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
19019         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19020         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
19021         return tag_ptr(ret_conv, true);
19022 }
19023
19024 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
19025         void* o_ptr = untag_ptr(o);
19026         CHECK_ACCESS(o_ptr);
19027         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
19028         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
19029         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19030         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
19031         return tag_ptr(ret_conv, true);
19032 }
19033
19034 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
19035         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
19036         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19037         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
19038         return tag_ptr(ret_conv, true);
19039 }
19040
19041 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
19042         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
19043         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
19044         return ret_conv;
19045 }
19046
19047 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
19048         if (!ptr_is_owned(_res)) return;
19049         void* _res_ptr = untag_ptr(_res);
19050         CHECK_ACCESS(_res_ptr);
19051         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
19052         FREE(untag_ptr(_res));
19053         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
19054 }
19055
19056 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
19057         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19058         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
19059         return tag_ptr(ret_conv, true);
19060 }
19061 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
19062         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
19063         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
19064         return ret_conv;
19065 }
19066
19067 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
19068         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
19069         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19070         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
19071         return tag_ptr(ret_conv, true);
19072 }
19073
19074 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
19075         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19076         *ret_conv = CResult_NoneSendErrorZ_ok();
19077         return tag_ptr(ret_conv, true);
19078 }
19079
19080 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
19081         void* e_ptr = untag_ptr(e);
19082         CHECK_ACCESS(e_ptr);
19083         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
19084         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
19085         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19086         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
19087         return tag_ptr(ret_conv, true);
19088 }
19089
19090 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
19091         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
19092         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
19093         return ret_conv;
19094 }
19095
19096 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
19097         if (!ptr_is_owned(_res)) return;
19098         void* _res_ptr = untag_ptr(_res);
19099         CHECK_ACCESS(_res_ptr);
19100         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
19101         FREE(untag_ptr(_res));
19102         CResult_NoneSendErrorZ_free(_res_conv);
19103 }
19104
19105 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
19106         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19107         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
19108         return tag_ptr(ret_conv, true);
19109 }
19110
19111 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
19112         void* e_ptr = untag_ptr(e);
19113         CHECK_ACCESS(e_ptr);
19114         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
19115         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
19116         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19117         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
19118         return tag_ptr(ret_conv, true);
19119 }
19120
19121 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
19122         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
19123         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
19124         return ret_conv;
19125 }
19126
19127 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
19128         if (!ptr_is_owned(_res)) return;
19129         void* _res_ptr = untag_ptr(_res);
19130         CHECK_ACCESS(_res_ptr);
19131         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
19132         FREE(untag_ptr(_res));
19133         CResult_u32GraphSyncErrorZ_free(_res_conv);
19134 }
19135
19136 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
19137         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
19138         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19139         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
19140         return tag_ptr(ret_conv, true);
19141 }
19142
19143 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
19144         void* e_ptr = untag_ptr(e);
19145         CHECK_ACCESS(e_ptr);
19146         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19147         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19148         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19149         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
19150         return tag_ptr(ret_conv, true);
19151 }
19152
19153 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
19154         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
19155         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
19156         return ret_conv;
19157 }
19158
19159 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
19160         if (!ptr_is_owned(_res)) return;
19161         void* _res_ptr = untag_ptr(_res);
19162         CHECK_ACCESS(_res_ptr);
19163         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
19164         FREE(untag_ptr(_res));
19165         CResult_SiPrefixParseErrorZ_free(_res_conv);
19166 }
19167
19168 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
19169         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19170         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
19171         return tag_ptr(ret_conv, true);
19172 }
19173 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
19174         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
19175         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
19176         return ret_conv;
19177 }
19178
19179 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
19180         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
19181         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19182         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
19183         return tag_ptr(ret_conv, true);
19184 }
19185
19186 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
19187         LDKInvoice o_conv;
19188         o_conv.inner = untag_ptr(o);
19189         o_conv.is_owned = ptr_is_owned(o);
19190         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19191         o_conv = Invoice_clone(&o_conv);
19192         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19193         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
19194         return tag_ptr(ret_conv, true);
19195 }
19196
19197 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
19198         void* e_ptr = untag_ptr(e);
19199         CHECK_ACCESS(e_ptr);
19200         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
19201         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
19202         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19203         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
19204         return tag_ptr(ret_conv, true);
19205 }
19206
19207 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
19208         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
19209         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
19210         return ret_conv;
19211 }
19212
19213 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
19214         if (!ptr_is_owned(_res)) return;
19215         void* _res_ptr = untag_ptr(_res);
19216         CHECK_ACCESS(_res_ptr);
19217         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
19218         FREE(untag_ptr(_res));
19219         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
19220 }
19221
19222 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
19223         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19224         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
19225         return tag_ptr(ret_conv, true);
19226 }
19227 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
19228         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
19229         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
19230         return ret_conv;
19231 }
19232
19233 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
19234         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
19235         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19236         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
19237         return tag_ptr(ret_conv, true);
19238 }
19239
19240 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
19241         LDKSignedRawInvoice o_conv;
19242         o_conv.inner = untag_ptr(o);
19243         o_conv.is_owned = ptr_is_owned(o);
19244         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19245         o_conv = SignedRawInvoice_clone(&o_conv);
19246         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19247         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
19248         return tag_ptr(ret_conv, true);
19249 }
19250
19251 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
19252         void* e_ptr = untag_ptr(e);
19253         CHECK_ACCESS(e_ptr);
19254         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19255         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19256         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19257         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
19258         return tag_ptr(ret_conv, true);
19259 }
19260
19261 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
19262         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
19263         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
19264         return ret_conv;
19265 }
19266
19267 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
19268         if (!ptr_is_owned(_res)) return;
19269         void* _res_ptr = untag_ptr(_res);
19270         CHECK_ACCESS(_res_ptr);
19271         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
19272         FREE(untag_ptr(_res));
19273         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
19274 }
19275
19276 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
19277         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19278         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
19279         return tag_ptr(ret_conv, true);
19280 }
19281 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
19282         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
19283         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
19284         return ret_conv;
19285 }
19286
19287 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
19288         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
19289         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19290         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
19291         return tag_ptr(ret_conv, true);
19292 }
19293
19294 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
19295         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19296         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
19297         return tag_ptr(ret_conv, true);
19298 }
19299 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
19300         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
19301         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
19302         return ret_conv;
19303 }
19304
19305 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
19306         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
19307         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19308         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
19309         return tag_ptr(ret_conv, true);
19310 }
19311
19312 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
19313         LDKRawInvoice a_conv;
19314         a_conv.inner = untag_ptr(a);
19315         a_conv.is_owned = ptr_is_owned(a);
19316         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19317         a_conv = RawInvoice_clone(&a_conv);
19318         LDKThirtyTwoBytes b_ref;
19319         CHECK(b->arr_len == 32);
19320         memcpy(b_ref.data, b->elems, 32); FREE(b);
19321         LDKInvoiceSignature c_conv;
19322         c_conv.inner = untag_ptr(c);
19323         c_conv.is_owned = ptr_is_owned(c);
19324         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19325         c_conv = InvoiceSignature_clone(&c_conv);
19326         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19327         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
19328         return tag_ptr(ret_conv, true);
19329 }
19330
19331 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
19332         if (!ptr_is_owned(_res)) return;
19333         void* _res_ptr = untag_ptr(_res);
19334         CHECK_ACCESS(_res_ptr);
19335         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
19336         FREE(untag_ptr(_res));
19337         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
19338 }
19339
19340 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
19341         LDKPayeePubKey o_conv;
19342         o_conv.inner = untag_ptr(o);
19343         o_conv.is_owned = ptr_is_owned(o);
19344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19345         o_conv = PayeePubKey_clone(&o_conv);
19346         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19347         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
19348         return tag_ptr(ret_conv, true);
19349 }
19350
19351 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
19352         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
19353         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19354         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
19355         return tag_ptr(ret_conv, true);
19356 }
19357
19358 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
19359         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
19360         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
19361         return ret_conv;
19362 }
19363
19364 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
19365         if (!ptr_is_owned(_res)) return;
19366         void* _res_ptr = untag_ptr(_res);
19367         CHECK_ACCESS(_res_ptr);
19368         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
19369         FREE(untag_ptr(_res));
19370         CResult_PayeePubKeyErrorZ_free(_res_conv);
19371 }
19372
19373 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
19374         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19375         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
19376         return tag_ptr(ret_conv, true);
19377 }
19378 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
19379         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
19380         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
19381         return ret_conv;
19382 }
19383
19384 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
19385         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
19386         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19387         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
19388         return tag_ptr(ret_conv, true);
19389 }
19390
19391 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
19392         LDKCVec_PrivateRouteZ _res_constr;
19393         _res_constr.datalen = _res->arr_len;
19394         if (_res_constr.datalen > 0)
19395                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
19396         else
19397                 _res_constr.data = NULL;
19398         uint64_t* _res_vals = _res->elems;
19399         for (size_t o = 0; o < _res_constr.datalen; o++) {
19400                 uint64_t _res_conv_14 = _res_vals[o];
19401                 LDKPrivateRoute _res_conv_14_conv;
19402                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19403                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19404                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19405                 _res_constr.data[o] = _res_conv_14_conv;
19406         }
19407         FREE(_res);
19408         CVec_PrivateRouteZ_free(_res_constr);
19409 }
19410
19411 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
19412         LDKPositiveTimestamp o_conv;
19413         o_conv.inner = untag_ptr(o);
19414         o_conv.is_owned = ptr_is_owned(o);
19415         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19416         o_conv = PositiveTimestamp_clone(&o_conv);
19417         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19418         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
19419         return tag_ptr(ret_conv, true);
19420 }
19421
19422 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
19423         LDKCreationError e_conv = LDKCreationError_from_js(e);
19424         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19425         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
19426         return tag_ptr(ret_conv, true);
19427 }
19428
19429 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
19430         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
19431         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
19432         return ret_conv;
19433 }
19434
19435 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
19436         if (!ptr_is_owned(_res)) return;
19437         void* _res_ptr = untag_ptr(_res);
19438         CHECK_ACCESS(_res_ptr);
19439         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
19440         FREE(untag_ptr(_res));
19441         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
19442 }
19443
19444 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
19445         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19446         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
19447         return tag_ptr(ret_conv, true);
19448 }
19449 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
19450         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
19451         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
19452         return ret_conv;
19453 }
19454
19455 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
19456         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
19457         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19458         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
19459         return tag_ptr(ret_conv, true);
19460 }
19461
19462 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
19463         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19464         *ret_conv = CResult_NoneSemanticErrorZ_ok();
19465         return tag_ptr(ret_conv, true);
19466 }
19467
19468 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
19469         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
19470         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19471         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
19472         return tag_ptr(ret_conv, true);
19473 }
19474
19475 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
19476         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
19477         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
19478         return ret_conv;
19479 }
19480
19481 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
19482         if (!ptr_is_owned(_res)) return;
19483         void* _res_ptr = untag_ptr(_res);
19484         CHECK_ACCESS(_res_ptr);
19485         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
19486         FREE(untag_ptr(_res));
19487         CResult_NoneSemanticErrorZ_free(_res_conv);
19488 }
19489
19490 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
19491         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19492         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
19493         return tag_ptr(ret_conv, true);
19494 }
19495 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
19496         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
19497         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
19498         return ret_conv;
19499 }
19500
19501 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
19502         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
19503         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19504         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
19505         return tag_ptr(ret_conv, true);
19506 }
19507
19508 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
19509         LDKInvoice o_conv;
19510         o_conv.inner = untag_ptr(o);
19511         o_conv.is_owned = ptr_is_owned(o);
19512         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19513         o_conv = Invoice_clone(&o_conv);
19514         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19515         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
19516         return tag_ptr(ret_conv, true);
19517 }
19518
19519 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
19520         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
19521         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19522         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
19523         return tag_ptr(ret_conv, true);
19524 }
19525
19526 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
19527         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
19528         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
19529         return ret_conv;
19530 }
19531
19532 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
19533         if (!ptr_is_owned(_res)) return;
19534         void* _res_ptr = untag_ptr(_res);
19535         CHECK_ACCESS(_res_ptr);
19536         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
19537         FREE(untag_ptr(_res));
19538         CResult_InvoiceSemanticErrorZ_free(_res_conv);
19539 }
19540
19541 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
19542         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19543         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
19544         return tag_ptr(ret_conv, true);
19545 }
19546 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
19547         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
19548         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
19549         return ret_conv;
19550 }
19551
19552 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
19553         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
19554         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19555         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
19556         return tag_ptr(ret_conv, true);
19557 }
19558
19559 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
19560         LDKDescription o_conv;
19561         o_conv.inner = untag_ptr(o);
19562         o_conv.is_owned = ptr_is_owned(o);
19563         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19564         o_conv = Description_clone(&o_conv);
19565         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19566         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
19567         return tag_ptr(ret_conv, true);
19568 }
19569
19570 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
19571         LDKCreationError e_conv = LDKCreationError_from_js(e);
19572         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19573         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
19574         return tag_ptr(ret_conv, true);
19575 }
19576
19577 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
19578         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
19579         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
19580         return ret_conv;
19581 }
19582
19583 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
19584         if (!ptr_is_owned(_res)) return;
19585         void* _res_ptr = untag_ptr(_res);
19586         CHECK_ACCESS(_res_ptr);
19587         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
19588         FREE(untag_ptr(_res));
19589         CResult_DescriptionCreationErrorZ_free(_res_conv);
19590 }
19591
19592 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
19593         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19594         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
19595         return tag_ptr(ret_conv, true);
19596 }
19597 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
19598         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
19599         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
19600         return ret_conv;
19601 }
19602
19603 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
19604         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
19605         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19606         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
19607         return tag_ptr(ret_conv, true);
19608 }
19609
19610 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
19611         LDKPrivateRoute o_conv;
19612         o_conv.inner = untag_ptr(o);
19613         o_conv.is_owned = ptr_is_owned(o);
19614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19615         o_conv = PrivateRoute_clone(&o_conv);
19616         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19617         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
19618         return tag_ptr(ret_conv, true);
19619 }
19620
19621 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
19622         LDKCreationError e_conv = LDKCreationError_from_js(e);
19623         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19624         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
19625         return tag_ptr(ret_conv, true);
19626 }
19627
19628 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
19629         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
19630         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
19631         return ret_conv;
19632 }
19633
19634 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
19635         if (!ptr_is_owned(_res)) return;
19636         void* _res_ptr = untag_ptr(_res);
19637         CHECK_ACCESS(_res_ptr);
19638         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
19639         FREE(untag_ptr(_res));
19640         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
19641 }
19642
19643 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
19644         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19645         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
19646         return tag_ptr(ret_conv, true);
19647 }
19648 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
19649         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
19650         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
19651         return ret_conv;
19652 }
19653
19654 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
19655         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
19656         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19657         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
19658         return tag_ptr(ret_conv, true);
19659 }
19660
19661 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
19662         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19663         *ret_conv = CResult_NoneErrorZ_ok();
19664         return tag_ptr(ret_conv, true);
19665 }
19666
19667 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
19668         LDKIOError e_conv = LDKIOError_from_js(e);
19669         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19670         *ret_conv = CResult_NoneErrorZ_err(e_conv);
19671         return tag_ptr(ret_conv, true);
19672 }
19673
19674 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
19675         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
19676         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
19677         return ret_conv;
19678 }
19679
19680 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
19681         if (!ptr_is_owned(_res)) return;
19682         void* _res_ptr = untag_ptr(_res);
19683         CHECK_ACCESS(_res_ptr);
19684         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
19685         FREE(untag_ptr(_res));
19686         CResult_NoneErrorZ_free(_res_conv);
19687 }
19688
19689 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
19690         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19691         *ret_conv = CResult_NoneErrorZ_clone(arg);
19692         return tag_ptr(ret_conv, true);
19693 }
19694 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
19695         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
19696         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
19697         return ret_conv;
19698 }
19699
19700 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
19701         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
19702         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19703         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
19704         return tag_ptr(ret_conv, true);
19705 }
19706
19707 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
19708         void* o_ptr = untag_ptr(o);
19709         CHECK_ACCESS(o_ptr);
19710         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19711         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19712         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19713         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
19714         return tag_ptr(ret_conv, true);
19715 }
19716
19717 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
19718         void* e_ptr = untag_ptr(e);
19719         CHECK_ACCESS(e_ptr);
19720         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19721         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19722         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19723         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
19724         return tag_ptr(ret_conv, true);
19725 }
19726
19727 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
19728         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
19729         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
19730         return ret_conv;
19731 }
19732
19733 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
19734         if (!ptr_is_owned(_res)) return;
19735         void* _res_ptr = untag_ptr(_res);
19736         CHECK_ACCESS(_res_ptr);
19737         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
19738         FREE(untag_ptr(_res));
19739         CResult_NetAddressDecodeErrorZ_free(_res_conv);
19740 }
19741
19742 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
19743         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19744         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
19745         return tag_ptr(ret_conv, true);
19746 }
19747 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
19748         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
19749         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
19750         return ret_conv;
19751 }
19752
19753 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
19754         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
19755         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19756         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
19757         return tag_ptr(ret_conv, true);
19758 }
19759
19760 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
19761         LDKCVec_UpdateAddHTLCZ _res_constr;
19762         _res_constr.datalen = _res->arr_len;
19763         if (_res_constr.datalen > 0)
19764                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19765         else
19766                 _res_constr.data = NULL;
19767         uint64_t* _res_vals = _res->elems;
19768         for (size_t p = 0; p < _res_constr.datalen; p++) {
19769                 uint64_t _res_conv_15 = _res_vals[p];
19770                 LDKUpdateAddHTLC _res_conv_15_conv;
19771                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
19772                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
19773                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
19774                 _res_constr.data[p] = _res_conv_15_conv;
19775         }
19776         FREE(_res);
19777         CVec_UpdateAddHTLCZ_free(_res_constr);
19778 }
19779
19780 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
19781         LDKCVec_UpdateFulfillHTLCZ _res_constr;
19782         _res_constr.datalen = _res->arr_len;
19783         if (_res_constr.datalen > 0)
19784                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19785         else
19786                 _res_constr.data = NULL;
19787         uint64_t* _res_vals = _res->elems;
19788         for (size_t t = 0; t < _res_constr.datalen; t++) {
19789                 uint64_t _res_conv_19 = _res_vals[t];
19790                 LDKUpdateFulfillHTLC _res_conv_19_conv;
19791                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
19792                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
19793                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
19794                 _res_constr.data[t] = _res_conv_19_conv;
19795         }
19796         FREE(_res);
19797         CVec_UpdateFulfillHTLCZ_free(_res_constr);
19798 }
19799
19800 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
19801         LDKCVec_UpdateFailHTLCZ _res_constr;
19802         _res_constr.datalen = _res->arr_len;
19803         if (_res_constr.datalen > 0)
19804                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19805         else
19806                 _res_constr.data = NULL;
19807         uint64_t* _res_vals = _res->elems;
19808         for (size_t q = 0; q < _res_constr.datalen; q++) {
19809                 uint64_t _res_conv_16 = _res_vals[q];
19810                 LDKUpdateFailHTLC _res_conv_16_conv;
19811                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
19812                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
19813                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19814                 _res_constr.data[q] = _res_conv_16_conv;
19815         }
19816         FREE(_res);
19817         CVec_UpdateFailHTLCZ_free(_res_constr);
19818 }
19819
19820 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
19821         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
19822         _res_constr.datalen = _res->arr_len;
19823         if (_res_constr.datalen > 0)
19824                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19825         else
19826                 _res_constr.data = NULL;
19827         uint64_t* _res_vals = _res->elems;
19828         for (size_t z = 0; z < _res_constr.datalen; z++) {
19829                 uint64_t _res_conv_25 = _res_vals[z];
19830                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
19831                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
19832                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
19833                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
19834                 _res_constr.data[z] = _res_conv_25_conv;
19835         }
19836         FREE(_res);
19837         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
19838 }
19839
19840 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
19841         LDKAcceptChannel o_conv;
19842         o_conv.inner = untag_ptr(o);
19843         o_conv.is_owned = ptr_is_owned(o);
19844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19845         o_conv = AcceptChannel_clone(&o_conv);
19846         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19847         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
19848         return tag_ptr(ret_conv, true);
19849 }
19850
19851 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
19852         void* e_ptr = untag_ptr(e);
19853         CHECK_ACCESS(e_ptr);
19854         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19855         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19856         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19857         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
19858         return tag_ptr(ret_conv, true);
19859 }
19860
19861 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
19862         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
19863         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
19864         return ret_conv;
19865 }
19866
19867 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
19868         if (!ptr_is_owned(_res)) return;
19869         void* _res_ptr = untag_ptr(_res);
19870         CHECK_ACCESS(_res_ptr);
19871         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
19872         FREE(untag_ptr(_res));
19873         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
19874 }
19875
19876 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
19877         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19878         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
19879         return tag_ptr(ret_conv, true);
19880 }
19881 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
19882         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
19883         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
19884         return ret_conv;
19885 }
19886
19887 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
19888         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
19889         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19890         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
19891         return tag_ptr(ret_conv, true);
19892 }
19893
19894 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
19895         LDKAnnouncementSignatures o_conv;
19896         o_conv.inner = untag_ptr(o);
19897         o_conv.is_owned = ptr_is_owned(o);
19898         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19899         o_conv = AnnouncementSignatures_clone(&o_conv);
19900         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19901         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
19902         return tag_ptr(ret_conv, true);
19903 }
19904
19905 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
19906         void* e_ptr = untag_ptr(e);
19907         CHECK_ACCESS(e_ptr);
19908         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19909         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19910         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19911         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
19912         return tag_ptr(ret_conv, true);
19913 }
19914
19915 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
19916         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
19917         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
19918         return ret_conv;
19919 }
19920
19921 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
19922         if (!ptr_is_owned(_res)) return;
19923         void* _res_ptr = untag_ptr(_res);
19924         CHECK_ACCESS(_res_ptr);
19925         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
19926         FREE(untag_ptr(_res));
19927         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
19928 }
19929
19930 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
19931         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19932         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
19933         return tag_ptr(ret_conv, true);
19934 }
19935 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
19936         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
19937         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
19938         return ret_conv;
19939 }
19940
19941 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
19942         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
19943         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19944         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
19945         return tag_ptr(ret_conv, true);
19946 }
19947
19948 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
19949         LDKChannelReestablish o_conv;
19950         o_conv.inner = untag_ptr(o);
19951         o_conv.is_owned = ptr_is_owned(o);
19952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19953         o_conv = ChannelReestablish_clone(&o_conv);
19954         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19955         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
19956         return tag_ptr(ret_conv, true);
19957 }
19958
19959 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
19960         void* e_ptr = untag_ptr(e);
19961         CHECK_ACCESS(e_ptr);
19962         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19963         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19964         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19965         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
19966         return tag_ptr(ret_conv, true);
19967 }
19968
19969 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
19970         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
19971         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
19972         return ret_conv;
19973 }
19974
19975 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
19976         if (!ptr_is_owned(_res)) return;
19977         void* _res_ptr = untag_ptr(_res);
19978         CHECK_ACCESS(_res_ptr);
19979         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
19980         FREE(untag_ptr(_res));
19981         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
19982 }
19983
19984 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
19985         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19986         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
19987         return tag_ptr(ret_conv, true);
19988 }
19989 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
19990         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
19991         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
19992         return ret_conv;
19993 }
19994
19995 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
19996         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
19997         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19998         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
19999         return tag_ptr(ret_conv, true);
20000 }
20001
20002 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
20003         LDKClosingSigned o_conv;
20004         o_conv.inner = untag_ptr(o);
20005         o_conv.is_owned = ptr_is_owned(o);
20006         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20007         o_conv = ClosingSigned_clone(&o_conv);
20008         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20009         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
20010         return tag_ptr(ret_conv, true);
20011 }
20012
20013 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
20014         void* e_ptr = untag_ptr(e);
20015         CHECK_ACCESS(e_ptr);
20016         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20017         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20018         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20019         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
20020         return tag_ptr(ret_conv, true);
20021 }
20022
20023 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
20024         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
20025         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
20026         return ret_conv;
20027 }
20028
20029 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
20030         if (!ptr_is_owned(_res)) return;
20031         void* _res_ptr = untag_ptr(_res);
20032         CHECK_ACCESS(_res_ptr);
20033         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
20034         FREE(untag_ptr(_res));
20035         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
20036 }
20037
20038 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
20039         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20040         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
20041         return tag_ptr(ret_conv, true);
20042 }
20043 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20044         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
20045         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
20046         return ret_conv;
20047 }
20048
20049 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
20050         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
20051         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20052         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
20053         return tag_ptr(ret_conv, true);
20054 }
20055
20056 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
20057         LDKClosingSignedFeeRange o_conv;
20058         o_conv.inner = untag_ptr(o);
20059         o_conv.is_owned = ptr_is_owned(o);
20060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20061         o_conv = ClosingSignedFeeRange_clone(&o_conv);
20062         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20063         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
20064         return tag_ptr(ret_conv, true);
20065 }
20066
20067 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
20068         void* e_ptr = untag_ptr(e);
20069         CHECK_ACCESS(e_ptr);
20070         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20071         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20072         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20073         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
20074         return tag_ptr(ret_conv, true);
20075 }
20076
20077 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
20078         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
20079         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
20080         return ret_conv;
20081 }
20082
20083 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
20084         if (!ptr_is_owned(_res)) return;
20085         void* _res_ptr = untag_ptr(_res);
20086         CHECK_ACCESS(_res_ptr);
20087         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
20088         FREE(untag_ptr(_res));
20089         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
20090 }
20091
20092 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
20093         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20094         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
20095         return tag_ptr(ret_conv, true);
20096 }
20097 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20098         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
20099         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
20100         return ret_conv;
20101 }
20102
20103 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
20104         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
20105         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20106         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
20107         return tag_ptr(ret_conv, true);
20108 }
20109
20110 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
20111         LDKCommitmentSigned o_conv;
20112         o_conv.inner = untag_ptr(o);
20113         o_conv.is_owned = ptr_is_owned(o);
20114         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20115         o_conv = CommitmentSigned_clone(&o_conv);
20116         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20117         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
20118         return tag_ptr(ret_conv, true);
20119 }
20120
20121 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
20122         void* e_ptr = untag_ptr(e);
20123         CHECK_ACCESS(e_ptr);
20124         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20125         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20126         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20127         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
20128         return tag_ptr(ret_conv, true);
20129 }
20130
20131 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
20132         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
20133         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
20134         return ret_conv;
20135 }
20136
20137 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
20138         if (!ptr_is_owned(_res)) return;
20139         void* _res_ptr = untag_ptr(_res);
20140         CHECK_ACCESS(_res_ptr);
20141         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
20142         FREE(untag_ptr(_res));
20143         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
20144 }
20145
20146 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
20147         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20148         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
20149         return tag_ptr(ret_conv, true);
20150 }
20151 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20152         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
20153         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
20154         return ret_conv;
20155 }
20156
20157 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
20158         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
20159         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20160         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
20161         return tag_ptr(ret_conv, true);
20162 }
20163
20164 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
20165         LDKFundingCreated o_conv;
20166         o_conv.inner = untag_ptr(o);
20167         o_conv.is_owned = ptr_is_owned(o);
20168         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20169         o_conv = FundingCreated_clone(&o_conv);
20170         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20171         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
20172         return tag_ptr(ret_conv, true);
20173 }
20174
20175 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
20176         void* e_ptr = untag_ptr(e);
20177         CHECK_ACCESS(e_ptr);
20178         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20179         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20180         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20181         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
20182         return tag_ptr(ret_conv, true);
20183 }
20184
20185 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
20186         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
20187         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
20188         return ret_conv;
20189 }
20190
20191 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
20192         if (!ptr_is_owned(_res)) return;
20193         void* _res_ptr = untag_ptr(_res);
20194         CHECK_ACCESS(_res_ptr);
20195         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
20196         FREE(untag_ptr(_res));
20197         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
20198 }
20199
20200 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
20201         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20202         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
20203         return tag_ptr(ret_conv, true);
20204 }
20205 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
20206         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
20207         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
20208         return ret_conv;
20209 }
20210
20211 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
20212         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
20213         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20214         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
20215         return tag_ptr(ret_conv, true);
20216 }
20217
20218 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
20219         LDKFundingSigned o_conv;
20220         o_conv.inner = untag_ptr(o);
20221         o_conv.is_owned = ptr_is_owned(o);
20222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20223         o_conv = FundingSigned_clone(&o_conv);
20224         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20225         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
20226         return tag_ptr(ret_conv, true);
20227 }
20228
20229 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
20230         void* e_ptr = untag_ptr(e);
20231         CHECK_ACCESS(e_ptr);
20232         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20233         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20234         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20235         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
20236         return tag_ptr(ret_conv, true);
20237 }
20238
20239 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
20240         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
20241         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
20242         return ret_conv;
20243 }
20244
20245 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
20246         if (!ptr_is_owned(_res)) return;
20247         void* _res_ptr = untag_ptr(_res);
20248         CHECK_ACCESS(_res_ptr);
20249         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
20250         FREE(untag_ptr(_res));
20251         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
20252 }
20253
20254 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
20255         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20256         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
20257         return tag_ptr(ret_conv, true);
20258 }
20259 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20260         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
20261         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
20262         return ret_conv;
20263 }
20264
20265 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
20266         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
20267         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20268         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
20269         return tag_ptr(ret_conv, true);
20270 }
20271
20272 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
20273         LDKChannelReady o_conv;
20274         o_conv.inner = untag_ptr(o);
20275         o_conv.is_owned = ptr_is_owned(o);
20276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20277         o_conv = ChannelReady_clone(&o_conv);
20278         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20279         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
20280         return tag_ptr(ret_conv, true);
20281 }
20282
20283 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
20284         void* e_ptr = untag_ptr(e);
20285         CHECK_ACCESS(e_ptr);
20286         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20287         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20288         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20289         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
20290         return tag_ptr(ret_conv, true);
20291 }
20292
20293 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
20294         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
20295         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
20296         return ret_conv;
20297 }
20298
20299 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
20300         if (!ptr_is_owned(_res)) return;
20301         void* _res_ptr = untag_ptr(_res);
20302         CHECK_ACCESS(_res_ptr);
20303         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
20304         FREE(untag_ptr(_res));
20305         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
20306 }
20307
20308 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
20309         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20310         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
20311         return tag_ptr(ret_conv, true);
20312 }
20313 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
20314         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
20315         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
20316         return ret_conv;
20317 }
20318
20319 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
20320         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
20321         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20322         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
20323         return tag_ptr(ret_conv, true);
20324 }
20325
20326 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
20327         LDKInit o_conv;
20328         o_conv.inner = untag_ptr(o);
20329         o_conv.is_owned = ptr_is_owned(o);
20330         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20331         o_conv = Init_clone(&o_conv);
20332         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20333         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
20334         return tag_ptr(ret_conv, true);
20335 }
20336
20337 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
20338         void* e_ptr = untag_ptr(e);
20339         CHECK_ACCESS(e_ptr);
20340         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20341         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20342         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20343         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
20344         return tag_ptr(ret_conv, true);
20345 }
20346
20347 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
20348         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
20349         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
20350         return ret_conv;
20351 }
20352
20353 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
20354         if (!ptr_is_owned(_res)) return;
20355         void* _res_ptr = untag_ptr(_res);
20356         CHECK_ACCESS(_res_ptr);
20357         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
20358         FREE(untag_ptr(_res));
20359         CResult_InitDecodeErrorZ_free(_res_conv);
20360 }
20361
20362 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
20363         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20364         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
20365         return tag_ptr(ret_conv, true);
20366 }
20367 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
20368         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
20369         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
20370         return ret_conv;
20371 }
20372
20373 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
20374         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
20375         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20376         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
20377         return tag_ptr(ret_conv, true);
20378 }
20379
20380 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
20381         LDKOpenChannel o_conv;
20382         o_conv.inner = untag_ptr(o);
20383         o_conv.is_owned = ptr_is_owned(o);
20384         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20385         o_conv = OpenChannel_clone(&o_conv);
20386         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20387         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
20388         return tag_ptr(ret_conv, true);
20389 }
20390
20391 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
20392         void* e_ptr = untag_ptr(e);
20393         CHECK_ACCESS(e_ptr);
20394         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20395         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20396         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20397         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
20398         return tag_ptr(ret_conv, true);
20399 }
20400
20401 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
20402         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
20403         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
20404         return ret_conv;
20405 }
20406
20407 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
20408         if (!ptr_is_owned(_res)) return;
20409         void* _res_ptr = untag_ptr(_res);
20410         CHECK_ACCESS(_res_ptr);
20411         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
20412         FREE(untag_ptr(_res));
20413         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
20414 }
20415
20416 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
20417         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20418         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
20419         return tag_ptr(ret_conv, true);
20420 }
20421 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20422         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
20423         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
20424         return ret_conv;
20425 }
20426
20427 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
20428         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
20429         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20430         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
20431         return tag_ptr(ret_conv, true);
20432 }
20433
20434 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
20435         LDKRevokeAndACK o_conv;
20436         o_conv.inner = untag_ptr(o);
20437         o_conv.is_owned = ptr_is_owned(o);
20438         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20439         o_conv = RevokeAndACK_clone(&o_conv);
20440         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20441         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
20442         return tag_ptr(ret_conv, true);
20443 }
20444
20445 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
20446         void* e_ptr = untag_ptr(e);
20447         CHECK_ACCESS(e_ptr);
20448         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20449         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20450         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20451         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
20452         return tag_ptr(ret_conv, true);
20453 }
20454
20455 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
20456         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
20457         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
20458         return ret_conv;
20459 }
20460
20461 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
20462         if (!ptr_is_owned(_res)) return;
20463         void* _res_ptr = untag_ptr(_res);
20464         CHECK_ACCESS(_res_ptr);
20465         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
20466         FREE(untag_ptr(_res));
20467         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
20468 }
20469
20470 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
20471         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20472         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
20473         return tag_ptr(ret_conv, true);
20474 }
20475 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
20476         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
20477         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
20478         return ret_conv;
20479 }
20480
20481 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
20482         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
20483         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20484         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
20485         return tag_ptr(ret_conv, true);
20486 }
20487
20488 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
20489         LDKShutdown o_conv;
20490         o_conv.inner = untag_ptr(o);
20491         o_conv.is_owned = ptr_is_owned(o);
20492         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20493         o_conv = Shutdown_clone(&o_conv);
20494         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20495         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
20496         return tag_ptr(ret_conv, true);
20497 }
20498
20499 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
20500         void* e_ptr = untag_ptr(e);
20501         CHECK_ACCESS(e_ptr);
20502         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20503         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20504         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20505         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
20506         return tag_ptr(ret_conv, true);
20507 }
20508
20509 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
20510         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
20511         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
20512         return ret_conv;
20513 }
20514
20515 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
20516         if (!ptr_is_owned(_res)) return;
20517         void* _res_ptr = untag_ptr(_res);
20518         CHECK_ACCESS(_res_ptr);
20519         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
20520         FREE(untag_ptr(_res));
20521         CResult_ShutdownDecodeErrorZ_free(_res_conv);
20522 }
20523
20524 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
20525         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20526         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
20527         return tag_ptr(ret_conv, true);
20528 }
20529 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
20530         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
20531         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
20532         return ret_conv;
20533 }
20534
20535 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
20536         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
20537         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20538         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
20539         return tag_ptr(ret_conv, true);
20540 }
20541
20542 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
20543         LDKUpdateFailHTLC o_conv;
20544         o_conv.inner = untag_ptr(o);
20545         o_conv.is_owned = ptr_is_owned(o);
20546         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20547         o_conv = UpdateFailHTLC_clone(&o_conv);
20548         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20549         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
20550         return tag_ptr(ret_conv, true);
20551 }
20552
20553 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
20554         void* e_ptr = untag_ptr(e);
20555         CHECK_ACCESS(e_ptr);
20556         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20557         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20558         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20559         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
20560         return tag_ptr(ret_conv, true);
20561 }
20562
20563 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
20564         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
20565         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
20566         return ret_conv;
20567 }
20568
20569 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
20570         if (!ptr_is_owned(_res)) return;
20571         void* _res_ptr = untag_ptr(_res);
20572         CHECK_ACCESS(_res_ptr);
20573         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
20574         FREE(untag_ptr(_res));
20575         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
20576 }
20577
20578 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
20579         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20580         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
20581         return tag_ptr(ret_conv, true);
20582 }
20583 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20584         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
20585         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
20586         return ret_conv;
20587 }
20588
20589 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
20590         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
20591         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20592         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
20593         return tag_ptr(ret_conv, true);
20594 }
20595
20596 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
20597         LDKUpdateFailMalformedHTLC o_conv;
20598         o_conv.inner = untag_ptr(o);
20599         o_conv.is_owned = ptr_is_owned(o);
20600         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20601         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
20602         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20603         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
20604         return tag_ptr(ret_conv, true);
20605 }
20606
20607 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
20608         void* e_ptr = untag_ptr(e);
20609         CHECK_ACCESS(e_ptr);
20610         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20611         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20612         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20613         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
20614         return tag_ptr(ret_conv, true);
20615 }
20616
20617 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
20618         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
20619         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
20620         return ret_conv;
20621 }
20622
20623 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
20624         if (!ptr_is_owned(_res)) return;
20625         void* _res_ptr = untag_ptr(_res);
20626         CHECK_ACCESS(_res_ptr);
20627         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
20628         FREE(untag_ptr(_res));
20629         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
20630 }
20631
20632 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
20633         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20634         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
20635         return tag_ptr(ret_conv, true);
20636 }
20637 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20638         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
20639         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
20640         return ret_conv;
20641 }
20642
20643 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
20644         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
20645         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20646         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
20647         return tag_ptr(ret_conv, true);
20648 }
20649
20650 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
20651         LDKUpdateFee o_conv;
20652         o_conv.inner = untag_ptr(o);
20653         o_conv.is_owned = ptr_is_owned(o);
20654         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20655         o_conv = UpdateFee_clone(&o_conv);
20656         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20657         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
20658         return tag_ptr(ret_conv, true);
20659 }
20660
20661 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
20662         void* e_ptr = untag_ptr(e);
20663         CHECK_ACCESS(e_ptr);
20664         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20665         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20666         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20667         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
20668         return tag_ptr(ret_conv, true);
20669 }
20670
20671 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
20672         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
20673         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
20674         return ret_conv;
20675 }
20676
20677 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
20678         if (!ptr_is_owned(_res)) return;
20679         void* _res_ptr = untag_ptr(_res);
20680         CHECK_ACCESS(_res_ptr);
20681         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
20682         FREE(untag_ptr(_res));
20683         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
20684 }
20685
20686 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
20687         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20688         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
20689         return tag_ptr(ret_conv, true);
20690 }
20691 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
20692         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
20693         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
20694         return ret_conv;
20695 }
20696
20697 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
20698         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
20699         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20700         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
20701         return tag_ptr(ret_conv, true);
20702 }
20703
20704 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
20705         LDKUpdateFulfillHTLC o_conv;
20706         o_conv.inner = untag_ptr(o);
20707         o_conv.is_owned = ptr_is_owned(o);
20708         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20709         o_conv = UpdateFulfillHTLC_clone(&o_conv);
20710         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20711         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
20712         return tag_ptr(ret_conv, true);
20713 }
20714
20715 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
20716         void* e_ptr = untag_ptr(e);
20717         CHECK_ACCESS(e_ptr);
20718         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20719         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20720         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20721         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
20722         return tag_ptr(ret_conv, true);
20723 }
20724
20725 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
20726         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
20727         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
20728         return ret_conv;
20729 }
20730
20731 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
20732         if (!ptr_is_owned(_res)) return;
20733         void* _res_ptr = untag_ptr(_res);
20734         CHECK_ACCESS(_res_ptr);
20735         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
20736         FREE(untag_ptr(_res));
20737         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
20738 }
20739
20740 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
20741         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20742         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
20743         return tag_ptr(ret_conv, true);
20744 }
20745 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20746         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
20747         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
20748         return ret_conv;
20749 }
20750
20751 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
20752         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
20753         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20754         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
20755         return tag_ptr(ret_conv, true);
20756 }
20757
20758 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
20759         LDKUpdateAddHTLC o_conv;
20760         o_conv.inner = untag_ptr(o);
20761         o_conv.is_owned = ptr_is_owned(o);
20762         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20763         o_conv = UpdateAddHTLC_clone(&o_conv);
20764         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20765         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
20766         return tag_ptr(ret_conv, true);
20767 }
20768
20769 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
20770         void* e_ptr = untag_ptr(e);
20771         CHECK_ACCESS(e_ptr);
20772         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20773         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20774         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20775         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
20776         return tag_ptr(ret_conv, true);
20777 }
20778
20779 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
20780         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
20781         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
20782         return ret_conv;
20783 }
20784
20785 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
20786         if (!ptr_is_owned(_res)) return;
20787         void* _res_ptr = untag_ptr(_res);
20788         CHECK_ACCESS(_res_ptr);
20789         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
20790         FREE(untag_ptr(_res));
20791         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
20792 }
20793
20794 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
20795         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20796         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
20797         return tag_ptr(ret_conv, true);
20798 }
20799 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20800         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
20801         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
20802         return ret_conv;
20803 }
20804
20805 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
20806         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
20807         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20808         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
20809         return tag_ptr(ret_conv, true);
20810 }
20811
20812 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
20813         LDKOnionMessage o_conv;
20814         o_conv.inner = untag_ptr(o);
20815         o_conv.is_owned = ptr_is_owned(o);
20816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20817         o_conv = OnionMessage_clone(&o_conv);
20818         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20819         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
20820         return tag_ptr(ret_conv, true);
20821 }
20822
20823 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
20824         void* e_ptr = untag_ptr(e);
20825         CHECK_ACCESS(e_ptr);
20826         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20827         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20828         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20829         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
20830         return tag_ptr(ret_conv, true);
20831 }
20832
20833 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
20834         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
20835         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
20836         return ret_conv;
20837 }
20838
20839 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
20840         if (!ptr_is_owned(_res)) return;
20841         void* _res_ptr = untag_ptr(_res);
20842         CHECK_ACCESS(_res_ptr);
20843         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
20844         FREE(untag_ptr(_res));
20845         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
20846 }
20847
20848 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
20849         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20850         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
20851         return tag_ptr(ret_conv, true);
20852 }
20853 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20854         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
20855         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
20856         return ret_conv;
20857 }
20858
20859 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
20860         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
20861         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20862         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
20863         return tag_ptr(ret_conv, true);
20864 }
20865
20866 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
20867         LDKPing o_conv;
20868         o_conv.inner = untag_ptr(o);
20869         o_conv.is_owned = ptr_is_owned(o);
20870         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20871         o_conv = Ping_clone(&o_conv);
20872         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20873         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
20874         return tag_ptr(ret_conv, true);
20875 }
20876
20877 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
20878         void* e_ptr = untag_ptr(e);
20879         CHECK_ACCESS(e_ptr);
20880         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20881         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20882         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20883         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
20884         return tag_ptr(ret_conv, true);
20885 }
20886
20887 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
20888         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
20889         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
20890         return ret_conv;
20891 }
20892
20893 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
20894         if (!ptr_is_owned(_res)) return;
20895         void* _res_ptr = untag_ptr(_res);
20896         CHECK_ACCESS(_res_ptr);
20897         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
20898         FREE(untag_ptr(_res));
20899         CResult_PingDecodeErrorZ_free(_res_conv);
20900 }
20901
20902 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
20903         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20904         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
20905         return tag_ptr(ret_conv, true);
20906 }
20907 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
20908         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
20909         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
20910         return ret_conv;
20911 }
20912
20913 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
20914         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
20915         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20916         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
20917         return tag_ptr(ret_conv, true);
20918 }
20919
20920 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
20921         LDKPong o_conv;
20922         o_conv.inner = untag_ptr(o);
20923         o_conv.is_owned = ptr_is_owned(o);
20924         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20925         o_conv = Pong_clone(&o_conv);
20926         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20927         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
20928         return tag_ptr(ret_conv, true);
20929 }
20930
20931 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
20932         void* e_ptr = untag_ptr(e);
20933         CHECK_ACCESS(e_ptr);
20934         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20935         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20936         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20937         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
20938         return tag_ptr(ret_conv, true);
20939 }
20940
20941 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
20942         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
20943         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
20944         return ret_conv;
20945 }
20946
20947 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
20948         if (!ptr_is_owned(_res)) return;
20949         void* _res_ptr = untag_ptr(_res);
20950         CHECK_ACCESS(_res_ptr);
20951         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
20952         FREE(untag_ptr(_res));
20953         CResult_PongDecodeErrorZ_free(_res_conv);
20954 }
20955
20956 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
20957         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20958         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
20959         return tag_ptr(ret_conv, true);
20960 }
20961 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
20962         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
20963         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
20964         return ret_conv;
20965 }
20966
20967 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
20968         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
20969         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20970         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
20971         return tag_ptr(ret_conv, true);
20972 }
20973
20974 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20975         LDKUnsignedChannelAnnouncement o_conv;
20976         o_conv.inner = untag_ptr(o);
20977         o_conv.is_owned = ptr_is_owned(o);
20978         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20979         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
20980         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20981         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
20982         return tag_ptr(ret_conv, true);
20983 }
20984
20985 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20986         void* e_ptr = untag_ptr(e);
20987         CHECK_ACCESS(e_ptr);
20988         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20989         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20990         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20991         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
20992         return tag_ptr(ret_conv, true);
20993 }
20994
20995 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20996         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20997         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20998         return ret_conv;
20999 }
21000
21001 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21002         if (!ptr_is_owned(_res)) return;
21003         void* _res_ptr = untag_ptr(_res);
21004         CHECK_ACCESS(_res_ptr);
21005         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21006         FREE(untag_ptr(_res));
21007         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
21008 }
21009
21010 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21011         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21012         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
21013         return tag_ptr(ret_conv, true);
21014 }
21015 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21016         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21017         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21018         return ret_conv;
21019 }
21020
21021 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21022         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21023         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21024         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21025         return tag_ptr(ret_conv, true);
21026 }
21027
21028 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21029         LDKChannelAnnouncement o_conv;
21030         o_conv.inner = untag_ptr(o);
21031         o_conv.is_owned = ptr_is_owned(o);
21032         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21033         o_conv = ChannelAnnouncement_clone(&o_conv);
21034         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21035         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
21036         return tag_ptr(ret_conv, true);
21037 }
21038
21039 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21040         void* e_ptr = untag_ptr(e);
21041         CHECK_ACCESS(e_ptr);
21042         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21043         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21044         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21045         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
21046         return tag_ptr(ret_conv, true);
21047 }
21048
21049 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21050         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21051         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21052         return ret_conv;
21053 }
21054
21055 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21056         if (!ptr_is_owned(_res)) return;
21057         void* _res_ptr = untag_ptr(_res);
21058         CHECK_ACCESS(_res_ptr);
21059         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21060         FREE(untag_ptr(_res));
21061         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
21062 }
21063
21064 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21065         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21066         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
21067         return tag_ptr(ret_conv, true);
21068 }
21069 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21070         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21071         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21072         return ret_conv;
21073 }
21074
21075 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21076         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21077         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21078         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21079         return tag_ptr(ret_conv, true);
21080 }
21081
21082 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21083         LDKUnsignedChannelUpdate o_conv;
21084         o_conv.inner = untag_ptr(o);
21085         o_conv.is_owned = ptr_is_owned(o);
21086         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21087         o_conv = UnsignedChannelUpdate_clone(&o_conv);
21088         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21089         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
21090         return tag_ptr(ret_conv, true);
21091 }
21092
21093 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
21094         void* e_ptr = untag_ptr(e);
21095         CHECK_ACCESS(e_ptr);
21096         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21097         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21098         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21099         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
21100         return tag_ptr(ret_conv, true);
21101 }
21102
21103 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21104         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
21105         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
21106         return ret_conv;
21107 }
21108
21109 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21110         if (!ptr_is_owned(_res)) return;
21111         void* _res_ptr = untag_ptr(_res);
21112         CHECK_ACCESS(_res_ptr);
21113         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
21114         FREE(untag_ptr(_res));
21115         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
21116 }
21117
21118 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21119         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21120         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
21121         return tag_ptr(ret_conv, true);
21122 }
21123 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21124         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21125         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21126         return ret_conv;
21127 }
21128
21129 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21130         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21131         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21132         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
21133         return tag_ptr(ret_conv, true);
21134 }
21135
21136 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21137         LDKChannelUpdate o_conv;
21138         o_conv.inner = untag_ptr(o);
21139         o_conv.is_owned = ptr_is_owned(o);
21140         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21141         o_conv = ChannelUpdate_clone(&o_conv);
21142         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21143         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
21144         return tag_ptr(ret_conv, true);
21145 }
21146
21147 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
21148         void* e_ptr = untag_ptr(e);
21149         CHECK_ACCESS(e_ptr);
21150         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21151         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21152         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21153         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
21154         return tag_ptr(ret_conv, true);
21155 }
21156
21157 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21158         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
21159         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
21160         return ret_conv;
21161 }
21162
21163 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21164         if (!ptr_is_owned(_res)) return;
21165         void* _res_ptr = untag_ptr(_res);
21166         CHECK_ACCESS(_res_ptr);
21167         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
21168         FREE(untag_ptr(_res));
21169         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
21170 }
21171
21172 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21173         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21174         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
21175         return tag_ptr(ret_conv, true);
21176 }
21177 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21178         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21179         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21180         return ret_conv;
21181 }
21182
21183 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21184         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21185         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21186         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
21187         return tag_ptr(ret_conv, true);
21188 }
21189
21190 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
21191         LDKErrorMessage o_conv;
21192         o_conv.inner = untag_ptr(o);
21193         o_conv.is_owned = ptr_is_owned(o);
21194         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21195         o_conv = ErrorMessage_clone(&o_conv);
21196         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21197         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
21198         return tag_ptr(ret_conv, true);
21199 }
21200
21201 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
21202         void* e_ptr = untag_ptr(e);
21203         CHECK_ACCESS(e_ptr);
21204         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21205         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21206         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21207         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
21208         return tag_ptr(ret_conv, true);
21209 }
21210
21211 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
21212         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
21213         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
21214         return ret_conv;
21215 }
21216
21217 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
21218         if (!ptr_is_owned(_res)) return;
21219         void* _res_ptr = untag_ptr(_res);
21220         CHECK_ACCESS(_res_ptr);
21221         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
21222         FREE(untag_ptr(_res));
21223         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
21224 }
21225
21226 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
21227         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21228         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
21229         return tag_ptr(ret_conv, true);
21230 }
21231 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21232         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
21233         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
21234         return ret_conv;
21235 }
21236
21237 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
21238         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
21239         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21240         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
21241         return tag_ptr(ret_conv, true);
21242 }
21243
21244 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
21245         LDKWarningMessage o_conv;
21246         o_conv.inner = untag_ptr(o);
21247         o_conv.is_owned = ptr_is_owned(o);
21248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21249         o_conv = WarningMessage_clone(&o_conv);
21250         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21251         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
21252         return tag_ptr(ret_conv, true);
21253 }
21254
21255 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
21256         void* e_ptr = untag_ptr(e);
21257         CHECK_ACCESS(e_ptr);
21258         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21259         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21260         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21261         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
21262         return tag_ptr(ret_conv, true);
21263 }
21264
21265 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
21266         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
21267         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
21268         return ret_conv;
21269 }
21270
21271 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
21272         if (!ptr_is_owned(_res)) return;
21273         void* _res_ptr = untag_ptr(_res);
21274         CHECK_ACCESS(_res_ptr);
21275         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
21276         FREE(untag_ptr(_res));
21277         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
21278 }
21279
21280 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
21281         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21282         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
21283         return tag_ptr(ret_conv, true);
21284 }
21285 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21286         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
21287         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
21288         return ret_conv;
21289 }
21290
21291 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
21292         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
21293         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21294         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
21295         return tag_ptr(ret_conv, true);
21296 }
21297
21298 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21299         LDKUnsignedNodeAnnouncement o_conv;
21300         o_conv.inner = untag_ptr(o);
21301         o_conv.is_owned = ptr_is_owned(o);
21302         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21303         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
21304         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21305         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
21306         return tag_ptr(ret_conv, true);
21307 }
21308
21309 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21310         void* e_ptr = untag_ptr(e);
21311         CHECK_ACCESS(e_ptr);
21312         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21313         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21314         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21315         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
21316         return tag_ptr(ret_conv, true);
21317 }
21318
21319 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21320         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21321         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21322         return ret_conv;
21323 }
21324
21325 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21326         if (!ptr_is_owned(_res)) return;
21327         void* _res_ptr = untag_ptr(_res);
21328         CHECK_ACCESS(_res_ptr);
21329         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
21330         FREE(untag_ptr(_res));
21331         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
21332 }
21333
21334 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21335         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21336         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
21337         return tag_ptr(ret_conv, true);
21338 }
21339 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21340         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21341         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21342         return ret_conv;
21343 }
21344
21345 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21346         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21347         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21348         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
21349         return tag_ptr(ret_conv, true);
21350 }
21351
21352 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21353         LDKNodeAnnouncement o_conv;
21354         o_conv.inner = untag_ptr(o);
21355         o_conv.is_owned = ptr_is_owned(o);
21356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21357         o_conv = NodeAnnouncement_clone(&o_conv);
21358         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21359         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
21360         return tag_ptr(ret_conv, true);
21361 }
21362
21363 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21364         void* e_ptr = untag_ptr(e);
21365         CHECK_ACCESS(e_ptr);
21366         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21367         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21368         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21369         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
21370         return tag_ptr(ret_conv, true);
21371 }
21372
21373 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21374         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21375         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21376         return ret_conv;
21377 }
21378
21379 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21380         if (!ptr_is_owned(_res)) return;
21381         void* _res_ptr = untag_ptr(_res);
21382         CHECK_ACCESS(_res_ptr);
21383         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
21384         FREE(untag_ptr(_res));
21385         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
21386 }
21387
21388 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21389         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21390         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
21391         return tag_ptr(ret_conv, true);
21392 }
21393 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21394         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21395         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21396         return ret_conv;
21397 }
21398
21399 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21400         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21401         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21402         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
21403         return tag_ptr(ret_conv, true);
21404 }
21405
21406 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
21407         LDKQueryShortChannelIds o_conv;
21408         o_conv.inner = untag_ptr(o);
21409         o_conv.is_owned = ptr_is_owned(o);
21410         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21411         o_conv = QueryShortChannelIds_clone(&o_conv);
21412         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21413         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
21414         return tag_ptr(ret_conv, true);
21415 }
21416
21417 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
21418         void* e_ptr = untag_ptr(e);
21419         CHECK_ACCESS(e_ptr);
21420         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21421         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21422         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21423         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
21424         return tag_ptr(ret_conv, true);
21425 }
21426
21427 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
21428         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
21429         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
21430         return ret_conv;
21431 }
21432
21433 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
21434         if (!ptr_is_owned(_res)) return;
21435         void* _res_ptr = untag_ptr(_res);
21436         CHECK_ACCESS(_res_ptr);
21437         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
21438         FREE(untag_ptr(_res));
21439         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
21440 }
21441
21442 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
21443         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21444         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
21445         return tag_ptr(ret_conv, true);
21446 }
21447 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
21448         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
21449         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
21450         return ret_conv;
21451 }
21452
21453 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
21454         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
21455         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21456         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
21457         return tag_ptr(ret_conv, true);
21458 }
21459
21460 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
21461         LDKReplyShortChannelIdsEnd o_conv;
21462         o_conv.inner = untag_ptr(o);
21463         o_conv.is_owned = ptr_is_owned(o);
21464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21465         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
21466         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21467         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
21468         return tag_ptr(ret_conv, true);
21469 }
21470
21471 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
21472         void* e_ptr = untag_ptr(e);
21473         CHECK_ACCESS(e_ptr);
21474         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21475         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21476         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21477         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
21478         return tag_ptr(ret_conv, true);
21479 }
21480
21481 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
21482         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
21483         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
21484         return ret_conv;
21485 }
21486
21487 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
21488         if (!ptr_is_owned(_res)) return;
21489         void* _res_ptr = untag_ptr(_res);
21490         CHECK_ACCESS(_res_ptr);
21491         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
21492         FREE(untag_ptr(_res));
21493         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
21494 }
21495
21496 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
21497         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21498         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
21499         return tag_ptr(ret_conv, true);
21500 }
21501 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
21502         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
21503         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
21504         return ret_conv;
21505 }
21506
21507 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
21508         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
21509         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21510         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
21511         return tag_ptr(ret_conv, true);
21512 }
21513
21514 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
21515         LDKQueryChannelRange o_conv;
21516         o_conv.inner = untag_ptr(o);
21517         o_conv.is_owned = ptr_is_owned(o);
21518         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21519         o_conv = QueryChannelRange_clone(&o_conv);
21520         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21521         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
21522         return tag_ptr(ret_conv, true);
21523 }
21524
21525 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
21526         void* e_ptr = untag_ptr(e);
21527         CHECK_ACCESS(e_ptr);
21528         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21529         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21530         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21531         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
21532         return tag_ptr(ret_conv, true);
21533 }
21534
21535 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21536         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
21537         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
21538         return ret_conv;
21539 }
21540
21541 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
21542         if (!ptr_is_owned(_res)) return;
21543         void* _res_ptr = untag_ptr(_res);
21544         CHECK_ACCESS(_res_ptr);
21545         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
21546         FREE(untag_ptr(_res));
21547         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
21548 }
21549
21550 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21551         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21552         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
21553         return tag_ptr(ret_conv, true);
21554 }
21555 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21556         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
21557         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21558         return ret_conv;
21559 }
21560
21561 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21562         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
21563         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21564         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
21565         return tag_ptr(ret_conv, true);
21566 }
21567
21568 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
21569         LDKReplyChannelRange o_conv;
21570         o_conv.inner = untag_ptr(o);
21571         o_conv.is_owned = ptr_is_owned(o);
21572         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21573         o_conv = ReplyChannelRange_clone(&o_conv);
21574         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21575         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
21576         return tag_ptr(ret_conv, true);
21577 }
21578
21579 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
21580         void* e_ptr = untag_ptr(e);
21581         CHECK_ACCESS(e_ptr);
21582         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21583         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21584         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21585         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
21586         return tag_ptr(ret_conv, true);
21587 }
21588
21589 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21590         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
21591         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
21592         return ret_conv;
21593 }
21594
21595 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
21596         if (!ptr_is_owned(_res)) return;
21597         void* _res_ptr = untag_ptr(_res);
21598         CHECK_ACCESS(_res_ptr);
21599         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
21600         FREE(untag_ptr(_res));
21601         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
21602 }
21603
21604 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21605         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21606         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
21607         return tag_ptr(ret_conv, true);
21608 }
21609 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21610         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
21611         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21612         return ret_conv;
21613 }
21614
21615 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21616         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
21617         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21618         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
21619         return tag_ptr(ret_conv, true);
21620 }
21621
21622 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
21623         LDKGossipTimestampFilter o_conv;
21624         o_conv.inner = untag_ptr(o);
21625         o_conv.is_owned = ptr_is_owned(o);
21626         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21627         o_conv = GossipTimestampFilter_clone(&o_conv);
21628         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21629         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
21630         return tag_ptr(ret_conv, true);
21631 }
21632
21633 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
21634         void* e_ptr = untag_ptr(e);
21635         CHECK_ACCESS(e_ptr);
21636         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21637         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21638         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21639         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
21640         return tag_ptr(ret_conv, true);
21641 }
21642
21643 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
21644         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
21645         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
21646         return ret_conv;
21647 }
21648
21649 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
21650         if (!ptr_is_owned(_res)) return;
21651         void* _res_ptr = untag_ptr(_res);
21652         CHECK_ACCESS(_res_ptr);
21653         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
21654         FREE(untag_ptr(_res));
21655         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
21656 }
21657
21658 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
21659         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21660         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
21661         return tag_ptr(ret_conv, true);
21662 }
21663 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
21664         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
21665         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
21666         return ret_conv;
21667 }
21668
21669 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
21670         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
21671         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21672         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
21673         return tag_ptr(ret_conv, true);
21674 }
21675
21676 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
21677         LDKCVec_PhantomRouteHintsZ _res_constr;
21678         _res_constr.datalen = _res->arr_len;
21679         if (_res_constr.datalen > 0)
21680                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
21681         else
21682                 _res_constr.data = NULL;
21683         uint64_t* _res_vals = _res->elems;
21684         for (size_t t = 0; t < _res_constr.datalen; t++) {
21685                 uint64_t _res_conv_19 = _res_vals[t];
21686                 LDKPhantomRouteHints _res_conv_19_conv;
21687                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
21688                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
21689                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
21690                 _res_constr.data[t] = _res_conv_19_conv;
21691         }
21692         FREE(_res);
21693         CVec_PhantomRouteHintsZ_free(_res_constr);
21694 }
21695
21696 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
21697         LDKInvoice o_conv;
21698         o_conv.inner = untag_ptr(o);
21699         o_conv.is_owned = ptr_is_owned(o);
21700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21701         o_conv = Invoice_clone(&o_conv);
21702         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21703         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
21704         return tag_ptr(ret_conv, true);
21705 }
21706
21707 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
21708         void* e_ptr = untag_ptr(e);
21709         CHECK_ACCESS(e_ptr);
21710         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
21711         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
21712         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21713         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
21714         return tag_ptr(ret_conv, true);
21715 }
21716
21717 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
21718         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
21719         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
21720         return ret_conv;
21721 }
21722
21723 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
21724         if (!ptr_is_owned(_res)) return;
21725         void* _res_ptr = untag_ptr(_res);
21726         CHECK_ACCESS(_res_ptr);
21727         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
21728         FREE(untag_ptr(_res));
21729         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
21730 }
21731
21732 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
21733         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21734         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
21735         return tag_ptr(ret_conv, true);
21736 }
21737 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
21738         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
21739         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
21740         return ret_conv;
21741 }
21742
21743 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
21744         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
21745         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21746         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
21747         return tag_ptr(ret_conv, true);
21748 }
21749
21750 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
21751         void* o_ptr = untag_ptr(o);
21752         CHECK_ACCESS(o_ptr);
21753         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
21754         if (o_conv.free == LDKFilter_JCalls_free) {
21755                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21756                 LDKFilter_JCalls_cloned(&o_conv);
21757         }
21758         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21759         *ret_copy = COption_FilterZ_some(o_conv);
21760         uint64_t ret_ref = tag_ptr(ret_copy, true);
21761         return ret_ref;
21762 }
21763
21764 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
21765         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21766         *ret_copy = COption_FilterZ_none();
21767         uint64_t ret_ref = tag_ptr(ret_copy, true);
21768         return ret_ref;
21769 }
21770
21771 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
21772         if (!ptr_is_owned(_res)) return;
21773         void* _res_ptr = untag_ptr(_res);
21774         CHECK_ACCESS(_res_ptr);
21775         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
21776         FREE(untag_ptr(_res));
21777         COption_FilterZ_free(_res_conv);
21778 }
21779
21780 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
21781         LDKLockedChannelMonitor o_conv;
21782         o_conv.inner = untag_ptr(o);
21783         o_conv.is_owned = ptr_is_owned(o);
21784         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21785         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
21786         
21787         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21788         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
21789         return tag_ptr(ret_conv, true);
21790 }
21791
21792 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
21793         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21794         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
21795         return tag_ptr(ret_conv, true);
21796 }
21797
21798 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
21799         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
21800         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
21801         return ret_conv;
21802 }
21803
21804 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
21805         if (!ptr_is_owned(_res)) return;
21806         void* _res_ptr = untag_ptr(_res);
21807         CHECK_ACCESS(_res_ptr);
21808         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
21809         FREE(untag_ptr(_res));
21810         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
21811 }
21812
21813 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
21814         LDKCVec_OutPointZ _res_constr;
21815         _res_constr.datalen = _res->arr_len;
21816         if (_res_constr.datalen > 0)
21817                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
21818         else
21819                 _res_constr.data = NULL;
21820         uint64_t* _res_vals = _res->elems;
21821         for (size_t k = 0; k < _res_constr.datalen; k++) {
21822                 uint64_t _res_conv_10 = _res_vals[k];
21823                 LDKOutPoint _res_conv_10_conv;
21824                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21825                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21826                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21827                 _res_constr.data[k] = _res_conv_10_conv;
21828         }
21829         FREE(_res);
21830         CVec_OutPointZ_free(_res_constr);
21831 }
21832
21833 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
21834         LDKCVec_MonitorUpdateIdZ _res_constr;
21835         _res_constr.datalen = _res->arr_len;
21836         if (_res_constr.datalen > 0)
21837                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21838         else
21839                 _res_constr.data = NULL;
21840         uint64_t* _res_vals = _res->elems;
21841         for (size_t r = 0; r < _res_constr.datalen; r++) {
21842                 uint64_t _res_conv_17 = _res_vals[r];
21843                 LDKMonitorUpdateId _res_conv_17_conv;
21844                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
21845                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
21846                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
21847                 _res_constr.data[r] = _res_conv_17_conv;
21848         }
21849         FREE(_res);
21850         CVec_MonitorUpdateIdZ_free(_res_constr);
21851 }
21852
21853 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
21854         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21855         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
21856         return tag_ptr(ret_conv, true);
21857 }
21858 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
21859         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
21860         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
21861         return ret_conv;
21862 }
21863
21864 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
21865         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
21866         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21867         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
21868         return tag_ptr(ret_conv, true);
21869 }
21870
21871 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
21872         LDKOutPoint a_conv;
21873         a_conv.inner = untag_ptr(a);
21874         a_conv.is_owned = ptr_is_owned(a);
21875         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21876         a_conv = OutPoint_clone(&a_conv);
21877         LDKCVec_MonitorUpdateIdZ b_constr;
21878         b_constr.datalen = b->arr_len;
21879         if (b_constr.datalen > 0)
21880                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21881         else
21882                 b_constr.data = NULL;
21883         uint64_t* b_vals = b->elems;
21884         for (size_t r = 0; r < b_constr.datalen; r++) {
21885                 uint64_t b_conv_17 = b_vals[r];
21886                 LDKMonitorUpdateId b_conv_17_conv;
21887                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
21888                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
21889                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
21890                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
21891                 b_constr.data[r] = b_conv_17_conv;
21892         }
21893         FREE(b);
21894         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21895         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
21896         return tag_ptr(ret_conv, true);
21897 }
21898
21899 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
21900         if (!ptr_is_owned(_res)) return;
21901         void* _res_ptr = untag_ptr(_res);
21902         CHECK_ACCESS(_res_ptr);
21903         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
21904         FREE(untag_ptr(_res));
21905         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
21906 }
21907
21908 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
21909         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
21910         _res_constr.datalen = _res->arr_len;
21911         if (_res_constr.datalen > 0)
21912                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
21913         else
21914                 _res_constr.data = NULL;
21915         uint64_t* _res_vals = _res->elems;
21916         for (size_t p = 0; p < _res_constr.datalen; p++) {
21917                 uint64_t _res_conv_41 = _res_vals[p];
21918                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
21919                 CHECK_ACCESS(_res_conv_41_ptr);
21920                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
21921                 FREE(untag_ptr(_res_conv_41));
21922                 _res_constr.data[p] = _res_conv_41_conv;
21923         }
21924         FREE(_res);
21925         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
21926 }
21927
21928 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
21929         if (!ptr_is_owned(this_ptr)) return;
21930         void* this_ptr_ptr = untag_ptr(this_ptr);
21931         CHECK_ACCESS(this_ptr_ptr);
21932         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
21933         FREE(untag_ptr(this_ptr));
21934         PaymentPurpose_free(this_ptr_conv);
21935 }
21936
21937 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
21938         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21939         *ret_copy = PaymentPurpose_clone(arg);
21940         uint64_t ret_ref = tag_ptr(ret_copy, true);
21941         return ret_ref;
21942 }
21943 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
21944         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
21945         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
21946         return ret_conv;
21947 }
21948
21949 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
21950         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
21951         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21952         *ret_copy = PaymentPurpose_clone(orig_conv);
21953         uint64_t ret_ref = tag_ptr(ret_copy, true);
21954         return ret_ref;
21955 }
21956
21957 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
21958         LDKThirtyTwoBytes payment_preimage_ref;
21959         CHECK(payment_preimage->arr_len == 32);
21960         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21961         LDKThirtyTwoBytes payment_secret_ref;
21962         CHECK(payment_secret->arr_len == 32);
21963         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
21964         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21965         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
21966         uint64_t ret_ref = tag_ptr(ret_copy, true);
21967         return ret_ref;
21968 }
21969
21970 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
21971         LDKThirtyTwoBytes a_ref;
21972         CHECK(a->arr_len == 32);
21973         memcpy(a_ref.data, a->elems, 32); FREE(a);
21974         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21975         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
21976         uint64_t ret_ref = tag_ptr(ret_copy, true);
21977         return ret_ref;
21978 }
21979
21980 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
21981         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
21982         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
21983         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
21984         return ret_conv;
21985 }
21986
21987 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
21988         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
21989         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
21990         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21991         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21992         CVec_u8Z_free(ret_var);
21993         return ret_arr;
21994 }
21995
21996 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
21997         LDKu8slice ser_ref;
21998         ser_ref.datalen = ser->arr_len;
21999         ser_ref.data = ser->elems;
22000         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
22001         *ret_conv = PaymentPurpose_read(ser_ref);
22002         FREE(ser);
22003         return tag_ptr(ret_conv, true);
22004 }
22005
22006 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
22007         if (!ptr_is_owned(this_ptr)) return;
22008         void* this_ptr_ptr = untag_ptr(this_ptr);
22009         CHECK_ACCESS(this_ptr_ptr);
22010         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
22011         FREE(untag_ptr(this_ptr));
22012         PathFailure_free(this_ptr_conv);
22013 }
22014
22015 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
22016         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
22017         *ret_copy = PathFailure_clone(arg);
22018         uint64_t ret_ref = tag_ptr(ret_copy, true);
22019         return ret_ref;
22020 }
22021 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
22022         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
22023         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
22024         return ret_conv;
22025 }
22026
22027 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
22028         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
22029         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
22030         *ret_copy = PathFailure_clone(orig_conv);
22031         uint64_t ret_ref = tag_ptr(ret_copy, true);
22032         return ret_ref;
22033 }
22034
22035 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
22036         void* err_ptr = untag_ptr(err);
22037         CHECK_ACCESS(err_ptr);
22038         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
22039         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
22040         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
22041         *ret_copy = PathFailure_initial_send(err_conv);
22042         uint64_t ret_ref = tag_ptr(ret_copy, true);
22043         return ret_ref;
22044 }
22045
22046 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
22047         void* network_update_ptr = untag_ptr(network_update);
22048         CHECK_ACCESS(network_update_ptr);
22049         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
22050         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
22051         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
22052         *ret_copy = PathFailure_on_path(network_update_conv);
22053         uint64_t ret_ref = tag_ptr(ret_copy, true);
22054         return ret_ref;
22055 }
22056
22057 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
22058         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
22059         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
22060         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
22061         return ret_conv;
22062 }
22063
22064 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
22065         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
22066         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
22067         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22068         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22069         CVec_u8Z_free(ret_var);
22070         return ret_arr;
22071 }
22072
22073 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
22074         LDKu8slice ser_ref;
22075         ser_ref.datalen = ser->arr_len;
22076         ser_ref.data = ser->elems;
22077         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
22078         *ret_conv = PathFailure_read(ser_ref);
22079         FREE(ser);
22080         return tag_ptr(ret_conv, true);
22081 }
22082
22083 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
22084         if (!ptr_is_owned(this_ptr)) return;
22085         void* this_ptr_ptr = untag_ptr(this_ptr);
22086         CHECK_ACCESS(this_ptr_ptr);
22087         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
22088         FREE(untag_ptr(this_ptr));
22089         ClosureReason_free(this_ptr_conv);
22090 }
22091
22092 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
22093         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22094         *ret_copy = ClosureReason_clone(arg);
22095         uint64_t ret_ref = tag_ptr(ret_copy, true);
22096         return ret_ref;
22097 }
22098 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
22099         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
22100         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
22101         return ret_conv;
22102 }
22103
22104 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
22105         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
22106         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22107         *ret_copy = ClosureReason_clone(orig_conv);
22108         uint64_t ret_ref = tag_ptr(ret_copy, true);
22109         return ret_ref;
22110 }
22111
22112 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
22113         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
22114         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22115         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
22116         uint64_t ret_ref = tag_ptr(ret_copy, true);
22117         return ret_ref;
22118 }
22119
22120 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
22121         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22122         *ret_copy = ClosureReason_holder_force_closed();
22123         uint64_t ret_ref = tag_ptr(ret_copy, true);
22124         return ret_ref;
22125 }
22126
22127 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
22128         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22129         *ret_copy = ClosureReason_cooperative_closure();
22130         uint64_t ret_ref = tag_ptr(ret_copy, true);
22131         return ret_ref;
22132 }
22133
22134 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
22135         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22136         *ret_copy = ClosureReason_commitment_tx_confirmed();
22137         uint64_t ret_ref = tag_ptr(ret_copy, true);
22138         return ret_ref;
22139 }
22140
22141 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
22142         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22143         *ret_copy = ClosureReason_funding_timed_out();
22144         uint64_t ret_ref = tag_ptr(ret_copy, true);
22145         return ret_ref;
22146 }
22147
22148 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
22149         LDKStr err_conv = str_ref_to_owned_c(err);
22150         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22151         *ret_copy = ClosureReason_processing_error(err_conv);
22152         uint64_t ret_ref = tag_ptr(ret_copy, true);
22153         return ret_ref;
22154 }
22155
22156 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
22157         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22158         *ret_copy = ClosureReason_disconnected_peer();
22159         uint64_t ret_ref = tag_ptr(ret_copy, true);
22160         return ret_ref;
22161 }
22162
22163 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
22164         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22165         *ret_copy = ClosureReason_outdated_channel_manager();
22166         uint64_t ret_ref = tag_ptr(ret_copy, true);
22167         return ret_ref;
22168 }
22169
22170 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
22171         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
22172         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
22173         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
22174         return ret_conv;
22175 }
22176
22177 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
22178         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
22179         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
22180         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22181         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22182         CVec_u8Z_free(ret_var);
22183         return ret_arr;
22184 }
22185
22186 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
22187         LDKu8slice ser_ref;
22188         ser_ref.datalen = ser->arr_len;
22189         ser_ref.data = ser->elems;
22190         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
22191         *ret_conv = ClosureReason_read(ser_ref);
22192         FREE(ser);
22193         return tag_ptr(ret_conv, true);
22194 }
22195
22196 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
22197         if (!ptr_is_owned(this_ptr)) return;
22198         void* this_ptr_ptr = untag_ptr(this_ptr);
22199         CHECK_ACCESS(this_ptr_ptr);
22200         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
22201         FREE(untag_ptr(this_ptr));
22202         HTLCDestination_free(this_ptr_conv);
22203 }
22204
22205 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
22206         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22207         *ret_copy = HTLCDestination_clone(arg);
22208         uint64_t ret_ref = tag_ptr(ret_copy, true);
22209         return ret_ref;
22210 }
22211 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
22212         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
22213         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
22214         return ret_conv;
22215 }
22216
22217 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
22218         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
22219         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22220         *ret_copy = HTLCDestination_clone(orig_conv);
22221         uint64_t ret_ref = tag_ptr(ret_copy, true);
22222         return ret_ref;
22223 }
22224
22225 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
22226         LDKPublicKey node_id_ref;
22227         CHECK(node_id->arr_len == 33);
22228         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22229         LDKThirtyTwoBytes channel_id_ref;
22230         CHECK(channel_id->arr_len == 32);
22231         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22232         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22233         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
22234         uint64_t ret_ref = tag_ptr(ret_copy, true);
22235         return ret_ref;
22236 }
22237
22238 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
22239         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22240         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
22241         uint64_t ret_ref = tag_ptr(ret_copy, true);
22242         return ret_ref;
22243 }
22244
22245 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
22246         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22247         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
22248         uint64_t ret_ref = tag_ptr(ret_copy, true);
22249         return ret_ref;
22250 }
22251
22252 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
22253         LDKThirtyTwoBytes payment_hash_ref;
22254         CHECK(payment_hash->arr_len == 32);
22255         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22256         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22257         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
22258         uint64_t ret_ref = tag_ptr(ret_copy, true);
22259         return ret_ref;
22260 }
22261
22262 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
22263         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
22264         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
22265         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
22266         return ret_conv;
22267 }
22268
22269 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
22270         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
22271         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
22272         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22273         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22274         CVec_u8Z_free(ret_var);
22275         return ret_arr;
22276 }
22277
22278 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
22279         LDKu8slice ser_ref;
22280         ser_ref.datalen = ser->arr_len;
22281         ser_ref.data = ser->elems;
22282         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
22283         *ret_conv = HTLCDestination_read(ser_ref);
22284         FREE(ser);
22285         return tag_ptr(ret_conv, true);
22286 }
22287
22288 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
22289         if (!ptr_is_owned(this_ptr)) return;
22290         void* this_ptr_ptr = untag_ptr(this_ptr);
22291         CHECK_ACCESS(this_ptr_ptr);
22292         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
22293         FREE(untag_ptr(this_ptr));
22294         Event_free(this_ptr_conv);
22295 }
22296
22297 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
22298         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22299         *ret_copy = Event_clone(arg);
22300         uint64_t ret_ref = tag_ptr(ret_copy, true);
22301         return ret_ref;
22302 }
22303 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
22304         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
22305         int64_t ret_conv = Event_clone_ptr(arg_conv);
22306         return ret_conv;
22307 }
22308
22309 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
22310         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
22311         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22312         *ret_copy = Event_clone(orig_conv);
22313         uint64_t ret_ref = tag_ptr(ret_copy, true);
22314         return ret_ref;
22315 }
22316
22317 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) {
22318         LDKThirtyTwoBytes temporary_channel_id_ref;
22319         CHECK(temporary_channel_id->arr_len == 32);
22320         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
22321         LDKPublicKey counterparty_node_id_ref;
22322         CHECK(counterparty_node_id->arr_len == 33);
22323         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22324         LDKCVec_u8Z output_script_ref;
22325         output_script_ref.datalen = output_script->arr_len;
22326         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
22327         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
22328         LDKU128 user_channel_id_ref;
22329         CHECK(user_channel_id->arr_len == 16);
22330         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22331         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22332         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
22333         uint64_t ret_ref = tag_ptr(ret_copy, true);
22334         return ret_ref;
22335 }
22336
22337 uint64_t  __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose, int8_tArray via_channel_id, uint64_t via_user_channel_id) {
22338         LDKPublicKey receiver_node_id_ref;
22339         CHECK(receiver_node_id->arr_len == 33);
22340         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
22341         LDKThirtyTwoBytes payment_hash_ref;
22342         CHECK(payment_hash->arr_len == 32);
22343         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22344         void* purpose_ptr = untag_ptr(purpose);
22345         CHECK_ACCESS(purpose_ptr);
22346         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
22347         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
22348         LDKThirtyTwoBytes via_channel_id_ref;
22349         CHECK(via_channel_id->arr_len == 32);
22350         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
22351         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
22352         CHECK_ACCESS(via_user_channel_id_ptr);
22353         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
22354         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
22355         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22356         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, via_channel_id_ref, via_user_channel_id_conv);
22357         uint64_t ret_ref = tag_ptr(ret_copy, true);
22358         return ret_ref;
22359 }
22360
22361 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) {
22362         LDKPublicKey receiver_node_id_ref;
22363         CHECK(receiver_node_id->arr_len == 33);
22364         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
22365         LDKThirtyTwoBytes payment_hash_ref;
22366         CHECK(payment_hash->arr_len == 32);
22367         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22368         void* purpose_ptr = untag_ptr(purpose);
22369         CHECK_ACCESS(purpose_ptr);
22370         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
22371         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
22372         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22373         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
22374         uint64_t ret_ref = tag_ptr(ret_copy, true);
22375         return ret_ref;
22376 }
22377
22378 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) {
22379         LDKThirtyTwoBytes payment_id_ref;
22380         CHECK(payment_id->arr_len == 32);
22381         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22382         LDKThirtyTwoBytes payment_preimage_ref;
22383         CHECK(payment_preimage->arr_len == 32);
22384         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
22385         LDKThirtyTwoBytes payment_hash_ref;
22386         CHECK(payment_hash->arr_len == 32);
22387         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22388         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
22389         CHECK_ACCESS(fee_paid_msat_ptr);
22390         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
22391         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
22392         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22393         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
22394         uint64_t ret_ref = tag_ptr(ret_copy, true);
22395         return ret_ref;
22396 }
22397
22398 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
22399         LDKThirtyTwoBytes payment_id_ref;
22400         CHECK(payment_id->arr_len == 32);
22401         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22402         LDKThirtyTwoBytes payment_hash_ref;
22403         CHECK(payment_hash->arr_len == 32);
22404         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22405         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22406         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
22407         uint64_t ret_ref = tag_ptr(ret_copy, true);
22408         return ret_ref;
22409 }
22410
22411 uint64_t  __attribute__((export_name("TS_Event_payment_path_successful"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
22412         LDKThirtyTwoBytes payment_id_ref;
22413         CHECK(payment_id->arr_len == 32);
22414         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22415         LDKThirtyTwoBytes payment_hash_ref;
22416         CHECK(payment_hash->arr_len == 32);
22417         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22418         LDKCVec_RouteHopZ path_constr;
22419         path_constr.datalen = path->arr_len;
22420         if (path_constr.datalen > 0)
22421                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22422         else
22423                 path_constr.data = NULL;
22424         uint64_t* path_vals = path->elems;
22425         for (size_t k = 0; k < path_constr.datalen; k++) {
22426                 uint64_t path_conv_10 = path_vals[k];
22427                 LDKRouteHop path_conv_10_conv;
22428                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22429                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22430                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22431                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22432                 path_constr.data[k] = path_conv_10_conv;
22433         }
22434         FREE(path);
22435         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22436         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
22437         uint64_t ret_ref = tag_ptr(ret_copy, true);
22438         return ret_ref;
22439 }
22440
22441 uint64_t  __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, uint64_t failure, uint64_tArray path, uint64_t short_channel_id, uint64_t retry) {
22442         LDKThirtyTwoBytes payment_id_ref;
22443         CHECK(payment_id->arr_len == 32);
22444         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22445         LDKThirtyTwoBytes payment_hash_ref;
22446         CHECK(payment_hash->arr_len == 32);
22447         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22448         void* failure_ptr = untag_ptr(failure);
22449         CHECK_ACCESS(failure_ptr);
22450         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
22451         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
22452         LDKCVec_RouteHopZ path_constr;
22453         path_constr.datalen = path->arr_len;
22454         if (path_constr.datalen > 0)
22455                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22456         else
22457                 path_constr.data = NULL;
22458         uint64_t* path_vals = path->elems;
22459         for (size_t k = 0; k < path_constr.datalen; k++) {
22460                 uint64_t path_conv_10 = path_vals[k];
22461                 LDKRouteHop path_conv_10_conv;
22462                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22463                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22464                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22465                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22466                 path_constr.data[k] = path_conv_10_conv;
22467         }
22468         FREE(path);
22469         void* short_channel_id_ptr = untag_ptr(short_channel_id);
22470         CHECK_ACCESS(short_channel_id_ptr);
22471         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22472         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
22473         LDKRouteParameters retry_conv;
22474         retry_conv.inner = untag_ptr(retry);
22475         retry_conv.is_owned = ptr_is_owned(retry);
22476         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
22477         retry_conv = RouteParameters_clone(&retry_conv);
22478         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22479         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_constr, short_channel_id_conv, retry_conv);
22480         uint64_t ret_ref = tag_ptr(ret_copy, true);
22481         return ret_ref;
22482 }
22483
22484 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
22485         LDKThirtyTwoBytes payment_id_ref;
22486         CHECK(payment_id->arr_len == 32);
22487         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22488         LDKThirtyTwoBytes payment_hash_ref;
22489         CHECK(payment_hash->arr_len == 32);
22490         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22491         LDKCVec_RouteHopZ path_constr;
22492         path_constr.datalen = path->arr_len;
22493         if (path_constr.datalen > 0)
22494                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22495         else
22496                 path_constr.data = NULL;
22497         uint64_t* path_vals = path->elems;
22498         for (size_t k = 0; k < path_constr.datalen; k++) {
22499                 uint64_t path_conv_10 = path_vals[k];
22500                 LDKRouteHop path_conv_10_conv;
22501                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22502                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22503                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22504                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22505                 path_constr.data[k] = path_conv_10_conv;
22506         }
22507         FREE(path);
22508         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22509         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
22510         uint64_t ret_ref = tag_ptr(ret_copy, true);
22511         return ret_ref;
22512 }
22513
22514 uint64_t  __attribute__((export_name("TS_Event_probe_failed"))) TS_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path, uint64_t short_channel_id) {
22515         LDKThirtyTwoBytes payment_id_ref;
22516         CHECK(payment_id->arr_len == 32);
22517         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22518         LDKThirtyTwoBytes payment_hash_ref;
22519         CHECK(payment_hash->arr_len == 32);
22520         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22521         LDKCVec_RouteHopZ path_constr;
22522         path_constr.datalen = path->arr_len;
22523         if (path_constr.datalen > 0)
22524                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22525         else
22526                 path_constr.data = NULL;
22527         uint64_t* path_vals = path->elems;
22528         for (size_t k = 0; k < path_constr.datalen; k++) {
22529                 uint64_t path_conv_10 = path_vals[k];
22530                 LDKRouteHop path_conv_10_conv;
22531                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22532                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22533                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22534                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22535                 path_constr.data[k] = path_conv_10_conv;
22536         }
22537         FREE(path);
22538         void* short_channel_id_ptr = untag_ptr(short_channel_id);
22539         CHECK_ACCESS(short_channel_id_ptr);
22540         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22541         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
22542         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22543         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
22544         uint64_t ret_ref = tag_ptr(ret_copy, true);
22545         return ret_ref;
22546 }
22547
22548 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
22549         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22550         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
22551         uint64_t ret_ref = tag_ptr(ret_copy, true);
22552         return ret_ref;
22553 }
22554
22555 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) {
22556         LDKThirtyTwoBytes intercept_id_ref;
22557         CHECK(intercept_id->arr_len == 32);
22558         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
22559         LDKThirtyTwoBytes payment_hash_ref;
22560         CHECK(payment_hash->arr_len == 32);
22561         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22562         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22563         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
22564         uint64_t ret_ref = tag_ptr(ret_copy, true);
22565         return ret_ref;
22566 }
22567
22568 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
22569         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
22570         outputs_constr.datalen = outputs->arr_len;
22571         if (outputs_constr.datalen > 0)
22572                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
22573         else
22574                 outputs_constr.data = NULL;
22575         uint64_t* outputs_vals = outputs->elems;
22576         for (size_t b = 0; b < outputs_constr.datalen; b++) {
22577                 uint64_t outputs_conv_27 = outputs_vals[b];
22578                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
22579                 CHECK_ACCESS(outputs_conv_27_ptr);
22580                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
22581                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
22582                 outputs_constr.data[b] = outputs_conv_27_conv;
22583         }
22584         FREE(outputs);
22585         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22586         *ret_copy = Event_spendable_outputs(outputs_constr);
22587         uint64_t ret_ref = tag_ptr(ret_copy, true);
22588         return ret_ref;
22589 }
22590
22591 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) {
22592         LDKThirtyTwoBytes prev_channel_id_ref;
22593         CHECK(prev_channel_id->arr_len == 32);
22594         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
22595         LDKThirtyTwoBytes next_channel_id_ref;
22596         CHECK(next_channel_id->arr_len == 32);
22597         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
22598         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
22599         CHECK_ACCESS(fee_earned_msat_ptr);
22600         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
22601         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
22602         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22603         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
22604         uint64_t ret_ref = tag_ptr(ret_copy, true);
22605         return ret_ref;
22606 }
22607
22608 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) {
22609         LDKThirtyTwoBytes channel_id_ref;
22610         CHECK(channel_id->arr_len == 32);
22611         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22612         LDKU128 user_channel_id_ref;
22613         CHECK(user_channel_id->arr_len == 16);
22614         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22615         LDKPublicKey counterparty_node_id_ref;
22616         CHECK(counterparty_node_id->arr_len == 33);
22617         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22618         LDKChannelTypeFeatures channel_type_conv;
22619         channel_type_conv.inner = untag_ptr(channel_type);
22620         channel_type_conv.is_owned = ptr_is_owned(channel_type);
22621         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
22622         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
22623         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22624         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
22625         uint64_t ret_ref = tag_ptr(ret_copy, true);
22626         return ret_ref;
22627 }
22628
22629 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) {
22630         LDKThirtyTwoBytes channel_id_ref;
22631         CHECK(channel_id->arr_len == 32);
22632         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22633         LDKU128 user_channel_id_ref;
22634         CHECK(user_channel_id->arr_len == 16);
22635         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22636         void* reason_ptr = untag_ptr(reason);
22637         CHECK_ACCESS(reason_ptr);
22638         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
22639         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
22640         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22641         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
22642         uint64_t ret_ref = tag_ptr(ret_copy, true);
22643         return ret_ref;
22644 }
22645
22646 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
22647         LDKThirtyTwoBytes channel_id_ref;
22648         CHECK(channel_id->arr_len == 32);
22649         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22650         LDKTransaction transaction_ref;
22651         transaction_ref.datalen = transaction->arr_len;
22652         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
22653         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
22654         transaction_ref.data_is_owned = true;
22655         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22656         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
22657         uint64_t ret_ref = tag_ptr(ret_copy, true);
22658         return ret_ref;
22659 }
22660
22661 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) {
22662         LDKThirtyTwoBytes temporary_channel_id_ref;
22663         CHECK(temporary_channel_id->arr_len == 32);
22664         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
22665         LDKPublicKey counterparty_node_id_ref;
22666         CHECK(counterparty_node_id->arr_len == 33);
22667         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22668         LDKChannelTypeFeatures channel_type_conv;
22669         channel_type_conv.inner = untag_ptr(channel_type);
22670         channel_type_conv.is_owned = ptr_is_owned(channel_type);
22671         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
22672         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
22673         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22674         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
22675         uint64_t ret_ref = tag_ptr(ret_copy, true);
22676         return ret_ref;
22677 }
22678
22679 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
22680         LDKThirtyTwoBytes prev_channel_id_ref;
22681         CHECK(prev_channel_id->arr_len == 32);
22682         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
22683         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
22684         CHECK_ACCESS(failed_next_destination_ptr);
22685         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
22686         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
22687         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22688         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
22689         uint64_t ret_ref = tag_ptr(ret_copy, true);
22690         return ret_ref;
22691 }
22692
22693 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
22694         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
22695         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
22696         jboolean ret_conv = Event_eq(a_conv, b_conv);
22697         return ret_conv;
22698 }
22699
22700 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
22701         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
22702         LDKCVec_u8Z ret_var = Event_write(obj_conv);
22703         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22704         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22705         CVec_u8Z_free(ret_var);
22706         return ret_arr;
22707 }
22708
22709 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
22710         LDKu8slice ser_ref;
22711         ser_ref.datalen = ser->arr_len;
22712         ser_ref.data = ser->elems;
22713         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
22714         *ret_conv = Event_read(ser_ref);
22715         FREE(ser);
22716         return tag_ptr(ret_conv, true);
22717 }
22718
22719 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
22720         if (!ptr_is_owned(this_ptr)) return;
22721         void* this_ptr_ptr = untag_ptr(this_ptr);
22722         CHECK_ACCESS(this_ptr_ptr);
22723         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
22724         FREE(untag_ptr(this_ptr));
22725         MessageSendEvent_free(this_ptr_conv);
22726 }
22727
22728 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
22729         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22730         *ret_copy = MessageSendEvent_clone(arg);
22731         uint64_t ret_ref = tag_ptr(ret_copy, true);
22732         return ret_ref;
22733 }
22734 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
22735         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
22736         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
22737         return ret_conv;
22738 }
22739
22740 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
22741         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
22742         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22743         *ret_copy = MessageSendEvent_clone(orig_conv);
22744         uint64_t ret_ref = tag_ptr(ret_copy, true);
22745         return ret_ref;
22746 }
22747
22748 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
22749         LDKPublicKey node_id_ref;
22750         CHECK(node_id->arr_len == 33);
22751         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22752         LDKAcceptChannel msg_conv;
22753         msg_conv.inner = untag_ptr(msg);
22754         msg_conv.is_owned = ptr_is_owned(msg);
22755         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22756         msg_conv = AcceptChannel_clone(&msg_conv);
22757         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22758         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
22759         uint64_t ret_ref = tag_ptr(ret_copy, true);
22760         return ret_ref;
22761 }
22762
22763 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
22764         LDKPublicKey node_id_ref;
22765         CHECK(node_id->arr_len == 33);
22766         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22767         LDKOpenChannel msg_conv;
22768         msg_conv.inner = untag_ptr(msg);
22769         msg_conv.is_owned = ptr_is_owned(msg);
22770         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22771         msg_conv = OpenChannel_clone(&msg_conv);
22772         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22773         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
22774         uint64_t ret_ref = tag_ptr(ret_copy, true);
22775         return ret_ref;
22776 }
22777
22778 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
22779         LDKPublicKey node_id_ref;
22780         CHECK(node_id->arr_len == 33);
22781         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22782         LDKFundingCreated msg_conv;
22783         msg_conv.inner = untag_ptr(msg);
22784         msg_conv.is_owned = ptr_is_owned(msg);
22785         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22786         msg_conv = FundingCreated_clone(&msg_conv);
22787         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22788         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
22789         uint64_t ret_ref = tag_ptr(ret_copy, true);
22790         return ret_ref;
22791 }
22792
22793 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
22794         LDKPublicKey node_id_ref;
22795         CHECK(node_id->arr_len == 33);
22796         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22797         LDKFundingSigned msg_conv;
22798         msg_conv.inner = untag_ptr(msg);
22799         msg_conv.is_owned = ptr_is_owned(msg);
22800         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22801         msg_conv = FundingSigned_clone(&msg_conv);
22802         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22803         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
22804         uint64_t ret_ref = tag_ptr(ret_copy, true);
22805         return ret_ref;
22806 }
22807
22808 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
22809         LDKPublicKey node_id_ref;
22810         CHECK(node_id->arr_len == 33);
22811         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22812         LDKChannelReady msg_conv;
22813         msg_conv.inner = untag_ptr(msg);
22814         msg_conv.is_owned = ptr_is_owned(msg);
22815         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22816         msg_conv = ChannelReady_clone(&msg_conv);
22817         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22818         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
22819         uint64_t ret_ref = tag_ptr(ret_copy, true);
22820         return ret_ref;
22821 }
22822
22823 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
22824         LDKPublicKey node_id_ref;
22825         CHECK(node_id->arr_len == 33);
22826         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22827         LDKAnnouncementSignatures msg_conv;
22828         msg_conv.inner = untag_ptr(msg);
22829         msg_conv.is_owned = ptr_is_owned(msg);
22830         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22831         msg_conv = AnnouncementSignatures_clone(&msg_conv);
22832         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22833         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
22834         uint64_t ret_ref = tag_ptr(ret_copy, true);
22835         return ret_ref;
22836 }
22837
22838 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
22839         LDKPublicKey node_id_ref;
22840         CHECK(node_id->arr_len == 33);
22841         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22842         LDKCommitmentUpdate updates_conv;
22843         updates_conv.inner = untag_ptr(updates);
22844         updates_conv.is_owned = ptr_is_owned(updates);
22845         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
22846         updates_conv = CommitmentUpdate_clone(&updates_conv);
22847         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22848         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
22849         uint64_t ret_ref = tag_ptr(ret_copy, true);
22850         return ret_ref;
22851 }
22852
22853 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
22854         LDKPublicKey node_id_ref;
22855         CHECK(node_id->arr_len == 33);
22856         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22857         LDKRevokeAndACK msg_conv;
22858         msg_conv.inner = untag_ptr(msg);
22859         msg_conv.is_owned = ptr_is_owned(msg);
22860         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22861         msg_conv = RevokeAndACK_clone(&msg_conv);
22862         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22863         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
22864         uint64_t ret_ref = tag_ptr(ret_copy, true);
22865         return ret_ref;
22866 }
22867
22868 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
22869         LDKPublicKey node_id_ref;
22870         CHECK(node_id->arr_len == 33);
22871         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22872         LDKClosingSigned msg_conv;
22873         msg_conv.inner = untag_ptr(msg);
22874         msg_conv.is_owned = ptr_is_owned(msg);
22875         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22876         msg_conv = ClosingSigned_clone(&msg_conv);
22877         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22878         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
22879         uint64_t ret_ref = tag_ptr(ret_copy, true);
22880         return ret_ref;
22881 }
22882
22883 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
22884         LDKPublicKey node_id_ref;
22885         CHECK(node_id->arr_len == 33);
22886         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22887         LDKShutdown msg_conv;
22888         msg_conv.inner = untag_ptr(msg);
22889         msg_conv.is_owned = ptr_is_owned(msg);
22890         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22891         msg_conv = Shutdown_clone(&msg_conv);
22892         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22893         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
22894         uint64_t ret_ref = tag_ptr(ret_copy, true);
22895         return ret_ref;
22896 }
22897
22898 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
22899         LDKPublicKey node_id_ref;
22900         CHECK(node_id->arr_len == 33);
22901         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22902         LDKChannelReestablish msg_conv;
22903         msg_conv.inner = untag_ptr(msg);
22904         msg_conv.is_owned = ptr_is_owned(msg);
22905         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22906         msg_conv = ChannelReestablish_clone(&msg_conv);
22907         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22908         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
22909         uint64_t ret_ref = tag_ptr(ret_copy, true);
22910         return ret_ref;
22911 }
22912
22913 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) {
22914         LDKPublicKey node_id_ref;
22915         CHECK(node_id->arr_len == 33);
22916         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22917         LDKChannelAnnouncement msg_conv;
22918         msg_conv.inner = untag_ptr(msg);
22919         msg_conv.is_owned = ptr_is_owned(msg);
22920         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22921         msg_conv = ChannelAnnouncement_clone(&msg_conv);
22922         LDKChannelUpdate update_msg_conv;
22923         update_msg_conv.inner = untag_ptr(update_msg);
22924         update_msg_conv.is_owned = ptr_is_owned(update_msg);
22925         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
22926         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
22927         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22928         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
22929         uint64_t ret_ref = tag_ptr(ret_copy, true);
22930         return ret_ref;
22931 }
22932
22933 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
22934         LDKChannelAnnouncement msg_conv;
22935         msg_conv.inner = untag_ptr(msg);
22936         msg_conv.is_owned = ptr_is_owned(msg);
22937         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22938         msg_conv = ChannelAnnouncement_clone(&msg_conv);
22939         LDKChannelUpdate update_msg_conv;
22940         update_msg_conv.inner = untag_ptr(update_msg);
22941         update_msg_conv.is_owned = ptr_is_owned(update_msg);
22942         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
22943         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
22944         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22945         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
22946         uint64_t ret_ref = tag_ptr(ret_copy, true);
22947         return ret_ref;
22948 }
22949
22950 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
22951         LDKChannelUpdate msg_conv;
22952         msg_conv.inner = untag_ptr(msg);
22953         msg_conv.is_owned = ptr_is_owned(msg);
22954         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22955         msg_conv = ChannelUpdate_clone(&msg_conv);
22956         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22957         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
22958         uint64_t ret_ref = tag_ptr(ret_copy, true);
22959         return ret_ref;
22960 }
22961
22962 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
22963         LDKNodeAnnouncement msg_conv;
22964         msg_conv.inner = untag_ptr(msg);
22965         msg_conv.is_owned = ptr_is_owned(msg);
22966         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22967         msg_conv = NodeAnnouncement_clone(&msg_conv);
22968         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22969         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
22970         uint64_t ret_ref = tag_ptr(ret_copy, true);
22971         return ret_ref;
22972 }
22973
22974 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
22975         LDKPublicKey node_id_ref;
22976         CHECK(node_id->arr_len == 33);
22977         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22978         LDKChannelUpdate msg_conv;
22979         msg_conv.inner = untag_ptr(msg);
22980         msg_conv.is_owned = ptr_is_owned(msg);
22981         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22982         msg_conv = ChannelUpdate_clone(&msg_conv);
22983         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22984         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
22985         uint64_t ret_ref = tag_ptr(ret_copy, true);
22986         return ret_ref;
22987 }
22988
22989 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
22990         LDKPublicKey node_id_ref;
22991         CHECK(node_id->arr_len == 33);
22992         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22993         void* action_ptr = untag_ptr(action);
22994         CHECK_ACCESS(action_ptr);
22995         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
22996         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
22997         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22998         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
22999         uint64_t ret_ref = tag_ptr(ret_copy, true);
23000         return ret_ref;
23001 }
23002
23003 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
23004         LDKPublicKey node_id_ref;
23005         CHECK(node_id->arr_len == 33);
23006         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
23007         LDKQueryChannelRange msg_conv;
23008         msg_conv.inner = untag_ptr(msg);
23009         msg_conv.is_owned = ptr_is_owned(msg);
23010         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23011         msg_conv = QueryChannelRange_clone(&msg_conv);
23012         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23013         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
23014         uint64_t ret_ref = tag_ptr(ret_copy, true);
23015         return ret_ref;
23016 }
23017
23018 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
23019         LDKPublicKey node_id_ref;
23020         CHECK(node_id->arr_len == 33);
23021         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
23022         LDKQueryShortChannelIds msg_conv;
23023         msg_conv.inner = untag_ptr(msg);
23024         msg_conv.is_owned = ptr_is_owned(msg);
23025         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23026         msg_conv = QueryShortChannelIds_clone(&msg_conv);
23027         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23028         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
23029         uint64_t ret_ref = tag_ptr(ret_copy, true);
23030         return ret_ref;
23031 }
23032
23033 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
23034         LDKPublicKey node_id_ref;
23035         CHECK(node_id->arr_len == 33);
23036         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
23037         LDKReplyChannelRange msg_conv;
23038         msg_conv.inner = untag_ptr(msg);
23039         msg_conv.is_owned = ptr_is_owned(msg);
23040         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23041         msg_conv = ReplyChannelRange_clone(&msg_conv);
23042         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23043         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
23044         uint64_t ret_ref = tag_ptr(ret_copy, true);
23045         return ret_ref;
23046 }
23047
23048 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
23049         LDKPublicKey node_id_ref;
23050         CHECK(node_id->arr_len == 33);
23051         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
23052         LDKGossipTimestampFilter msg_conv;
23053         msg_conv.inner = untag_ptr(msg);
23054         msg_conv.is_owned = ptr_is_owned(msg);
23055         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23056         msg_conv = GossipTimestampFilter_clone(&msg_conv);
23057         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23058         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
23059         uint64_t ret_ref = tag_ptr(ret_copy, true);
23060         return ret_ref;
23061 }
23062
23063 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
23064         if (!ptr_is_owned(this_ptr)) return;
23065         void* this_ptr_ptr = untag_ptr(this_ptr);
23066         CHECK_ACCESS(this_ptr_ptr);
23067         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
23068         FREE(untag_ptr(this_ptr));
23069         MessageSendEventsProvider_free(this_ptr_conv);
23070 }
23071
23072 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
23073         if (!ptr_is_owned(this_ptr)) return;
23074         void* this_ptr_ptr = untag_ptr(this_ptr);
23075         CHECK_ACCESS(this_ptr_ptr);
23076         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
23077         FREE(untag_ptr(this_ptr));
23078         OnionMessageProvider_free(this_ptr_conv);
23079 }
23080
23081 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
23082         if (!ptr_is_owned(this_ptr)) return;
23083         void* this_ptr_ptr = untag_ptr(this_ptr);
23084         CHECK_ACCESS(this_ptr_ptr);
23085         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
23086         FREE(untag_ptr(this_ptr));
23087         EventsProvider_free(this_ptr_conv);
23088 }
23089
23090 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
23091         if (!ptr_is_owned(this_ptr)) return;
23092         void* this_ptr_ptr = untag_ptr(this_ptr);
23093         CHECK_ACCESS(this_ptr_ptr);
23094         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
23095         FREE(untag_ptr(this_ptr));
23096         EventHandler_free(this_ptr_conv);
23097 }
23098
23099 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
23100         if (!ptr_is_owned(this_ptr)) return;
23101         void* this_ptr_ptr = untag_ptr(this_ptr);
23102         CHECK_ACCESS(this_ptr_ptr);
23103         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
23104         FREE(untag_ptr(this_ptr));
23105         APIError_free(this_ptr_conv);
23106 }
23107
23108 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
23109         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23110         *ret_copy = APIError_clone(arg);
23111         uint64_t ret_ref = tag_ptr(ret_copy, true);
23112         return ret_ref;
23113 }
23114 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
23115         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
23116         int64_t ret_conv = APIError_clone_ptr(arg_conv);
23117         return ret_conv;
23118 }
23119
23120 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
23121         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
23122         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23123         *ret_copy = APIError_clone(orig_conv);
23124         uint64_t ret_ref = tag_ptr(ret_copy, true);
23125         return ret_ref;
23126 }
23127
23128 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
23129         LDKStr err_conv = str_ref_to_owned_c(err);
23130         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23131         *ret_copy = APIError_apimisuse_error(err_conv);
23132         uint64_t ret_ref = tag_ptr(ret_copy, true);
23133         return ret_ref;
23134 }
23135
23136 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
23137         LDKStr err_conv = str_ref_to_owned_c(err);
23138         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23139         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
23140         uint64_t ret_ref = tag_ptr(ret_copy, true);
23141         return ret_ref;
23142 }
23143
23144 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
23145         LDKStr err_conv = str_ref_to_owned_c(err);
23146         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23147         *ret_copy = APIError_invalid_route(err_conv);
23148         uint64_t ret_ref = tag_ptr(ret_copy, true);
23149         return ret_ref;
23150 }
23151
23152 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
23153         LDKStr err_conv = str_ref_to_owned_c(err);
23154         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23155         *ret_copy = APIError_channel_unavailable(err_conv);
23156         uint64_t ret_ref = tag_ptr(ret_copy, true);
23157         return ret_ref;
23158 }
23159
23160 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
23161         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23162         *ret_copy = APIError_monitor_update_in_progress();
23163         uint64_t ret_ref = tag_ptr(ret_copy, true);
23164         return ret_ref;
23165 }
23166
23167 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
23168         LDKShutdownScript script_conv;
23169         script_conv.inner = untag_ptr(script);
23170         script_conv.is_owned = ptr_is_owned(script);
23171         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
23172         script_conv = ShutdownScript_clone(&script_conv);
23173         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23174         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
23175         uint64_t ret_ref = tag_ptr(ret_copy, true);
23176         return ret_ref;
23177 }
23178
23179 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
23180         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
23181         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
23182         jboolean ret_conv = APIError_eq(a_conv, b_conv);
23183         return ret_conv;
23184 }
23185
23186 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
23187         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
23188         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
23189         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23190         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23191         CVec_u8Z_free(ret_var);
23192         return ret_arr;
23193 }
23194
23195 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
23196         LDKu8slice ser_ref;
23197         ser_ref.datalen = ser->arr_len;
23198         ser_ref.data = ser->elems;
23199         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23200         *ret_conv = APIError_read(ser_ref);
23201         FREE(ser);
23202         return tag_ptr(ret_conv, true);
23203 }
23204
23205 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
23206         LDKBigSize this_obj_conv;
23207         this_obj_conv.inner = untag_ptr(this_obj);
23208         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23210         BigSize_free(this_obj_conv);
23211 }
23212
23213 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
23214         LDKBigSize this_ptr_conv;
23215         this_ptr_conv.inner = untag_ptr(this_ptr);
23216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23218         this_ptr_conv.is_owned = false;
23219         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
23220         return ret_conv;
23221 }
23222
23223 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
23224         LDKBigSize this_ptr_conv;
23225         this_ptr_conv.inner = untag_ptr(this_ptr);
23226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23228         this_ptr_conv.is_owned = false;
23229         BigSize_set_a(&this_ptr_conv, val);
23230 }
23231
23232 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
23233         LDKBigSize ret_var = BigSize_new(a_arg);
23234         uint64_t ret_ref = 0;
23235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23237         return ret_ref;
23238 }
23239
23240 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
23241         LDKHostname this_obj_conv;
23242         this_obj_conv.inner = untag_ptr(this_obj);
23243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23245         Hostname_free(this_obj_conv);
23246 }
23247
23248 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
23249         LDKHostname ret_var = Hostname_clone(arg);
23250         uint64_t ret_ref = 0;
23251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23253         return ret_ref;
23254 }
23255 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
23256         LDKHostname arg_conv;
23257         arg_conv.inner = untag_ptr(arg);
23258         arg_conv.is_owned = ptr_is_owned(arg);
23259         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23260         arg_conv.is_owned = false;
23261         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
23262         return ret_conv;
23263 }
23264
23265 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
23266         LDKHostname orig_conv;
23267         orig_conv.inner = untag_ptr(orig);
23268         orig_conv.is_owned = ptr_is_owned(orig);
23269         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23270         orig_conv.is_owned = false;
23271         LDKHostname ret_var = Hostname_clone(&orig_conv);
23272         uint64_t ret_ref = 0;
23273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23275         return ret_ref;
23276 }
23277
23278 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
23279         LDKHostname a_conv;
23280         a_conv.inner = untag_ptr(a);
23281         a_conv.is_owned = ptr_is_owned(a);
23282         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23283         a_conv.is_owned = false;
23284         LDKHostname b_conv;
23285         b_conv.inner = untag_ptr(b);
23286         b_conv.is_owned = ptr_is_owned(b);
23287         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23288         b_conv.is_owned = false;
23289         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
23290         return ret_conv;
23291 }
23292
23293 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
23294         LDKHostname this_arg_conv;
23295         this_arg_conv.inner = untag_ptr(this_arg);
23296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23298         this_arg_conv.is_owned = false;
23299         int8_t ret_conv = Hostname_len(&this_arg_conv);
23300         return ret_conv;
23301 }
23302
23303 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
23304         LDKu8slice msg_ref;
23305         msg_ref.datalen = msg->arr_len;
23306         msg_ref.data = msg->elems;
23307         uint8_t sk_arr[32];
23308         CHECK(sk->arr_len == 32);
23309         memcpy(sk_arr, sk->elems, 32); FREE(sk);
23310         uint8_t (*sk_ref)[32] = &sk_arr;
23311         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
23312         *ret_conv = sign(msg_ref, sk_ref);
23313         FREE(msg);
23314         return tag_ptr(ret_conv, true);
23315 }
23316
23317 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
23318         LDKu8slice msg_ref;
23319         msg_ref.datalen = msg->arr_len;
23320         msg_ref.data = msg->elems;
23321         LDKStr sig_conv = str_ref_to_owned_c(sig);
23322         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
23323         *ret_conv = recover_pk(msg_ref, sig_conv);
23324         FREE(msg);
23325         return tag_ptr(ret_conv, true);
23326 }
23327
23328 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
23329         LDKu8slice msg_ref;
23330         msg_ref.datalen = msg->arr_len;
23331         msg_ref.data = msg->elems;
23332         LDKStr sig_conv = str_ref_to_owned_c(sig);
23333         LDKPublicKey pk_ref;
23334         CHECK(pk->arr_len == 33);
23335         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
23336         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
23337         FREE(msg);
23338         return ret_conv;
23339 }
23340
23341 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
23342         LDKu8slice hrp_bytes_ref;
23343         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
23344         hrp_bytes_ref.data = hrp_bytes->elems;
23345         LDKCVec_U5Z data_without_signature_constr;
23346         data_without_signature_constr.datalen = data_without_signature->arr_len;
23347         if (data_without_signature_constr.datalen > 0)
23348                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
23349         else
23350                 data_without_signature_constr.data = NULL;
23351         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
23352         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
23353                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
23354                 
23355                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
23356         }
23357         FREE(data_without_signature);
23358         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
23359         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23360         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23361         CVec_u8Z_free(ret_var);
23362         FREE(hrp_bytes);
23363         return ret_arr;
23364 }
23365
23366 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
23367         if (!ptr_is_owned(this_ptr)) return;
23368         void* this_ptr_ptr = untag_ptr(this_ptr);
23369         CHECK_ACCESS(this_ptr_ptr);
23370         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
23371         FREE(untag_ptr(this_ptr));
23372         Persister_free(this_ptr_conv);
23373 }
23374
23375 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
23376         LDKPrintableString this_obj_conv;
23377         this_obj_conv.inner = untag_ptr(this_obj);
23378         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23380         PrintableString_free(this_obj_conv);
23381 }
23382
23383 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
23384         LDKPrintableString this_ptr_conv;
23385         this_ptr_conv.inner = untag_ptr(this_ptr);
23386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23388         this_ptr_conv.is_owned = false;
23389         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
23390         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23391         Str_free(ret_str);
23392         return ret_conv;
23393 }
23394
23395 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
23396         LDKPrintableString this_ptr_conv;
23397         this_ptr_conv.inner = untag_ptr(this_ptr);
23398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23400         this_ptr_conv.is_owned = false;
23401         LDKStr val_conv = str_ref_to_owned_c(val);
23402         PrintableString_set_a(&this_ptr_conv, val_conv);
23403 }
23404
23405 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
23406         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
23407         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
23408         uint64_t ret_ref = 0;
23409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23411         return ret_ref;
23412 }
23413
23414 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
23415         if (!ptr_is_owned(this_ptr)) return;
23416         void* this_ptr_ptr = untag_ptr(this_ptr);
23417         CHECK_ACCESS(this_ptr_ptr);
23418         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
23419         FREE(untag_ptr(this_ptr));
23420         FutureCallback_free(this_ptr_conv);
23421 }
23422
23423 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
23424         LDKFuture this_obj_conv;
23425         this_obj_conv.inner = untag_ptr(this_obj);
23426         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23428         Future_free(this_obj_conv);
23429 }
23430
23431 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
23432         LDKFuture this_arg_conv;
23433         this_arg_conv.inner = untag_ptr(this_arg);
23434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23436         this_arg_conv.is_owned = false;
23437         void* callback_ptr = untag_ptr(callback);
23438         CHECK_ACCESS(callback_ptr);
23439         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
23440         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
23441                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23442                 LDKFutureCallback_JCalls_cloned(&callback_conv);
23443         }
23444         Future_register_callback_fn(&this_arg_conv, callback_conv);
23445 }
23446
23447 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
23448         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
23449         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
23450         return ret_conv;
23451 }
23452
23453 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
23454         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
23455         return ret_conv;
23456 }
23457
23458 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
23459         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
23460         return ret_conv;
23461 }
23462
23463 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
23464         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
23465         return ret_conv;
23466 }
23467
23468 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
23469         uint32_t ret_conv = LDKLevel_to_js(Level_info());
23470         return ret_conv;
23471 }
23472
23473 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
23474         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
23475         return ret_conv;
23476 }
23477
23478 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
23479         uint32_t ret_conv = LDKLevel_to_js(Level_error());
23480         return ret_conv;
23481 }
23482
23483 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
23484         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
23485         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
23486         jboolean ret_conv = Level_eq(a_conv, b_conv);
23487         return ret_conv;
23488 }
23489
23490 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
23491         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
23492         int64_t ret_conv = Level_hash(o_conv);
23493         return ret_conv;
23494 }
23495
23496 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
23497         uint32_t ret_conv = LDKLevel_to_js(Level_max());
23498         return ret_conv;
23499 }
23500
23501 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
23502         LDKRecord this_obj_conv;
23503         this_obj_conv.inner = untag_ptr(this_obj);
23504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23506         Record_free(this_obj_conv);
23507 }
23508
23509 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
23510         LDKRecord this_ptr_conv;
23511         this_ptr_conv.inner = untag_ptr(this_ptr);
23512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23514         this_ptr_conv.is_owned = false;
23515         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
23516         return ret_conv;
23517 }
23518
23519 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
23520         LDKRecord this_ptr_conv;
23521         this_ptr_conv.inner = untag_ptr(this_ptr);
23522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23524         this_ptr_conv.is_owned = false;
23525         LDKLevel val_conv = LDKLevel_from_js(val);
23526         Record_set_level(&this_ptr_conv, val_conv);
23527 }
23528
23529 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
23530         LDKRecord this_ptr_conv;
23531         this_ptr_conv.inner = untag_ptr(this_ptr);
23532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23534         this_ptr_conv.is_owned = false;
23535         LDKStr ret_str = Record_get_args(&this_ptr_conv);
23536         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23537         Str_free(ret_str);
23538         return ret_conv;
23539 }
23540
23541 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
23542         LDKRecord this_ptr_conv;
23543         this_ptr_conv.inner = untag_ptr(this_ptr);
23544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23546         this_ptr_conv.is_owned = false;
23547         LDKStr val_conv = str_ref_to_owned_c(val);
23548         Record_set_args(&this_ptr_conv, val_conv);
23549 }
23550
23551 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
23552         LDKRecord this_ptr_conv;
23553         this_ptr_conv.inner = untag_ptr(this_ptr);
23554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23556         this_ptr_conv.is_owned = false;
23557         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23558         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23559         Str_free(ret_str);
23560         return ret_conv;
23561 }
23562
23563 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
23564         LDKRecord this_ptr_conv;
23565         this_ptr_conv.inner = untag_ptr(this_ptr);
23566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23568         this_ptr_conv.is_owned = false;
23569         LDKStr val_conv = str_ref_to_owned_c(val);
23570         Record_set_module_path(&this_ptr_conv, val_conv);
23571 }
23572
23573 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
23574         LDKRecord this_ptr_conv;
23575         this_ptr_conv.inner = untag_ptr(this_ptr);
23576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23578         this_ptr_conv.is_owned = false;
23579         LDKStr ret_str = Record_get_file(&this_ptr_conv);
23580         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23581         Str_free(ret_str);
23582         return ret_conv;
23583 }
23584
23585 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
23586         LDKRecord this_ptr_conv;
23587         this_ptr_conv.inner = untag_ptr(this_ptr);
23588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23590         this_ptr_conv.is_owned = false;
23591         LDKStr val_conv = str_ref_to_owned_c(val);
23592         Record_set_file(&this_ptr_conv, val_conv);
23593 }
23594
23595 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
23596         LDKRecord this_ptr_conv;
23597         this_ptr_conv.inner = untag_ptr(this_ptr);
23598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23600         this_ptr_conv.is_owned = false;
23601         int32_t ret_conv = Record_get_line(&this_ptr_conv);
23602         return ret_conv;
23603 }
23604
23605 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
23606         LDKRecord this_ptr_conv;
23607         this_ptr_conv.inner = untag_ptr(this_ptr);
23608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23610         this_ptr_conv.is_owned = false;
23611         Record_set_line(&this_ptr_conv, val);
23612 }
23613
23614 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23615         LDKRecord ret_var = Record_clone(arg);
23616         uint64_t ret_ref = 0;
23617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23619         return ret_ref;
23620 }
23621 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
23622         LDKRecord arg_conv;
23623         arg_conv.inner = untag_ptr(arg);
23624         arg_conv.is_owned = ptr_is_owned(arg);
23625         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23626         arg_conv.is_owned = false;
23627         int64_t ret_conv = Record_clone_ptr(&arg_conv);
23628         return ret_conv;
23629 }
23630
23631 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
23632         LDKRecord orig_conv;
23633         orig_conv.inner = untag_ptr(orig);
23634         orig_conv.is_owned = ptr_is_owned(orig);
23635         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23636         orig_conv.is_owned = false;
23637         LDKRecord ret_var = Record_clone(&orig_conv);
23638         uint64_t ret_ref = 0;
23639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23641         return ret_ref;
23642 }
23643
23644 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
23645         if (!ptr_is_owned(this_ptr)) return;
23646         void* this_ptr_ptr = untag_ptr(this_ptr);
23647         CHECK_ACCESS(this_ptr_ptr);
23648         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23649         FREE(untag_ptr(this_ptr));
23650         Logger_free(this_ptr_conv);
23651 }
23652
23653 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
23654         LDKChannelHandshakeConfig this_obj_conv;
23655         this_obj_conv.inner = untag_ptr(this_obj);
23656         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23658         ChannelHandshakeConfig_free(this_obj_conv);
23659 }
23660
23661 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
23662         LDKChannelHandshakeConfig this_ptr_conv;
23663         this_ptr_conv.inner = untag_ptr(this_ptr);
23664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23666         this_ptr_conv.is_owned = false;
23667         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23668         return ret_conv;
23669 }
23670
23671 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
23672         LDKChannelHandshakeConfig this_ptr_conv;
23673         this_ptr_conv.inner = untag_ptr(this_ptr);
23674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23676         this_ptr_conv.is_owned = false;
23677         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23678 }
23679
23680 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
23681         LDKChannelHandshakeConfig this_ptr_conv;
23682         this_ptr_conv.inner = untag_ptr(this_ptr);
23683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23685         this_ptr_conv.is_owned = false;
23686         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23687         return ret_conv;
23688 }
23689
23690 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) {
23691         LDKChannelHandshakeConfig this_ptr_conv;
23692         this_ptr_conv.inner = untag_ptr(this_ptr);
23693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23695         this_ptr_conv.is_owned = false;
23696         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23697 }
23698
23699 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
23700         LDKChannelHandshakeConfig this_ptr_conv;
23701         this_ptr_conv.inner = untag_ptr(this_ptr);
23702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23704         this_ptr_conv.is_owned = false;
23705         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23706         return ret_conv;
23707 }
23708
23709 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) {
23710         LDKChannelHandshakeConfig this_ptr_conv;
23711         this_ptr_conv.inner = untag_ptr(this_ptr);
23712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23714         this_ptr_conv.is_owned = false;
23715         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23716 }
23717
23718 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) {
23719         LDKChannelHandshakeConfig this_ptr_conv;
23720         this_ptr_conv.inner = untag_ptr(this_ptr);
23721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23723         this_ptr_conv.is_owned = false;
23724         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
23725         return ret_conv;
23726 }
23727
23728 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) {
23729         LDKChannelHandshakeConfig this_ptr_conv;
23730         this_ptr_conv.inner = untag_ptr(this_ptr);
23731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23733         this_ptr_conv.is_owned = false;
23734         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
23735 }
23736
23737 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
23738         LDKChannelHandshakeConfig this_ptr_conv;
23739         this_ptr_conv.inner = untag_ptr(this_ptr);
23740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23742         this_ptr_conv.is_owned = false;
23743         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
23744         return ret_conv;
23745 }
23746
23747 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
23748         LDKChannelHandshakeConfig this_ptr_conv;
23749         this_ptr_conv.inner = untag_ptr(this_ptr);
23750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23752         this_ptr_conv.is_owned = false;
23753         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
23754 }
23755
23756 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
23757         LDKChannelHandshakeConfig this_ptr_conv;
23758         this_ptr_conv.inner = untag_ptr(this_ptr);
23759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23761         this_ptr_conv.is_owned = false;
23762         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
23763         return ret_conv;
23764 }
23765
23766 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
23767         LDKChannelHandshakeConfig this_ptr_conv;
23768         this_ptr_conv.inner = untag_ptr(this_ptr);
23769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23771         this_ptr_conv.is_owned = false;
23772         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
23773 }
23774
23775 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
23776         LDKChannelHandshakeConfig this_ptr_conv;
23777         this_ptr_conv.inner = untag_ptr(this_ptr);
23778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23780         this_ptr_conv.is_owned = false;
23781         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
23782         return ret_conv;
23783 }
23784
23785 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
23786         LDKChannelHandshakeConfig this_ptr_conv;
23787         this_ptr_conv.inner = untag_ptr(this_ptr);
23788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23790         this_ptr_conv.is_owned = false;
23791         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
23792 }
23793
23794 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) {
23795         LDKChannelHandshakeConfig this_ptr_conv;
23796         this_ptr_conv.inner = untag_ptr(this_ptr);
23797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23799         this_ptr_conv.is_owned = false;
23800         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
23801         return ret_conv;
23802 }
23803
23804 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) {
23805         LDKChannelHandshakeConfig this_ptr_conv;
23806         this_ptr_conv.inner = untag_ptr(this_ptr);
23807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23809         this_ptr_conv.is_owned = false;
23810         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
23811 }
23812
23813 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) {
23814         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);
23815         uint64_t ret_ref = 0;
23816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23818         return ret_ref;
23819 }
23820
23821 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23822         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23823         uint64_t ret_ref = 0;
23824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23826         return ret_ref;
23827 }
23828 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
23829         LDKChannelHandshakeConfig arg_conv;
23830         arg_conv.inner = untag_ptr(arg);
23831         arg_conv.is_owned = ptr_is_owned(arg);
23832         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23833         arg_conv.is_owned = false;
23834         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23835         return ret_conv;
23836 }
23837
23838 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
23839         LDKChannelHandshakeConfig orig_conv;
23840         orig_conv.inner = untag_ptr(orig);
23841         orig_conv.is_owned = ptr_is_owned(orig);
23842         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23843         orig_conv.is_owned = false;
23844         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23845         uint64_t ret_ref = 0;
23846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23848         return ret_ref;
23849 }
23850
23851 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
23852         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23853         uint64_t ret_ref = 0;
23854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23856         return ret_ref;
23857 }
23858
23859 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
23860         LDKChannelHandshakeLimits this_obj_conv;
23861         this_obj_conv.inner = untag_ptr(this_obj);
23862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23864         ChannelHandshakeLimits_free(this_obj_conv);
23865 }
23866
23867 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
23868         LDKChannelHandshakeLimits this_ptr_conv;
23869         this_ptr_conv.inner = untag_ptr(this_ptr);
23870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23872         this_ptr_conv.is_owned = false;
23873         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23874         return ret_conv;
23875 }
23876
23877 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
23878         LDKChannelHandshakeLimits this_ptr_conv;
23879         this_ptr_conv.inner = untag_ptr(this_ptr);
23880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23882         this_ptr_conv.is_owned = false;
23883         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23884 }
23885
23886 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
23887         LDKChannelHandshakeLimits this_ptr_conv;
23888         this_ptr_conv.inner = untag_ptr(this_ptr);
23889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23891         this_ptr_conv.is_owned = false;
23892         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
23893         return ret_conv;
23894 }
23895
23896 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
23897         LDKChannelHandshakeLimits this_ptr_conv;
23898         this_ptr_conv.inner = untag_ptr(this_ptr);
23899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23901         this_ptr_conv.is_owned = false;
23902         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
23903 }
23904
23905 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
23906         LDKChannelHandshakeLimits this_ptr_conv;
23907         this_ptr_conv.inner = untag_ptr(this_ptr);
23908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23910         this_ptr_conv.is_owned = false;
23911         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23912         return ret_conv;
23913 }
23914
23915 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) {
23916         LDKChannelHandshakeLimits this_ptr_conv;
23917         this_ptr_conv.inner = untag_ptr(this_ptr);
23918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23920         this_ptr_conv.is_owned = false;
23921         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23922 }
23923
23924 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) {
23925         LDKChannelHandshakeLimits this_ptr_conv;
23926         this_ptr_conv.inner = untag_ptr(this_ptr);
23927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23929         this_ptr_conv.is_owned = false;
23930         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23931         return ret_conv;
23932 }
23933
23934 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) {
23935         LDKChannelHandshakeLimits this_ptr_conv;
23936         this_ptr_conv.inner = untag_ptr(this_ptr);
23937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23939         this_ptr_conv.is_owned = false;
23940         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23941 }
23942
23943 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
23944         LDKChannelHandshakeLimits this_ptr_conv;
23945         this_ptr_conv.inner = untag_ptr(this_ptr);
23946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23948         this_ptr_conv.is_owned = false;
23949         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
23950         return ret_conv;
23951 }
23952
23953 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) {
23954         LDKChannelHandshakeLimits this_ptr_conv;
23955         this_ptr_conv.inner = untag_ptr(this_ptr);
23956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23958         this_ptr_conv.is_owned = false;
23959         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
23960 }
23961
23962 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
23963         LDKChannelHandshakeLimits this_ptr_conv;
23964         this_ptr_conv.inner = untag_ptr(this_ptr);
23965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23967         this_ptr_conv.is_owned = false;
23968         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
23969         return ret_conv;
23970 }
23971
23972 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) {
23973         LDKChannelHandshakeLimits this_ptr_conv;
23974         this_ptr_conv.inner = untag_ptr(this_ptr);
23975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23977         this_ptr_conv.is_owned = false;
23978         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
23979 }
23980
23981 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
23982         LDKChannelHandshakeLimits this_ptr_conv;
23983         this_ptr_conv.inner = untag_ptr(this_ptr);
23984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23986         this_ptr_conv.is_owned = false;
23987         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
23988         return ret_conv;
23989 }
23990
23991 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
23992         LDKChannelHandshakeLimits this_ptr_conv;
23993         this_ptr_conv.inner = untag_ptr(this_ptr);
23994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23996         this_ptr_conv.is_owned = false;
23997         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
23998 }
23999
24000 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
24001         LDKChannelHandshakeLimits this_ptr_conv;
24002         this_ptr_conv.inner = untag_ptr(this_ptr);
24003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24005         this_ptr_conv.is_owned = false;
24006         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
24007         return ret_conv;
24008 }
24009
24010 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
24011         LDKChannelHandshakeLimits this_ptr_conv;
24012         this_ptr_conv.inner = untag_ptr(this_ptr);
24013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24015         this_ptr_conv.is_owned = false;
24016         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
24017 }
24018
24019 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
24020         LDKChannelHandshakeLimits this_ptr_conv;
24021         this_ptr_conv.inner = untag_ptr(this_ptr);
24022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24024         this_ptr_conv.is_owned = false;
24025         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
24026         return ret_conv;
24027 }
24028
24029 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
24030         LDKChannelHandshakeLimits this_ptr_conv;
24031         this_ptr_conv.inner = untag_ptr(this_ptr);
24032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24034         this_ptr_conv.is_owned = false;
24035         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
24036 }
24037
24038 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
24039         LDKChannelHandshakeLimits this_ptr_conv;
24040         this_ptr_conv.inner = untag_ptr(this_ptr);
24041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24043         this_ptr_conv.is_owned = false;
24044         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
24045         return ret_conv;
24046 }
24047
24048 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) {
24049         LDKChannelHandshakeLimits this_ptr_conv;
24050         this_ptr_conv.inner = untag_ptr(this_ptr);
24051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24053         this_ptr_conv.is_owned = false;
24054         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
24055 }
24056
24057 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) {
24058         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);
24059         uint64_t ret_ref = 0;
24060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24062         return ret_ref;
24063 }
24064
24065 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
24066         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
24067         uint64_t ret_ref = 0;
24068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24070         return ret_ref;
24071 }
24072 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
24073         LDKChannelHandshakeLimits arg_conv;
24074         arg_conv.inner = untag_ptr(arg);
24075         arg_conv.is_owned = ptr_is_owned(arg);
24076         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24077         arg_conv.is_owned = false;
24078         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
24079         return ret_conv;
24080 }
24081
24082 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
24083         LDKChannelHandshakeLimits orig_conv;
24084         orig_conv.inner = untag_ptr(orig);
24085         orig_conv.is_owned = ptr_is_owned(orig);
24086         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24087         orig_conv.is_owned = false;
24088         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
24089         uint64_t ret_ref = 0;
24090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24092         return ret_ref;
24093 }
24094
24095 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
24096         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
24097         uint64_t ret_ref = 0;
24098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24100         return ret_ref;
24101 }
24102
24103 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
24104         LDKChannelConfig this_obj_conv;
24105         this_obj_conv.inner = untag_ptr(this_obj);
24106         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24108         ChannelConfig_free(this_obj_conv);
24109 }
24110
24111 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
24112         LDKChannelConfig this_ptr_conv;
24113         this_ptr_conv.inner = untag_ptr(this_ptr);
24114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24116         this_ptr_conv.is_owned = false;
24117         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
24118         return ret_conv;
24119 }
24120
24121 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) {
24122         LDKChannelConfig this_ptr_conv;
24123         this_ptr_conv.inner = untag_ptr(this_ptr);
24124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24126         this_ptr_conv.is_owned = false;
24127         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
24128 }
24129
24130 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
24131         LDKChannelConfig this_ptr_conv;
24132         this_ptr_conv.inner = untag_ptr(this_ptr);
24133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24135         this_ptr_conv.is_owned = false;
24136         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
24137         return ret_conv;
24138 }
24139
24140 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) {
24141         LDKChannelConfig this_ptr_conv;
24142         this_ptr_conv.inner = untag_ptr(this_ptr);
24143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24145         this_ptr_conv.is_owned = false;
24146         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
24147 }
24148
24149 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
24150         LDKChannelConfig this_ptr_conv;
24151         this_ptr_conv.inner = untag_ptr(this_ptr);
24152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24154         this_ptr_conv.is_owned = false;
24155         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
24156         return ret_conv;
24157 }
24158
24159 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
24160         LDKChannelConfig this_ptr_conv;
24161         this_ptr_conv.inner = untag_ptr(this_ptr);
24162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24164         this_ptr_conv.is_owned = false;
24165         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
24166 }
24167
24168 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) {
24169         LDKChannelConfig this_ptr_conv;
24170         this_ptr_conv.inner = untag_ptr(this_ptr);
24171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24173         this_ptr_conv.is_owned = false;
24174         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
24175         return ret_conv;
24176 }
24177
24178 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) {
24179         LDKChannelConfig this_ptr_conv;
24180         this_ptr_conv.inner = untag_ptr(this_ptr);
24181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24183         this_ptr_conv.is_owned = false;
24184         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
24185 }
24186
24187 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) {
24188         LDKChannelConfig this_ptr_conv;
24189         this_ptr_conv.inner = untag_ptr(this_ptr);
24190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24192         this_ptr_conv.is_owned = false;
24193         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
24194         return ret_conv;
24195 }
24196
24197 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) {
24198         LDKChannelConfig this_ptr_conv;
24199         this_ptr_conv.inner = untag_ptr(this_ptr);
24200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24202         this_ptr_conv.is_owned = false;
24203         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
24204 }
24205
24206 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) {
24207         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);
24208         uint64_t ret_ref = 0;
24209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24211         return ret_ref;
24212 }
24213
24214 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
24215         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
24216         uint64_t ret_ref = 0;
24217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24219         return ret_ref;
24220 }
24221 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
24222         LDKChannelConfig arg_conv;
24223         arg_conv.inner = untag_ptr(arg);
24224         arg_conv.is_owned = ptr_is_owned(arg);
24225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24226         arg_conv.is_owned = false;
24227         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
24228         return ret_conv;
24229 }
24230
24231 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
24232         LDKChannelConfig orig_conv;
24233         orig_conv.inner = untag_ptr(orig);
24234         orig_conv.is_owned = ptr_is_owned(orig);
24235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24236         orig_conv.is_owned = false;
24237         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
24238         uint64_t ret_ref = 0;
24239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24241         return ret_ref;
24242 }
24243
24244 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
24245         LDKChannelConfig a_conv;
24246         a_conv.inner = untag_ptr(a);
24247         a_conv.is_owned = ptr_is_owned(a);
24248         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24249         a_conv.is_owned = false;
24250         LDKChannelConfig b_conv;
24251         b_conv.inner = untag_ptr(b);
24252         b_conv.is_owned = ptr_is_owned(b);
24253         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24254         b_conv.is_owned = false;
24255         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
24256         return ret_conv;
24257 }
24258
24259 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
24260         LDKChannelConfig ret_var = ChannelConfig_default();
24261         uint64_t ret_ref = 0;
24262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24264         return ret_ref;
24265 }
24266
24267 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
24268         LDKChannelConfig obj_conv;
24269         obj_conv.inner = untag_ptr(obj);
24270         obj_conv.is_owned = ptr_is_owned(obj);
24271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24272         obj_conv.is_owned = false;
24273         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24274         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24275         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24276         CVec_u8Z_free(ret_var);
24277         return ret_arr;
24278 }
24279
24280 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
24281         LDKu8slice ser_ref;
24282         ser_ref.datalen = ser->arr_len;
24283         ser_ref.data = ser->elems;
24284         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24285         *ret_conv = ChannelConfig_read(ser_ref);
24286         FREE(ser);
24287         return tag_ptr(ret_conv, true);
24288 }
24289
24290 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
24291         LDKUserConfig this_obj_conv;
24292         this_obj_conv.inner = untag_ptr(this_obj);
24293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24295         UserConfig_free(this_obj_conv);
24296 }
24297
24298 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
24299         LDKUserConfig this_ptr_conv;
24300         this_ptr_conv.inner = untag_ptr(this_ptr);
24301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24303         this_ptr_conv.is_owned = false;
24304         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
24305         uint64_t ret_ref = 0;
24306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24308         return ret_ref;
24309 }
24310
24311 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
24312         LDKUserConfig this_ptr_conv;
24313         this_ptr_conv.inner = untag_ptr(this_ptr);
24314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24316         this_ptr_conv.is_owned = false;
24317         LDKChannelHandshakeConfig val_conv;
24318         val_conv.inner = untag_ptr(val);
24319         val_conv.is_owned = ptr_is_owned(val);
24320         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24321         val_conv = ChannelHandshakeConfig_clone(&val_conv);
24322         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
24323 }
24324
24325 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
24326         LDKUserConfig this_ptr_conv;
24327         this_ptr_conv.inner = untag_ptr(this_ptr);
24328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24330         this_ptr_conv.is_owned = false;
24331         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
24332         uint64_t ret_ref = 0;
24333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24335         return ret_ref;
24336 }
24337
24338 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
24339         LDKUserConfig this_ptr_conv;
24340         this_ptr_conv.inner = untag_ptr(this_ptr);
24341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24343         this_ptr_conv.is_owned = false;
24344         LDKChannelHandshakeLimits val_conv;
24345         val_conv.inner = untag_ptr(val);
24346         val_conv.is_owned = ptr_is_owned(val);
24347         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24348         val_conv = ChannelHandshakeLimits_clone(&val_conv);
24349         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
24350 }
24351
24352 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
24353         LDKUserConfig this_ptr_conv;
24354         this_ptr_conv.inner = untag_ptr(this_ptr);
24355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24357         this_ptr_conv.is_owned = false;
24358         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
24359         uint64_t ret_ref = 0;
24360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24362         return ret_ref;
24363 }
24364
24365 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
24366         LDKUserConfig this_ptr_conv;
24367         this_ptr_conv.inner = untag_ptr(this_ptr);
24368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24370         this_ptr_conv.is_owned = false;
24371         LDKChannelConfig val_conv;
24372         val_conv.inner = untag_ptr(val);
24373         val_conv.is_owned = ptr_is_owned(val);
24374         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24375         val_conv = ChannelConfig_clone(&val_conv);
24376         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
24377 }
24378
24379 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
24380         LDKUserConfig this_ptr_conv;
24381         this_ptr_conv.inner = untag_ptr(this_ptr);
24382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24384         this_ptr_conv.is_owned = false;
24385         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24386         return ret_conv;
24387 }
24388
24389 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) {
24390         LDKUserConfig this_ptr_conv;
24391         this_ptr_conv.inner = untag_ptr(this_ptr);
24392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24394         this_ptr_conv.is_owned = false;
24395         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24396 }
24397
24398 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
24399         LDKUserConfig this_ptr_conv;
24400         this_ptr_conv.inner = untag_ptr(this_ptr);
24401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24403         this_ptr_conv.is_owned = false;
24404         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24405         return ret_conv;
24406 }
24407
24408 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24409         LDKUserConfig this_ptr_conv;
24410         this_ptr_conv.inner = untag_ptr(this_ptr);
24411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24413         this_ptr_conv.is_owned = false;
24414         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24415 }
24416
24417 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
24418         LDKUserConfig this_ptr_conv;
24419         this_ptr_conv.inner = untag_ptr(this_ptr);
24420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24422         this_ptr_conv.is_owned = false;
24423         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24424         return ret_conv;
24425 }
24426
24427 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24428         LDKUserConfig this_ptr_conv;
24429         this_ptr_conv.inner = untag_ptr(this_ptr);
24430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24432         this_ptr_conv.is_owned = false;
24433         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24434 }
24435
24436 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
24437         LDKUserConfig this_ptr_conv;
24438         this_ptr_conv.inner = untag_ptr(this_ptr);
24439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24441         this_ptr_conv.is_owned = false;
24442         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
24443         return ret_conv;
24444 }
24445
24446 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
24447         LDKUserConfig this_ptr_conv;
24448         this_ptr_conv.inner = untag_ptr(this_ptr);
24449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24451         this_ptr_conv.is_owned = false;
24452         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
24453 }
24454
24455 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) {
24456         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
24457         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
24458         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
24459         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
24460         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
24461         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
24462         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
24463         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
24464         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
24465         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
24466         LDKChannelConfig channel_config_arg_conv;
24467         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
24468         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
24469         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
24470         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
24471         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);
24472         uint64_t ret_ref = 0;
24473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24475         return ret_ref;
24476 }
24477
24478 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24479         LDKUserConfig ret_var = UserConfig_clone(arg);
24480         uint64_t ret_ref = 0;
24481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24483         return ret_ref;
24484 }
24485 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
24486         LDKUserConfig arg_conv;
24487         arg_conv.inner = untag_ptr(arg);
24488         arg_conv.is_owned = ptr_is_owned(arg);
24489         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24490         arg_conv.is_owned = false;
24491         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
24492         return ret_conv;
24493 }
24494
24495 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
24496         LDKUserConfig orig_conv;
24497         orig_conv.inner = untag_ptr(orig);
24498         orig_conv.is_owned = ptr_is_owned(orig);
24499         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24500         orig_conv.is_owned = false;
24501         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24502         uint64_t ret_ref = 0;
24503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24505         return ret_ref;
24506 }
24507
24508 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
24509         LDKUserConfig ret_var = UserConfig_default();
24510         uint64_t ret_ref = 0;
24511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24513         return ret_ref;
24514 }
24515
24516 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
24517         LDKBestBlock this_obj_conv;
24518         this_obj_conv.inner = untag_ptr(this_obj);
24519         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24521         BestBlock_free(this_obj_conv);
24522 }
24523
24524 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24525         LDKBestBlock ret_var = BestBlock_clone(arg);
24526         uint64_t ret_ref = 0;
24527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24529         return ret_ref;
24530 }
24531 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
24532         LDKBestBlock arg_conv;
24533         arg_conv.inner = untag_ptr(arg);
24534         arg_conv.is_owned = ptr_is_owned(arg);
24535         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24536         arg_conv.is_owned = false;
24537         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
24538         return ret_conv;
24539 }
24540
24541 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
24542         LDKBestBlock orig_conv;
24543         orig_conv.inner = untag_ptr(orig);
24544         orig_conv.is_owned = ptr_is_owned(orig);
24545         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24546         orig_conv.is_owned = false;
24547         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24548         uint64_t ret_ref = 0;
24549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24551         return ret_ref;
24552 }
24553
24554 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
24555         LDKBestBlock a_conv;
24556         a_conv.inner = untag_ptr(a);
24557         a_conv.is_owned = ptr_is_owned(a);
24558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24559         a_conv.is_owned = false;
24560         LDKBestBlock b_conv;
24561         b_conv.inner = untag_ptr(b);
24562         b_conv.is_owned = ptr_is_owned(b);
24563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24564         b_conv.is_owned = false;
24565         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
24566         return ret_conv;
24567 }
24568
24569 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
24570         LDKNetwork network_conv = LDKNetwork_from_js(network);
24571         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
24572         uint64_t ret_ref = 0;
24573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24575         return ret_ref;
24576 }
24577
24578 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
24579         LDKThirtyTwoBytes block_hash_ref;
24580         CHECK(block_hash->arr_len == 32);
24581         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
24582         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24583         uint64_t ret_ref = 0;
24584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24586         return ret_ref;
24587 }
24588
24589 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
24590         LDKBestBlock this_arg_conv;
24591         this_arg_conv.inner = untag_ptr(this_arg);
24592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24594         this_arg_conv.is_owned = false;
24595         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24596         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
24597         return ret_arr;
24598 }
24599
24600 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
24601         LDKBestBlock this_arg_conv;
24602         this_arg_conv.inner = untag_ptr(this_arg);
24603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24605         this_arg_conv.is_owned = false;
24606         int32_t ret_conv = BestBlock_height(&this_arg_conv);
24607         return ret_conv;
24608 }
24609
24610 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
24611         if (!ptr_is_owned(this_ptr)) return;
24612         void* this_ptr_ptr = untag_ptr(this_ptr);
24613         CHECK_ACCESS(this_ptr_ptr);
24614         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24615         FREE(untag_ptr(this_ptr));
24616         Listen_free(this_ptr_conv);
24617 }
24618
24619 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
24620         if (!ptr_is_owned(this_ptr)) return;
24621         void* this_ptr_ptr = untag_ptr(this_ptr);
24622         CHECK_ACCESS(this_ptr_ptr);
24623         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24624         FREE(untag_ptr(this_ptr));
24625         Confirm_free(this_ptr_conv);
24626 }
24627
24628 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
24629         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
24630         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
24631         return ret_conv;
24632 }
24633
24634 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
24635         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
24636         return ret_conv;
24637 }
24638
24639 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
24640         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
24641         return ret_conv;
24642 }
24643
24644 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
24645         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
24646         return ret_conv;
24647 }
24648
24649 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
24650         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
24651         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
24652         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
24653         return ret_conv;
24654 }
24655
24656 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
24657         if (!ptr_is_owned(this_ptr)) return;
24658         void* this_ptr_ptr = untag_ptr(this_ptr);
24659         CHECK_ACCESS(this_ptr_ptr);
24660         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24661         FREE(untag_ptr(this_ptr));
24662         Watch_free(this_ptr_conv);
24663 }
24664
24665 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
24666         if (!ptr_is_owned(this_ptr)) return;
24667         void* this_ptr_ptr = untag_ptr(this_ptr);
24668         CHECK_ACCESS(this_ptr_ptr);
24669         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24670         FREE(untag_ptr(this_ptr));
24671         Filter_free(this_ptr_conv);
24672 }
24673
24674 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
24675         LDKWatchedOutput this_obj_conv;
24676         this_obj_conv.inner = untag_ptr(this_obj);
24677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24679         WatchedOutput_free(this_obj_conv);
24680 }
24681
24682 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
24683         LDKWatchedOutput this_ptr_conv;
24684         this_ptr_conv.inner = untag_ptr(this_ptr);
24685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24687         this_ptr_conv.is_owned = false;
24688         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24689         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
24690         return ret_arr;
24691 }
24692
24693 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
24694         LDKWatchedOutput this_ptr_conv;
24695         this_ptr_conv.inner = untag_ptr(this_ptr);
24696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24698         this_ptr_conv.is_owned = false;
24699         LDKThirtyTwoBytes val_ref;
24700         CHECK(val->arr_len == 32);
24701         memcpy(val_ref.data, val->elems, 32); FREE(val);
24702         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24703 }
24704
24705 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
24706         LDKWatchedOutput this_ptr_conv;
24707         this_ptr_conv.inner = untag_ptr(this_ptr);
24708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24710         this_ptr_conv.is_owned = false;
24711         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24712         uint64_t ret_ref = 0;
24713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24715         return ret_ref;
24716 }
24717
24718 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
24719         LDKWatchedOutput this_ptr_conv;
24720         this_ptr_conv.inner = untag_ptr(this_ptr);
24721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24723         this_ptr_conv.is_owned = false;
24724         LDKOutPoint val_conv;
24725         val_conv.inner = untag_ptr(val);
24726         val_conv.is_owned = ptr_is_owned(val);
24727         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24728         val_conv = OutPoint_clone(&val_conv);
24729         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24730 }
24731
24732 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
24733         LDKWatchedOutput this_ptr_conv;
24734         this_ptr_conv.inner = untag_ptr(this_ptr);
24735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24737         this_ptr_conv.is_owned = false;
24738         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24739         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24740         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24741         return ret_arr;
24742 }
24743
24744 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
24745         LDKWatchedOutput this_ptr_conv;
24746         this_ptr_conv.inner = untag_ptr(this_ptr);
24747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24749         this_ptr_conv.is_owned = false;
24750         LDKCVec_u8Z val_ref;
24751         val_ref.datalen = val->arr_len;
24752         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24753         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
24754         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24755 }
24756
24757 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) {
24758         LDKThirtyTwoBytes block_hash_arg_ref;
24759         CHECK(block_hash_arg->arr_len == 32);
24760         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
24761         LDKOutPoint outpoint_arg_conv;
24762         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24763         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24764         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24765         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24766         LDKCVec_u8Z script_pubkey_arg_ref;
24767         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
24768         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24769         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
24770         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24771         uint64_t ret_ref = 0;
24772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24774         return ret_ref;
24775 }
24776
24777 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24778         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
24779         uint64_t ret_ref = 0;
24780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24782         return ret_ref;
24783 }
24784 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
24785         LDKWatchedOutput arg_conv;
24786         arg_conv.inner = untag_ptr(arg);
24787         arg_conv.is_owned = ptr_is_owned(arg);
24788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24789         arg_conv.is_owned = false;
24790         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
24791         return ret_conv;
24792 }
24793
24794 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
24795         LDKWatchedOutput orig_conv;
24796         orig_conv.inner = untag_ptr(orig);
24797         orig_conv.is_owned = ptr_is_owned(orig);
24798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24799         orig_conv.is_owned = false;
24800         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24801         uint64_t ret_ref = 0;
24802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24804         return ret_ref;
24805 }
24806
24807 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
24808         LDKWatchedOutput a_conv;
24809         a_conv.inner = untag_ptr(a);
24810         a_conv.is_owned = ptr_is_owned(a);
24811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24812         a_conv.is_owned = false;
24813         LDKWatchedOutput b_conv;
24814         b_conv.inner = untag_ptr(b);
24815         b_conv.is_owned = ptr_is_owned(b);
24816         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24817         b_conv.is_owned = false;
24818         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
24819         return ret_conv;
24820 }
24821
24822 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
24823         LDKWatchedOutput o_conv;
24824         o_conv.inner = untag_ptr(o);
24825         o_conv.is_owned = ptr_is_owned(o);
24826         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24827         o_conv.is_owned = false;
24828         int64_t ret_conv = WatchedOutput_hash(&o_conv);
24829         return ret_conv;
24830 }
24831
24832 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
24833         if (!ptr_is_owned(this_ptr)) return;
24834         void* this_ptr_ptr = untag_ptr(this_ptr);
24835         CHECK_ACCESS(this_ptr_ptr);
24836         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24837         FREE(untag_ptr(this_ptr));
24838         BroadcasterInterface_free(this_ptr_conv);
24839 }
24840
24841 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
24842         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
24843         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
24844         return ret_conv;
24845 }
24846
24847 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
24848         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
24849         return ret_conv;
24850 }
24851
24852 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
24853         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
24854         return ret_conv;
24855 }
24856
24857 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
24858         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
24859         return ret_conv;
24860 }
24861
24862 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
24863         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
24864         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
24865         return ret_conv;
24866 }
24867
24868 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
24869         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
24870         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
24871         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
24872         return ret_conv;
24873 }
24874
24875 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
24876         if (!ptr_is_owned(this_ptr)) return;
24877         void* this_ptr_ptr = untag_ptr(this_ptr);
24878         CHECK_ACCESS(this_ptr_ptr);
24879         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24880         FREE(untag_ptr(this_ptr));
24881         FeeEstimator_free(this_ptr_conv);
24882 }
24883
24884 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
24885         LDKMonitorUpdateId this_obj_conv;
24886         this_obj_conv.inner = untag_ptr(this_obj);
24887         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24889         MonitorUpdateId_free(this_obj_conv);
24890 }
24891
24892 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24893         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24894         uint64_t ret_ref = 0;
24895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24897         return ret_ref;
24898 }
24899 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
24900         LDKMonitorUpdateId arg_conv;
24901         arg_conv.inner = untag_ptr(arg);
24902         arg_conv.is_owned = ptr_is_owned(arg);
24903         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24904         arg_conv.is_owned = false;
24905         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
24906         return ret_conv;
24907 }
24908
24909 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
24910         LDKMonitorUpdateId orig_conv;
24911         orig_conv.inner = untag_ptr(orig);
24912         orig_conv.is_owned = ptr_is_owned(orig);
24913         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24914         orig_conv.is_owned = false;
24915         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24916         uint64_t ret_ref = 0;
24917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24919         return ret_ref;
24920 }
24921
24922 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
24923         LDKMonitorUpdateId o_conv;
24924         o_conv.inner = untag_ptr(o);
24925         o_conv.is_owned = ptr_is_owned(o);
24926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24927         o_conv.is_owned = false;
24928         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
24929         return ret_conv;
24930 }
24931
24932 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
24933         LDKMonitorUpdateId a_conv;
24934         a_conv.inner = untag_ptr(a);
24935         a_conv.is_owned = ptr_is_owned(a);
24936         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24937         a_conv.is_owned = false;
24938         LDKMonitorUpdateId b_conv;
24939         b_conv.inner = untag_ptr(b);
24940         b_conv.is_owned = ptr_is_owned(b);
24941         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24942         b_conv.is_owned = false;
24943         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
24944         return ret_conv;
24945 }
24946
24947 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
24948         if (!ptr_is_owned(this_ptr)) return;
24949         void* this_ptr_ptr = untag_ptr(this_ptr);
24950         CHECK_ACCESS(this_ptr_ptr);
24951         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
24952         FREE(untag_ptr(this_ptr));
24953         Persist_free(this_ptr_conv);
24954 }
24955
24956 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
24957         LDKLockedChannelMonitor this_obj_conv;
24958         this_obj_conv.inner = untag_ptr(this_obj);
24959         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24961         LockedChannelMonitor_free(this_obj_conv);
24962 }
24963
24964 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
24965         LDKChainMonitor this_obj_conv;
24966         this_obj_conv.inner = untag_ptr(this_obj);
24967         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24969         ChainMonitor_free(this_obj_conv);
24970 }
24971
24972 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) {
24973         void* chain_source_ptr = untag_ptr(chain_source);
24974         CHECK_ACCESS(chain_source_ptr);
24975         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
24976         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
24977         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
24978                 // Manually implement clone for Java trait instances
24979                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
24980                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24981                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
24982                 }
24983         }
24984         void* broadcaster_ptr = untag_ptr(broadcaster);
24985         CHECK_ACCESS(broadcaster_ptr);
24986         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24987         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24988                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24989                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24990         }
24991         void* logger_ptr = untag_ptr(logger);
24992         CHECK_ACCESS(logger_ptr);
24993         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24994         if (logger_conv.free == LDKLogger_JCalls_free) {
24995                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24996                 LDKLogger_JCalls_cloned(&logger_conv);
24997         }
24998         void* feeest_ptr = untag_ptr(feeest);
24999         CHECK_ACCESS(feeest_ptr);
25000         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
25001         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
25002                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25003                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
25004         }
25005         void* persister_ptr = untag_ptr(persister);
25006         CHECK_ACCESS(persister_ptr);
25007         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
25008         if (persister_conv.free == LDKPersist_JCalls_free) {
25009                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25010                 LDKPersist_JCalls_cloned(&persister_conv);
25011         }
25012         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
25013         uint64_t ret_ref = 0;
25014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25016         return ret_ref;
25017 }
25018
25019 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
25020         LDKChainMonitor this_arg_conv;
25021         this_arg_conv.inner = untag_ptr(this_arg);
25022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25024         this_arg_conv.is_owned = false;
25025         LDKCVec_ChannelDetailsZ ignored_channels_constr;
25026         ignored_channels_constr.datalen = ignored_channels->arr_len;
25027         if (ignored_channels_constr.datalen > 0)
25028                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25029         else
25030                 ignored_channels_constr.data = NULL;
25031         uint64_t* ignored_channels_vals = ignored_channels->elems;
25032         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
25033                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
25034                 LDKChannelDetails ignored_channels_conv_16_conv;
25035                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
25036                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
25037                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
25038                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
25039                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
25040         }
25041         FREE(ignored_channels);
25042         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
25043         uint64_tArray ret_arr = NULL;
25044         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25045         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25046         for (size_t j = 0; j < ret_var.datalen; j++) {
25047                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25048                 *ret_conv_9_copy = ret_var.data[j];
25049                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25050                 ret_arr_ptr[j] = ret_conv_9_ref;
25051         }
25052         
25053         FREE(ret_var.data);
25054         return ret_arr;
25055 }
25056
25057 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
25058         LDKChainMonitor this_arg_conv;
25059         this_arg_conv.inner = untag_ptr(this_arg);
25060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25062         this_arg_conv.is_owned = false;
25063         LDKOutPoint funding_txo_conv;
25064         funding_txo_conv.inner = untag_ptr(funding_txo);
25065         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25066         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25067         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25068         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
25069         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
25070         return tag_ptr(ret_conv, true);
25071 }
25072
25073 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
25074         LDKChainMonitor this_arg_conv;
25075         this_arg_conv.inner = untag_ptr(this_arg);
25076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25078         this_arg_conv.is_owned = false;
25079         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
25080         uint64_tArray ret_arr = NULL;
25081         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25082         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25083         for (size_t k = 0; k < ret_var.datalen; k++) {
25084                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
25085                 uint64_t ret_conv_10_ref = 0;
25086                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
25087                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
25088                 ret_arr_ptr[k] = ret_conv_10_ref;
25089         }
25090         
25091         FREE(ret_var.data);
25092         return ret_arr;
25093 }
25094
25095 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
25096         LDKChainMonitor this_arg_conv;
25097         this_arg_conv.inner = untag_ptr(this_arg);
25098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25100         this_arg_conv.is_owned = false;
25101         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
25102         uint64_tArray ret_arr = NULL;
25103         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25104         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25105         for (size_t p = 0; p < ret_var.datalen; p++) {
25106                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
25107                 *ret_conv_41_conv = ret_var.data[p];
25108                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
25109         }
25110         
25111         FREE(ret_var.data);
25112         return ret_arr;
25113 }
25114
25115 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) {
25116         LDKChainMonitor this_arg_conv;
25117         this_arg_conv.inner = untag_ptr(this_arg);
25118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25120         this_arg_conv.is_owned = false;
25121         LDKOutPoint funding_txo_conv;
25122         funding_txo_conv.inner = untag_ptr(funding_txo);
25123         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25124         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25125         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25126         LDKMonitorUpdateId completed_update_id_conv;
25127         completed_update_id_conv.inner = untag_ptr(completed_update_id);
25128         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
25129         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
25130         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
25131         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25132         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
25133         return tag_ptr(ret_conv, true);
25134 }
25135
25136 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
25137         LDKChainMonitor this_arg_conv;
25138         this_arg_conv.inner = untag_ptr(this_arg);
25139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25141         this_arg_conv.is_owned = false;
25142         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25143         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
25144         return tag_ptr(ret_ret, true);
25145 }
25146
25147 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
25148         LDKChainMonitor this_arg_conv;
25149         this_arg_conv.inner = untag_ptr(this_arg);
25150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25152         this_arg_conv.is_owned = false;
25153         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25154         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
25155         return tag_ptr(ret_ret, true);
25156 }
25157
25158 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
25159         LDKChainMonitor this_arg_conv;
25160         this_arg_conv.inner = untag_ptr(this_arg);
25161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25163         this_arg_conv.is_owned = false;
25164         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
25165         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
25166         return tag_ptr(ret_ret, true);
25167 }
25168
25169 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
25170         LDKChainMonitor this_arg_conv;
25171         this_arg_conv.inner = untag_ptr(this_arg);
25172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25174         this_arg_conv.is_owned = false;
25175         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25176         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
25177         return tag_ptr(ret_ret, true);
25178 }
25179
25180 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
25181         LDKChannelMonitorUpdate this_obj_conv;
25182         this_obj_conv.inner = untag_ptr(this_obj);
25183         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25185         ChannelMonitorUpdate_free(this_obj_conv);
25186 }
25187
25188 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
25189         LDKChannelMonitorUpdate this_ptr_conv;
25190         this_ptr_conv.inner = untag_ptr(this_ptr);
25191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25193         this_ptr_conv.is_owned = false;
25194         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
25195         return ret_conv;
25196 }
25197
25198 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
25199         LDKChannelMonitorUpdate this_ptr_conv;
25200         this_ptr_conv.inner = untag_ptr(this_ptr);
25201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25203         this_ptr_conv.is_owned = false;
25204         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
25205 }
25206
25207 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
25208         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
25209         uint64_t ret_ref = 0;
25210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25212         return ret_ref;
25213 }
25214 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
25215         LDKChannelMonitorUpdate arg_conv;
25216         arg_conv.inner = untag_ptr(arg);
25217         arg_conv.is_owned = ptr_is_owned(arg);
25218         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25219         arg_conv.is_owned = false;
25220         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
25221         return ret_conv;
25222 }
25223
25224 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
25225         LDKChannelMonitorUpdate orig_conv;
25226         orig_conv.inner = untag_ptr(orig);
25227         orig_conv.is_owned = ptr_is_owned(orig);
25228         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25229         orig_conv.is_owned = false;
25230         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25231         uint64_t ret_ref = 0;
25232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25234         return ret_ref;
25235 }
25236
25237 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
25238         LDKChannelMonitorUpdate obj_conv;
25239         obj_conv.inner = untag_ptr(obj);
25240         obj_conv.is_owned = ptr_is_owned(obj);
25241         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25242         obj_conv.is_owned = false;
25243         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25244         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25245         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25246         CVec_u8Z_free(ret_var);
25247         return ret_arr;
25248 }
25249
25250 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
25251         LDKu8slice ser_ref;
25252         ser_ref.datalen = ser->arr_len;
25253         ser_ref.data = ser->elems;
25254         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25255         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25256         FREE(ser);
25257         return tag_ptr(ret_conv, true);
25258 }
25259
25260 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
25261         if (!ptr_is_owned(this_ptr)) return;
25262         void* this_ptr_ptr = untag_ptr(this_ptr);
25263         CHECK_ACCESS(this_ptr_ptr);
25264         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25265         FREE(untag_ptr(this_ptr));
25266         MonitorEvent_free(this_ptr_conv);
25267 }
25268
25269 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25270         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25271         *ret_copy = MonitorEvent_clone(arg);
25272         uint64_t ret_ref = tag_ptr(ret_copy, true);
25273         return ret_ref;
25274 }
25275 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
25276         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
25277         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
25278         return ret_conv;
25279 }
25280
25281 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
25282         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
25283         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25284         *ret_copy = MonitorEvent_clone(orig_conv);
25285         uint64_t ret_ref = tag_ptr(ret_copy, true);
25286         return ret_ref;
25287 }
25288
25289 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
25290         LDKHTLCUpdate a_conv;
25291         a_conv.inner = untag_ptr(a);
25292         a_conv.is_owned = ptr_is_owned(a);
25293         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25294         a_conv = HTLCUpdate_clone(&a_conv);
25295         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25296         *ret_copy = MonitorEvent_htlcevent(a_conv);
25297         uint64_t ret_ref = tag_ptr(ret_copy, true);
25298         return ret_ref;
25299 }
25300
25301 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
25302         LDKOutPoint a_conv;
25303         a_conv.inner = untag_ptr(a);
25304         a_conv.is_owned = ptr_is_owned(a);
25305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25306         a_conv = OutPoint_clone(&a_conv);
25307         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25308         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25309         uint64_t ret_ref = tag_ptr(ret_copy, true);
25310         return ret_ref;
25311 }
25312
25313 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
25314         LDKOutPoint funding_txo_conv;
25315         funding_txo_conv.inner = untag_ptr(funding_txo);
25316         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25317         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25318         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25319         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25320         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
25321         uint64_t ret_ref = tag_ptr(ret_copy, true);
25322         return ret_ref;
25323 }
25324
25325 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
25326         LDKOutPoint a_conv;
25327         a_conv.inner = untag_ptr(a);
25328         a_conv.is_owned = ptr_is_owned(a);
25329         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25330         a_conv = OutPoint_clone(&a_conv);
25331         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25332         *ret_copy = MonitorEvent_update_failed(a_conv);
25333         uint64_t ret_ref = tag_ptr(ret_copy, true);
25334         return ret_ref;
25335 }
25336
25337 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
25338         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
25339         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
25340         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
25341         return ret_conv;
25342 }
25343
25344 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
25345         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
25346         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25347         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25348         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25349         CVec_u8Z_free(ret_var);
25350         return ret_arr;
25351 }
25352
25353 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
25354         LDKu8slice ser_ref;
25355         ser_ref.datalen = ser->arr_len;
25356         ser_ref.data = ser->elems;
25357         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25358         *ret_conv = MonitorEvent_read(ser_ref);
25359         FREE(ser);
25360         return tag_ptr(ret_conv, true);
25361 }
25362
25363 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
25364         LDKHTLCUpdate this_obj_conv;
25365         this_obj_conv.inner = untag_ptr(this_obj);
25366         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25368         HTLCUpdate_free(this_obj_conv);
25369 }
25370
25371 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25372         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25373         uint64_t ret_ref = 0;
25374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25376         return ret_ref;
25377 }
25378 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
25379         LDKHTLCUpdate arg_conv;
25380         arg_conv.inner = untag_ptr(arg);
25381         arg_conv.is_owned = ptr_is_owned(arg);
25382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25383         arg_conv.is_owned = false;
25384         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
25385         return ret_conv;
25386 }
25387
25388 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
25389         LDKHTLCUpdate orig_conv;
25390         orig_conv.inner = untag_ptr(orig);
25391         orig_conv.is_owned = ptr_is_owned(orig);
25392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25393         orig_conv.is_owned = false;
25394         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25395         uint64_t ret_ref = 0;
25396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25398         return ret_ref;
25399 }
25400
25401 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
25402         LDKHTLCUpdate a_conv;
25403         a_conv.inner = untag_ptr(a);
25404         a_conv.is_owned = ptr_is_owned(a);
25405         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25406         a_conv.is_owned = false;
25407         LDKHTLCUpdate b_conv;
25408         b_conv.inner = untag_ptr(b);
25409         b_conv.is_owned = ptr_is_owned(b);
25410         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25411         b_conv.is_owned = false;
25412         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
25413         return ret_conv;
25414 }
25415
25416 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
25417         LDKHTLCUpdate obj_conv;
25418         obj_conv.inner = untag_ptr(obj);
25419         obj_conv.is_owned = ptr_is_owned(obj);
25420         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25421         obj_conv.is_owned = false;
25422         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25423         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25424         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25425         CVec_u8Z_free(ret_var);
25426         return ret_arr;
25427 }
25428
25429 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
25430         LDKu8slice ser_ref;
25431         ser_ref.datalen = ser->arr_len;
25432         ser_ref.data = ser->elems;
25433         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25434         *ret_conv = HTLCUpdate_read(ser_ref);
25435         FREE(ser);
25436         return tag_ptr(ret_conv, true);
25437 }
25438
25439 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
25440         if (!ptr_is_owned(this_ptr)) return;
25441         void* this_ptr_ptr = untag_ptr(this_ptr);
25442         CHECK_ACCESS(this_ptr_ptr);
25443         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25444         FREE(untag_ptr(this_ptr));
25445         Balance_free(this_ptr_conv);
25446 }
25447
25448 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25449         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25450         *ret_copy = Balance_clone(arg);
25451         uint64_t ret_ref = tag_ptr(ret_copy, true);
25452         return ret_ref;
25453 }
25454 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
25455         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
25456         int64_t ret_conv = Balance_clone_ptr(arg_conv);
25457         return ret_conv;
25458 }
25459
25460 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
25461         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
25462         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25463         *ret_copy = Balance_clone(orig_conv);
25464         uint64_t ret_ref = tag_ptr(ret_copy, true);
25465         return ret_ref;
25466 }
25467
25468 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
25469         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25470         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25471         uint64_t ret_ref = tag_ptr(ret_copy, true);
25472         return ret_ref;
25473 }
25474
25475 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
25476         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25477         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25478         uint64_t ret_ref = tag_ptr(ret_copy, true);
25479         return ret_ref;
25480 }
25481
25482 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
25483         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25484         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25485         uint64_t ret_ref = tag_ptr(ret_copy, true);
25486         return ret_ref;
25487 }
25488
25489 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) {
25490         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25491         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
25492         uint64_t ret_ref = tag_ptr(ret_copy, true);
25493         return ret_ref;
25494 }
25495
25496 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) {
25497         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25498         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
25499         uint64_t ret_ref = tag_ptr(ret_copy, true);
25500         return ret_ref;
25501 }
25502
25503 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
25504         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25505         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
25506         uint64_t ret_ref = tag_ptr(ret_copy, true);
25507         return ret_ref;
25508 }
25509
25510 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
25511         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
25512         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
25513         jboolean ret_conv = Balance_eq(a_conv, b_conv);
25514         return ret_conv;
25515 }
25516
25517 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
25518         LDKChannelMonitor this_obj_conv;
25519         this_obj_conv.inner = untag_ptr(this_obj);
25520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25522         ChannelMonitor_free(this_obj_conv);
25523 }
25524
25525 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25526         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25527         uint64_t ret_ref = 0;
25528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25530         return ret_ref;
25531 }
25532 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
25533         LDKChannelMonitor arg_conv;
25534         arg_conv.inner = untag_ptr(arg);
25535         arg_conv.is_owned = ptr_is_owned(arg);
25536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25537         arg_conv.is_owned = false;
25538         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
25539         return ret_conv;
25540 }
25541
25542 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
25543         LDKChannelMonitor orig_conv;
25544         orig_conv.inner = untag_ptr(orig);
25545         orig_conv.is_owned = ptr_is_owned(orig);
25546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25547         orig_conv.is_owned = false;
25548         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25549         uint64_t ret_ref = 0;
25550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25552         return ret_ref;
25553 }
25554
25555 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
25556         LDKChannelMonitor obj_conv;
25557         obj_conv.inner = untag_ptr(obj);
25558         obj_conv.is_owned = ptr_is_owned(obj);
25559         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25560         obj_conv.is_owned = false;
25561         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25562         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25563         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25564         CVec_u8Z_free(ret_var);
25565         return ret_arr;
25566 }
25567
25568 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) {
25569         LDKChannelMonitor this_arg_conv;
25570         this_arg_conv.inner = untag_ptr(this_arg);
25571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25573         this_arg_conv.is_owned = false;
25574         LDKChannelMonitorUpdate updates_conv;
25575         updates_conv.inner = untag_ptr(updates);
25576         updates_conv.is_owned = ptr_is_owned(updates);
25577         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25578         updates_conv.is_owned = false;
25579         void* broadcaster_ptr = untag_ptr(broadcaster);
25580         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
25581         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25582         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25583         CHECK_ACCESS(fee_estimator_ptr);
25584         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25585         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25586                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25587                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25588         }
25589         void* logger_ptr = untag_ptr(logger);
25590         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25591         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25592         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25593         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25594         return tag_ptr(ret_conv, true);
25595 }
25596
25597 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
25598         LDKChannelMonitor this_arg_conv;
25599         this_arg_conv.inner = untag_ptr(this_arg);
25600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25602         this_arg_conv.is_owned = false;
25603         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25604         return ret_conv;
25605 }
25606
25607 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
25608         LDKChannelMonitor this_arg_conv;
25609         this_arg_conv.inner = untag_ptr(this_arg);
25610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25612         this_arg_conv.is_owned = false;
25613         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25614         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25615         return tag_ptr(ret_conv, true);
25616 }
25617
25618 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
25619         LDKChannelMonitor this_arg_conv;
25620         this_arg_conv.inner = untag_ptr(this_arg);
25621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25623         this_arg_conv.is_owned = false;
25624         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25625         uint64_tArray ret_arr = NULL;
25626         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25627         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25628         for (size_t o = 0; o < ret_var.datalen; o++) {
25629                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25630                 *ret_conv_40_conv = ret_var.data[o];
25631                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
25632         }
25633         
25634         FREE(ret_var.data);
25635         return ret_arr;
25636 }
25637
25638 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
25639         LDKChannelMonitor this_arg_conv;
25640         this_arg_conv.inner = untag_ptr(this_arg);
25641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25643         this_arg_conv.is_owned = false;
25644         void* filter_ptr = untag_ptr(filter);
25645         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
25646         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25647         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25648 }
25649
25650 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) {
25651         LDKChannelMonitor this_arg_conv;
25652         this_arg_conv.inner = untag_ptr(this_arg);
25653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25655         this_arg_conv.is_owned = false;
25656         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25657         uint64_tArray ret_arr = NULL;
25658         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25659         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25660         for (size_t o = 0; o < ret_var.datalen; o++) {
25661                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25662                 *ret_conv_14_copy = ret_var.data[o];
25663                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
25664                 ret_arr_ptr[o] = ret_conv_14_ref;
25665         }
25666         
25667         FREE(ret_var.data);
25668         return ret_arr;
25669 }
25670
25671 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
25672         LDKChannelMonitor this_arg_conv;
25673         this_arg_conv.inner = untag_ptr(this_arg);
25674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25676         this_arg_conv.is_owned = false;
25677         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25678         uint64_tArray ret_arr = NULL;
25679         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25680         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25681         for (size_t h = 0; h < ret_var.datalen; h++) {
25682                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25683                 *ret_conv_7_copy = ret_var.data[h];
25684                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
25685                 ret_arr_ptr[h] = ret_conv_7_ref;
25686         }
25687         
25688         FREE(ret_var.data);
25689         return ret_arr;
25690 }
25691
25692 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
25693         LDKChannelMonitor this_arg_conv;
25694         this_arg_conv.inner = untag_ptr(this_arg);
25695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25697         this_arg_conv.is_owned = false;
25698         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25699         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
25700         return ret_arr;
25701 }
25702
25703 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) {
25704         LDKChannelMonitor this_arg_conv;
25705         this_arg_conv.inner = untag_ptr(this_arg);
25706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25708         this_arg_conv.is_owned = false;
25709         void* logger_ptr = untag_ptr(logger);
25710         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25711         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25712         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25713         ptrArray ret_arr = NULL;
25714         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
25715         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
25716         for (size_t m = 0; m < ret_var.datalen; m++) {
25717                 LDKTransaction ret_conv_12_var = ret_var.data[m];
25718                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
25719                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
25720                 Transaction_free(ret_conv_12_var);
25721                 ret_arr_ptr[m] = ret_conv_12_arr;
25722         }
25723         
25724         FREE(ret_var.data);
25725         return ret_arr;
25726 }
25727
25728 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) {
25729         LDKChannelMonitor this_arg_conv;
25730         this_arg_conv.inner = untag_ptr(this_arg);
25731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25733         this_arg_conv.is_owned = false;
25734         uint8_t header_arr[80];
25735         CHECK(header->arr_len == 80);
25736         memcpy(header_arr, header->elems, 80); FREE(header);
25737         uint8_t (*header_ref)[80] = &header_arr;
25738         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25739         txdata_constr.datalen = txdata->arr_len;
25740         if (txdata_constr.datalen > 0)
25741                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25742         else
25743                 txdata_constr.data = NULL;
25744         uint64_t* txdata_vals = txdata->elems;
25745         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25746                 uint64_t txdata_conv_28 = txdata_vals[c];
25747                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25748                 CHECK_ACCESS(txdata_conv_28_ptr);
25749                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25750                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25751                 txdata_constr.data[c] = txdata_conv_28_conv;
25752         }
25753         FREE(txdata);
25754         void* broadcaster_ptr = untag_ptr(broadcaster);
25755         CHECK_ACCESS(broadcaster_ptr);
25756         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25757         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25758                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25759                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25760         }
25761         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25762         CHECK_ACCESS(fee_estimator_ptr);
25763         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25764         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25765                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25766                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25767         }
25768         void* logger_ptr = untag_ptr(logger);
25769         CHECK_ACCESS(logger_ptr);
25770         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25771         if (logger_conv.free == LDKLogger_JCalls_free) {
25772                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25773                 LDKLogger_JCalls_cloned(&logger_conv);
25774         }
25775         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);
25776         uint64_tArray ret_arr = NULL;
25777         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25778         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25779         for (size_t n = 0; n < ret_var.datalen; n++) {
25780                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25781                 *ret_conv_39_conv = ret_var.data[n];
25782                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25783         }
25784         
25785         FREE(ret_var.data);
25786         return ret_arr;
25787 }
25788
25789 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) {
25790         LDKChannelMonitor this_arg_conv;
25791         this_arg_conv.inner = untag_ptr(this_arg);
25792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25794         this_arg_conv.is_owned = false;
25795         uint8_t header_arr[80];
25796         CHECK(header->arr_len == 80);
25797         memcpy(header_arr, header->elems, 80); FREE(header);
25798         uint8_t (*header_ref)[80] = &header_arr;
25799         void* broadcaster_ptr = untag_ptr(broadcaster);
25800         CHECK_ACCESS(broadcaster_ptr);
25801         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25802         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25803                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25804                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25805         }
25806         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25807         CHECK_ACCESS(fee_estimator_ptr);
25808         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25809         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25810                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25811                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25812         }
25813         void* logger_ptr = untag_ptr(logger);
25814         CHECK_ACCESS(logger_ptr);
25815         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25816         if (logger_conv.free == LDKLogger_JCalls_free) {
25817                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25818                 LDKLogger_JCalls_cloned(&logger_conv);
25819         }
25820         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25821 }
25822
25823 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) {
25824         LDKChannelMonitor this_arg_conv;
25825         this_arg_conv.inner = untag_ptr(this_arg);
25826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25828         this_arg_conv.is_owned = false;
25829         uint8_t header_arr[80];
25830         CHECK(header->arr_len == 80);
25831         memcpy(header_arr, header->elems, 80); FREE(header);
25832         uint8_t (*header_ref)[80] = &header_arr;
25833         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25834         txdata_constr.datalen = txdata->arr_len;
25835         if (txdata_constr.datalen > 0)
25836                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25837         else
25838                 txdata_constr.data = NULL;
25839         uint64_t* txdata_vals = txdata->elems;
25840         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25841                 uint64_t txdata_conv_28 = txdata_vals[c];
25842                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25843                 CHECK_ACCESS(txdata_conv_28_ptr);
25844                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25845                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25846                 txdata_constr.data[c] = txdata_conv_28_conv;
25847         }
25848         FREE(txdata);
25849         void* broadcaster_ptr = untag_ptr(broadcaster);
25850         CHECK_ACCESS(broadcaster_ptr);
25851         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25852         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25853                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25854                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25855         }
25856         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25857         CHECK_ACCESS(fee_estimator_ptr);
25858         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25859         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25860                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25861                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25862         }
25863         void* logger_ptr = untag_ptr(logger);
25864         CHECK_ACCESS(logger_ptr);
25865         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25866         if (logger_conv.free == LDKLogger_JCalls_free) {
25867                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25868                 LDKLogger_JCalls_cloned(&logger_conv);
25869         }
25870         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);
25871         uint64_tArray ret_arr = NULL;
25872         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25873         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25874         for (size_t n = 0; n < ret_var.datalen; n++) {
25875                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25876                 *ret_conv_39_conv = ret_var.data[n];
25877                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25878         }
25879         
25880         FREE(ret_var.data);
25881         return ret_arr;
25882 }
25883
25884 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) {
25885         LDKChannelMonitor this_arg_conv;
25886         this_arg_conv.inner = untag_ptr(this_arg);
25887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25889         this_arg_conv.is_owned = false;
25890         uint8_t txid_arr[32];
25891         CHECK(txid->arr_len == 32);
25892         memcpy(txid_arr, txid->elems, 32); FREE(txid);
25893         uint8_t (*txid_ref)[32] = &txid_arr;
25894         void* broadcaster_ptr = untag_ptr(broadcaster);
25895         CHECK_ACCESS(broadcaster_ptr);
25896         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25897         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25898                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25899                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25900         }
25901         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25902         CHECK_ACCESS(fee_estimator_ptr);
25903         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25904         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25905                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25906                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25907         }
25908         void* logger_ptr = untag_ptr(logger);
25909         CHECK_ACCESS(logger_ptr);
25910         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25911         if (logger_conv.free == LDKLogger_JCalls_free) {
25912                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25913                 LDKLogger_JCalls_cloned(&logger_conv);
25914         }
25915         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25916 }
25917
25918 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) {
25919         LDKChannelMonitor this_arg_conv;
25920         this_arg_conv.inner = untag_ptr(this_arg);
25921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25923         this_arg_conv.is_owned = false;
25924         uint8_t header_arr[80];
25925         CHECK(header->arr_len == 80);
25926         memcpy(header_arr, header->elems, 80); FREE(header);
25927         uint8_t (*header_ref)[80] = &header_arr;
25928         void* broadcaster_ptr = untag_ptr(broadcaster);
25929         CHECK_ACCESS(broadcaster_ptr);
25930         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25931         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25932                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25933                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25934         }
25935         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25936         CHECK_ACCESS(fee_estimator_ptr);
25937         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25938         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25939                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25940                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25941         }
25942         void* logger_ptr = untag_ptr(logger);
25943         CHECK_ACCESS(logger_ptr);
25944         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25945         if (logger_conv.free == LDKLogger_JCalls_free) {
25946                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25947                 LDKLogger_JCalls_cloned(&logger_conv);
25948         }
25949         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25950         uint64_tArray ret_arr = NULL;
25951         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25952         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25953         for (size_t n = 0; n < ret_var.datalen; n++) {
25954                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25955                 *ret_conv_39_conv = ret_var.data[n];
25956                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25957         }
25958         
25959         FREE(ret_var.data);
25960         return ret_arr;
25961 }
25962
25963 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
25964         LDKChannelMonitor this_arg_conv;
25965         this_arg_conv.inner = untag_ptr(this_arg);
25966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25968         this_arg_conv.is_owned = false;
25969         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
25970         uint64_tArray ret_arr = NULL;
25971         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25972         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25973         for (size_t z = 0; z < ret_var.datalen; z++) {
25974                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
25975                 *ret_conv_25_conv = ret_var.data[z];
25976                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
25977         }
25978         
25979         FREE(ret_var.data);
25980         return ret_arr;
25981 }
25982
25983 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
25984         LDKChannelMonitor 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         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
25990         uint64_t ret_ref = 0;
25991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25993         return ret_ref;
25994 }
25995
25996 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
25997         LDKChannelMonitor this_arg_conv;
25998         this_arg_conv.inner = untag_ptr(this_arg);
25999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26001         this_arg_conv.is_owned = false;
26002         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
26003         uint64_tArray ret_arr = NULL;
26004         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
26005         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
26006         for (size_t j = 0; j < ret_var.datalen; j++) {
26007                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26008                 *ret_conv_9_copy = ret_var.data[j];
26009                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
26010                 ret_arr_ptr[j] = ret_conv_9_ref;
26011         }
26012         
26013         FREE(ret_var.data);
26014         return ret_arr;
26015 }
26016
26017 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
26018         LDKu8slice ser_ref;
26019         ser_ref.datalen = ser->arr_len;
26020         ser_ref.data = ser->elems;
26021         void* arg_a_ptr = untag_ptr(arg_a);
26022         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
26023         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
26024         void* arg_b_ptr = untag_ptr(arg_b);
26025         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
26026         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
26027         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
26028         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
26029         FREE(ser);
26030         return tag_ptr(ret_conv, true);
26031 }
26032
26033 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
26034         LDKOutPoint this_obj_conv;
26035         this_obj_conv.inner = untag_ptr(this_obj);
26036         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26038         OutPoint_free(this_obj_conv);
26039 }
26040
26041 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
26042         LDKOutPoint this_ptr_conv;
26043         this_ptr_conv.inner = untag_ptr(this_ptr);
26044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26046         this_ptr_conv.is_owned = false;
26047         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26048         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
26049         return ret_arr;
26050 }
26051
26052 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
26053         LDKOutPoint 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         LDKThirtyTwoBytes val_ref;
26059         CHECK(val->arr_len == 32);
26060         memcpy(val_ref.data, val->elems, 32); FREE(val);
26061         OutPoint_set_txid(&this_ptr_conv, val_ref);
26062 }
26063
26064 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
26065         LDKOutPoint this_ptr_conv;
26066         this_ptr_conv.inner = untag_ptr(this_ptr);
26067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26069         this_ptr_conv.is_owned = false;
26070         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
26071         return ret_conv;
26072 }
26073
26074 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
26075         LDKOutPoint this_ptr_conv;
26076         this_ptr_conv.inner = untag_ptr(this_ptr);
26077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26079         this_ptr_conv.is_owned = false;
26080         OutPoint_set_index(&this_ptr_conv, val);
26081 }
26082
26083 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
26084         LDKThirtyTwoBytes txid_arg_ref;
26085         CHECK(txid_arg->arr_len == 32);
26086         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
26087         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
26088         uint64_t ret_ref = 0;
26089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26091         return ret_ref;
26092 }
26093
26094 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
26095         LDKOutPoint ret_var = OutPoint_clone(arg);
26096         uint64_t ret_ref = 0;
26097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26099         return ret_ref;
26100 }
26101 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
26102         LDKOutPoint arg_conv;
26103         arg_conv.inner = untag_ptr(arg);
26104         arg_conv.is_owned = ptr_is_owned(arg);
26105         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26106         arg_conv.is_owned = false;
26107         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
26108         return ret_conv;
26109 }
26110
26111 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
26112         LDKOutPoint orig_conv;
26113         orig_conv.inner = untag_ptr(orig);
26114         orig_conv.is_owned = ptr_is_owned(orig);
26115         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26116         orig_conv.is_owned = false;
26117         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
26118         uint64_t ret_ref = 0;
26119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26121         return ret_ref;
26122 }
26123
26124 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
26125         LDKOutPoint a_conv;
26126         a_conv.inner = untag_ptr(a);
26127         a_conv.is_owned = ptr_is_owned(a);
26128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26129         a_conv.is_owned = false;
26130         LDKOutPoint b_conv;
26131         b_conv.inner = untag_ptr(b);
26132         b_conv.is_owned = ptr_is_owned(b);
26133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26134         b_conv.is_owned = false;
26135         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
26136         return ret_conv;
26137 }
26138
26139 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
26140         LDKOutPoint o_conv;
26141         o_conv.inner = untag_ptr(o);
26142         o_conv.is_owned = ptr_is_owned(o);
26143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26144         o_conv.is_owned = false;
26145         int64_t ret_conv = OutPoint_hash(&o_conv);
26146         return ret_conv;
26147 }
26148
26149 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
26150         LDKOutPoint this_arg_conv;
26151         this_arg_conv.inner = untag_ptr(this_arg);
26152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26154         this_arg_conv.is_owned = false;
26155         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26156         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
26157         return ret_arr;
26158 }
26159
26160 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
26161         LDKOutPoint obj_conv;
26162         obj_conv.inner = untag_ptr(obj);
26163         obj_conv.is_owned = ptr_is_owned(obj);
26164         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26165         obj_conv.is_owned = false;
26166         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26167         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26168         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26169         CVec_u8Z_free(ret_var);
26170         return ret_arr;
26171 }
26172
26173 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
26174         LDKu8slice ser_ref;
26175         ser_ref.datalen = ser->arr_len;
26176         ser_ref.data = ser->elems;
26177         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
26178         *ret_conv = OutPoint_read(ser_ref);
26179         FREE(ser);
26180         return tag_ptr(ret_conv, true);
26181 }
26182
26183 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
26184         LDKDelayedPaymentOutputDescriptor this_obj_conv;
26185         this_obj_conv.inner = untag_ptr(this_obj);
26186         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26188         DelayedPaymentOutputDescriptor_free(this_obj_conv);
26189 }
26190
26191 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26192         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26193         this_ptr_conv.inner = untag_ptr(this_ptr);
26194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26196         this_ptr_conv.is_owned = false;
26197         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26198         uint64_t ret_ref = 0;
26199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26201         return ret_ref;
26202 }
26203
26204 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26205         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26206         this_ptr_conv.inner = untag_ptr(this_ptr);
26207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26209         this_ptr_conv.is_owned = false;
26210         LDKOutPoint val_conv;
26211         val_conv.inner = untag_ptr(val);
26212         val_conv.is_owned = ptr_is_owned(val);
26213         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26214         val_conv = OutPoint_clone(&val_conv);
26215         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26216 }
26217
26218 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
26219         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26220         this_ptr_conv.inner = untag_ptr(this_ptr);
26221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26223         this_ptr_conv.is_owned = false;
26224         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26225         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26226         return ret_arr;
26227 }
26228
26229 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
26230         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26231         this_ptr_conv.inner = untag_ptr(this_ptr);
26232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26234         this_ptr_conv.is_owned = false;
26235         LDKPublicKey val_ref;
26236         CHECK(val->arr_len == 33);
26237         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26238         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26239 }
26240
26241 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
26242         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26243         this_ptr_conv.inner = untag_ptr(this_ptr);
26244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26246         this_ptr_conv.is_owned = false;
26247         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26248         return ret_conv;
26249 }
26250
26251 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
26252         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26253         this_ptr_conv.inner = untag_ptr(this_ptr);
26254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26256         this_ptr_conv.is_owned = false;
26257         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26258 }
26259
26260 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26261         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26262         this_ptr_conv.inner = untag_ptr(this_ptr);
26263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26265         this_ptr_conv.is_owned = false;
26266         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26267         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
26268         return tag_ptr(ret_ref, true);
26269 }
26270
26271 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26272         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26273         this_ptr_conv.inner = untag_ptr(this_ptr);
26274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26276         this_ptr_conv.is_owned = false;
26277         void* val_ptr = untag_ptr(val);
26278         CHECK_ACCESS(val_ptr);
26279         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26280         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26281         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26282 }
26283
26284 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
26285         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26286         this_ptr_conv.inner = untag_ptr(this_ptr);
26287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26289         this_ptr_conv.is_owned = false;
26290         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26291         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
26292         return ret_arr;
26293 }
26294
26295 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
26296         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26297         this_ptr_conv.inner = untag_ptr(this_ptr);
26298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26300         this_ptr_conv.is_owned = false;
26301         LDKPublicKey val_ref;
26302         CHECK(val->arr_len == 33);
26303         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26304         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26305 }
26306
26307 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26308         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26309         this_ptr_conv.inner = untag_ptr(this_ptr);
26310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26312         this_ptr_conv.is_owned = false;
26313         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26314         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26315         return ret_arr;
26316 }
26317
26318 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26319         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26320         this_ptr_conv.inner = untag_ptr(this_ptr);
26321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26323         this_ptr_conv.is_owned = false;
26324         LDKThirtyTwoBytes val_ref;
26325         CHECK(val->arr_len == 32);
26326         memcpy(val_ref.data, val->elems, 32); FREE(val);
26327         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26328 }
26329
26330 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26331         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26332         this_ptr_conv.inner = untag_ptr(this_ptr);
26333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26335         this_ptr_conv.is_owned = false;
26336         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26337         return ret_conv;
26338 }
26339
26340 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26341         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26342         this_ptr_conv.inner = untag_ptr(this_ptr);
26343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26345         this_ptr_conv.is_owned = false;
26346         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26347 }
26348
26349 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) {
26350         LDKOutPoint outpoint_arg_conv;
26351         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26352         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26353         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26354         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26355         LDKPublicKey per_commitment_point_arg_ref;
26356         CHECK(per_commitment_point_arg->arr_len == 33);
26357         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
26358         void* output_arg_ptr = untag_ptr(output_arg);
26359         CHECK_ACCESS(output_arg_ptr);
26360         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26361         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26362         LDKPublicKey revocation_pubkey_arg_ref;
26363         CHECK(revocation_pubkey_arg->arr_len == 33);
26364         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
26365         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26366         CHECK(channel_keys_id_arg->arr_len == 32);
26367         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26368         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);
26369         uint64_t ret_ref = 0;
26370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26372         return ret_ref;
26373 }
26374
26375 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26376         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26377         uint64_t ret_ref = 0;
26378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26380         return ret_ref;
26381 }
26382 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26383         LDKDelayedPaymentOutputDescriptor arg_conv;
26384         arg_conv.inner = untag_ptr(arg);
26385         arg_conv.is_owned = ptr_is_owned(arg);
26386         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26387         arg_conv.is_owned = false;
26388         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26389         return ret_conv;
26390 }
26391
26392 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
26393         LDKDelayedPaymentOutputDescriptor orig_conv;
26394         orig_conv.inner = untag_ptr(orig);
26395         orig_conv.is_owned = ptr_is_owned(orig);
26396         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26397         orig_conv.is_owned = false;
26398         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26399         uint64_t ret_ref = 0;
26400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26402         return ret_ref;
26403 }
26404
26405 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26406         LDKDelayedPaymentOutputDescriptor a_conv;
26407         a_conv.inner = untag_ptr(a);
26408         a_conv.is_owned = ptr_is_owned(a);
26409         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26410         a_conv.is_owned = false;
26411         LDKDelayedPaymentOutputDescriptor b_conv;
26412         b_conv.inner = untag_ptr(b);
26413         b_conv.is_owned = ptr_is_owned(b);
26414         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26415         b_conv.is_owned = false;
26416         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26417         return ret_conv;
26418 }
26419
26420 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
26421         LDKDelayedPaymentOutputDescriptor obj_conv;
26422         obj_conv.inner = untag_ptr(obj);
26423         obj_conv.is_owned = ptr_is_owned(obj);
26424         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26425         obj_conv.is_owned = false;
26426         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26427         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26428         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26429         CVec_u8Z_free(ret_var);
26430         return ret_arr;
26431 }
26432
26433 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
26434         LDKu8slice ser_ref;
26435         ser_ref.datalen = ser->arr_len;
26436         ser_ref.data = ser->elems;
26437         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26438         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26439         FREE(ser);
26440         return tag_ptr(ret_conv, true);
26441 }
26442
26443 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
26444         LDKStaticPaymentOutputDescriptor this_obj_conv;
26445         this_obj_conv.inner = untag_ptr(this_obj);
26446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26448         StaticPaymentOutputDescriptor_free(this_obj_conv);
26449 }
26450
26451 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26452         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26453         this_ptr_conv.inner = untag_ptr(this_ptr);
26454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26456         this_ptr_conv.is_owned = false;
26457         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26458         uint64_t ret_ref = 0;
26459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26461         return ret_ref;
26462 }
26463
26464 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26465         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26466         this_ptr_conv.inner = untag_ptr(this_ptr);
26467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26469         this_ptr_conv.is_owned = false;
26470         LDKOutPoint val_conv;
26471         val_conv.inner = untag_ptr(val);
26472         val_conv.is_owned = ptr_is_owned(val);
26473         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26474         val_conv = OutPoint_clone(&val_conv);
26475         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26476 }
26477
26478 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26479         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26480         this_ptr_conv.inner = untag_ptr(this_ptr);
26481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26483         this_ptr_conv.is_owned = false;
26484         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26485         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
26486         return tag_ptr(ret_ref, true);
26487 }
26488
26489 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26490         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26491         this_ptr_conv.inner = untag_ptr(this_ptr);
26492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26494         this_ptr_conv.is_owned = false;
26495         void* val_ptr = untag_ptr(val);
26496         CHECK_ACCESS(val_ptr);
26497         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26498         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26499         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26500 }
26501
26502 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26503         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26504         this_ptr_conv.inner = untag_ptr(this_ptr);
26505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26507         this_ptr_conv.is_owned = false;
26508         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26509         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26510         return ret_arr;
26511 }
26512
26513 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26514         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26515         this_ptr_conv.inner = untag_ptr(this_ptr);
26516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26518         this_ptr_conv.is_owned = false;
26519         LDKThirtyTwoBytes val_ref;
26520         CHECK(val->arr_len == 32);
26521         memcpy(val_ref.data, val->elems, 32); FREE(val);
26522         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26523 }
26524
26525 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26526         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26527         this_ptr_conv.inner = untag_ptr(this_ptr);
26528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26530         this_ptr_conv.is_owned = false;
26531         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26532         return ret_conv;
26533 }
26534
26535 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26536         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26537         this_ptr_conv.inner = untag_ptr(this_ptr);
26538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26540         this_ptr_conv.is_owned = false;
26541         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26542 }
26543
26544 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) {
26545         LDKOutPoint outpoint_arg_conv;
26546         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26547         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26548         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26549         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26550         void* output_arg_ptr = untag_ptr(output_arg);
26551         CHECK_ACCESS(output_arg_ptr);
26552         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26553         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26554         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26555         CHECK(channel_keys_id_arg->arr_len == 32);
26556         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26557         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26558         uint64_t ret_ref = 0;
26559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26561         return ret_ref;
26562 }
26563
26564 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26565         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26566         uint64_t ret_ref = 0;
26567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26569         return ret_ref;
26570 }
26571 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26572         LDKStaticPaymentOutputDescriptor arg_conv;
26573         arg_conv.inner = untag_ptr(arg);
26574         arg_conv.is_owned = ptr_is_owned(arg);
26575         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26576         arg_conv.is_owned = false;
26577         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26578         return ret_conv;
26579 }
26580
26581 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
26582         LDKStaticPaymentOutputDescriptor orig_conv;
26583         orig_conv.inner = untag_ptr(orig);
26584         orig_conv.is_owned = ptr_is_owned(orig);
26585         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26586         orig_conv.is_owned = false;
26587         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26588         uint64_t ret_ref = 0;
26589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26591         return ret_ref;
26592 }
26593
26594 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26595         LDKStaticPaymentOutputDescriptor a_conv;
26596         a_conv.inner = untag_ptr(a);
26597         a_conv.is_owned = ptr_is_owned(a);
26598         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26599         a_conv.is_owned = false;
26600         LDKStaticPaymentOutputDescriptor b_conv;
26601         b_conv.inner = untag_ptr(b);
26602         b_conv.is_owned = ptr_is_owned(b);
26603         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26604         b_conv.is_owned = false;
26605         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26606         return ret_conv;
26607 }
26608
26609 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
26610         LDKStaticPaymentOutputDescriptor obj_conv;
26611         obj_conv.inner = untag_ptr(obj);
26612         obj_conv.is_owned = ptr_is_owned(obj);
26613         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26614         obj_conv.is_owned = false;
26615         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26616         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26617         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26618         CVec_u8Z_free(ret_var);
26619         return ret_arr;
26620 }
26621
26622 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
26623         LDKu8slice ser_ref;
26624         ser_ref.datalen = ser->arr_len;
26625         ser_ref.data = ser->elems;
26626         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26627         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26628         FREE(ser);
26629         return tag_ptr(ret_conv, true);
26630 }
26631
26632 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
26633         if (!ptr_is_owned(this_ptr)) return;
26634         void* this_ptr_ptr = untag_ptr(this_ptr);
26635         CHECK_ACCESS(this_ptr_ptr);
26636         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26637         FREE(untag_ptr(this_ptr));
26638         SpendableOutputDescriptor_free(this_ptr_conv);
26639 }
26640
26641 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26642         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26643         *ret_copy = SpendableOutputDescriptor_clone(arg);
26644         uint64_t ret_ref = tag_ptr(ret_copy, true);
26645         return ret_ref;
26646 }
26647 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
26648         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
26649         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
26650         return ret_conv;
26651 }
26652
26653 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
26654         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
26655         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26656         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26657         uint64_t ret_ref = tag_ptr(ret_copy, true);
26658         return ret_ref;
26659 }
26660
26661 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
26662         LDKOutPoint outpoint_conv;
26663         outpoint_conv.inner = untag_ptr(outpoint);
26664         outpoint_conv.is_owned = ptr_is_owned(outpoint);
26665         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26666         outpoint_conv = OutPoint_clone(&outpoint_conv);
26667         void* output_ptr = untag_ptr(output);
26668         CHECK_ACCESS(output_ptr);
26669         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26670         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
26671         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26672         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26673         uint64_t ret_ref = tag_ptr(ret_copy, true);
26674         return ret_ref;
26675 }
26676
26677 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
26678         LDKDelayedPaymentOutputDescriptor a_conv;
26679         a_conv.inner = untag_ptr(a);
26680         a_conv.is_owned = ptr_is_owned(a);
26681         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26682         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26683         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26684         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26685         uint64_t ret_ref = tag_ptr(ret_copy, true);
26686         return ret_ref;
26687 }
26688
26689 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
26690         LDKStaticPaymentOutputDescriptor a_conv;
26691         a_conv.inner = untag_ptr(a);
26692         a_conv.is_owned = ptr_is_owned(a);
26693         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26694         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26695         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26696         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26697         uint64_t ret_ref = tag_ptr(ret_copy, true);
26698         return ret_ref;
26699 }
26700
26701 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
26702         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
26703         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
26704         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
26705         return ret_conv;
26706 }
26707
26708 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
26709         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
26710         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26711         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26712         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26713         CVec_u8Z_free(ret_var);
26714         return ret_arr;
26715 }
26716
26717 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
26718         LDKu8slice ser_ref;
26719         ser_ref.datalen = ser->arr_len;
26720         ser_ref.data = ser->elems;
26721         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26722         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26723         FREE(ser);
26724         return tag_ptr(ret_conv, true);
26725 }
26726
26727 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
26728         if (!ptr_is_owned(this_ptr)) return;
26729         void* this_ptr_ptr = untag_ptr(this_ptr);
26730         CHECK_ACCESS(this_ptr_ptr);
26731         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
26732         FREE(untag_ptr(this_ptr));
26733         ChannelSigner_free(this_ptr_conv);
26734 }
26735
26736 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
26737         if (!ptr_is_owned(this_ptr)) return;
26738         void* this_ptr_ptr = untag_ptr(this_ptr);
26739         CHECK_ACCESS(this_ptr_ptr);
26740         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
26741         FREE(untag_ptr(this_ptr));
26742         EcdsaChannelSigner_free(this_ptr_conv);
26743 }
26744
26745 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
26746         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26747         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
26748         return tag_ptr(ret_ret, true);
26749 }
26750 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
26751         void* arg_ptr = untag_ptr(arg);
26752         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26753         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
26754         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
26755         return ret_conv;
26756 }
26757
26758 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
26759         void* orig_ptr = untag_ptr(orig);
26760         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
26761         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
26762         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26763         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
26764         return tag_ptr(ret_ret, true);
26765 }
26766
26767 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
26768         if (!ptr_is_owned(this_ptr)) return;
26769         void* this_ptr_ptr = untag_ptr(this_ptr);
26770         CHECK_ACCESS(this_ptr_ptr);
26771         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
26772         FREE(untag_ptr(this_ptr));
26773         WriteableEcdsaChannelSigner_free(this_ptr_conv);
26774 }
26775
26776 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
26777         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
26778         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
26779         return ret_conv;
26780 }
26781
26782 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
26783         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
26784         return ret_conv;
26785 }
26786
26787 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
26788         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
26789         return ret_conv;
26790 }
26791
26792 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
26793         if (!ptr_is_owned(this_ptr)) return;
26794         void* this_ptr_ptr = untag_ptr(this_ptr);
26795         CHECK_ACCESS(this_ptr_ptr);
26796         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
26797         FREE(untag_ptr(this_ptr));
26798         EntropySource_free(this_ptr_conv);
26799 }
26800
26801 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
26802         if (!ptr_is_owned(this_ptr)) return;
26803         void* this_ptr_ptr = untag_ptr(this_ptr);
26804         CHECK_ACCESS(this_ptr_ptr);
26805         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
26806         FREE(untag_ptr(this_ptr));
26807         NodeSigner_free(this_ptr_conv);
26808 }
26809
26810 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
26811         if (!ptr_is_owned(this_ptr)) return;
26812         void* this_ptr_ptr = untag_ptr(this_ptr);
26813         CHECK_ACCESS(this_ptr_ptr);
26814         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
26815         FREE(untag_ptr(this_ptr));
26816         SignerProvider_free(this_ptr_conv);
26817 }
26818
26819 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
26820         LDKInMemorySigner this_obj_conv;
26821         this_obj_conv.inner = untag_ptr(this_obj);
26822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26824         InMemorySigner_free(this_obj_conv);
26825 }
26826
26827 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
26828         LDKInMemorySigner this_ptr_conv;
26829         this_ptr_conv.inner = untag_ptr(this_ptr);
26830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26832         this_ptr_conv.is_owned = false;
26833         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26834         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
26835         return ret_arr;
26836 }
26837
26838 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
26839         LDKInMemorySigner this_ptr_conv;
26840         this_ptr_conv.inner = untag_ptr(this_ptr);
26841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26843         this_ptr_conv.is_owned = false;
26844         LDKSecretKey val_ref;
26845         CHECK(val->arr_len == 32);
26846         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26847         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26848 }
26849
26850 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
26851         LDKInMemorySigner this_ptr_conv;
26852         this_ptr_conv.inner = untag_ptr(this_ptr);
26853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26855         this_ptr_conv.is_owned = false;
26856         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26857         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
26858         return ret_arr;
26859 }
26860
26861 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
26862         LDKInMemorySigner this_ptr_conv;
26863         this_ptr_conv.inner = untag_ptr(this_ptr);
26864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26866         this_ptr_conv.is_owned = false;
26867         LDKSecretKey val_ref;
26868         CHECK(val->arr_len == 32);
26869         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26870         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26871 }
26872
26873 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
26874         LDKInMemorySigner this_ptr_conv;
26875         this_ptr_conv.inner = untag_ptr(this_ptr);
26876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26878         this_ptr_conv.is_owned = false;
26879         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26880         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
26881         return ret_arr;
26882 }
26883
26884 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
26885         LDKInMemorySigner this_ptr_conv;
26886         this_ptr_conv.inner = untag_ptr(this_ptr);
26887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26889         this_ptr_conv.is_owned = false;
26890         LDKSecretKey val_ref;
26891         CHECK(val->arr_len == 32);
26892         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26893         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26894 }
26895
26896 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
26897         LDKInMemorySigner this_ptr_conv;
26898         this_ptr_conv.inner = untag_ptr(this_ptr);
26899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26901         this_ptr_conv.is_owned = false;
26902         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26903         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
26904         return ret_arr;
26905 }
26906
26907 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) {
26908         LDKInMemorySigner this_ptr_conv;
26909         this_ptr_conv.inner = untag_ptr(this_ptr);
26910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26912         this_ptr_conv.is_owned = false;
26913         LDKSecretKey val_ref;
26914         CHECK(val->arr_len == 32);
26915         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26916         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26917 }
26918
26919 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
26920         LDKInMemorySigner this_ptr_conv;
26921         this_ptr_conv.inner = untag_ptr(this_ptr);
26922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26924         this_ptr_conv.is_owned = false;
26925         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26926         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
26927         return ret_arr;
26928 }
26929
26930 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
26931         LDKInMemorySigner this_ptr_conv;
26932         this_ptr_conv.inner = untag_ptr(this_ptr);
26933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26935         this_ptr_conv.is_owned = false;
26936         LDKSecretKey val_ref;
26937         CHECK(val->arr_len == 32);
26938         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26939         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26940 }
26941
26942 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
26943         LDKInMemorySigner this_ptr_conv;
26944         this_ptr_conv.inner = untag_ptr(this_ptr);
26945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26947         this_ptr_conv.is_owned = false;
26948         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26949         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
26950         return ret_arr;
26951 }
26952
26953 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
26954         LDKInMemorySigner this_ptr_conv;
26955         this_ptr_conv.inner = untag_ptr(this_ptr);
26956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26958         this_ptr_conv.is_owned = false;
26959         LDKThirtyTwoBytes val_ref;
26960         CHECK(val->arr_len == 32);
26961         memcpy(val_ref.data, val->elems, 32); FREE(val);
26962         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26963 }
26964
26965 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26966         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26967         uint64_t ret_ref = 0;
26968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26970         return ret_ref;
26971 }
26972 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
26973         LDKInMemorySigner arg_conv;
26974         arg_conv.inner = untag_ptr(arg);
26975         arg_conv.is_owned = ptr_is_owned(arg);
26976         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26977         arg_conv.is_owned = false;
26978         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
26979         return ret_conv;
26980 }
26981
26982 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
26983         LDKInMemorySigner orig_conv;
26984         orig_conv.inner = untag_ptr(orig);
26985         orig_conv.is_owned = ptr_is_owned(orig);
26986         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26987         orig_conv.is_owned = false;
26988         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26989         uint64_t ret_ref = 0;
26990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26992         return ret_ref;
26993 }
26994
26995 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) {
26996         LDKSecretKey funding_key_ref;
26997         CHECK(funding_key->arr_len == 32);
26998         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
26999         LDKSecretKey revocation_base_key_ref;
27000         CHECK(revocation_base_key->arr_len == 32);
27001         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
27002         LDKSecretKey payment_key_ref;
27003         CHECK(payment_key->arr_len == 32);
27004         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
27005         LDKSecretKey delayed_payment_base_key_ref;
27006         CHECK(delayed_payment_base_key->arr_len == 32);
27007         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
27008         LDKSecretKey htlc_base_key_ref;
27009         CHECK(htlc_base_key->arr_len == 32);
27010         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
27011         LDKThirtyTwoBytes commitment_seed_ref;
27012         CHECK(commitment_seed->arr_len == 32);
27013         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
27014         LDKThirtyTwoBytes channel_keys_id_ref;
27015         CHECK(channel_keys_id->arr_len == 32);
27016         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
27017         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);
27018         uint64_t ret_ref = 0;
27019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27021         return ret_ref;
27022 }
27023
27024 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
27025         LDKInMemorySigner this_arg_conv;
27026         this_arg_conv.inner = untag_ptr(this_arg);
27027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27029         this_arg_conv.is_owned = false;
27030         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
27031         uint64_t ret_ref = 0;
27032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27034         return ret_ref;
27035 }
27036
27037 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
27038         LDKInMemorySigner this_arg_conv;
27039         this_arg_conv.inner = untag_ptr(this_arg);
27040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27042         this_arg_conv.is_owned = false;
27043         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
27044         return ret_conv;
27045 }
27046
27047 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
27048         LDKInMemorySigner this_arg_conv;
27049         this_arg_conv.inner = untag_ptr(this_arg);
27050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27052         this_arg_conv.is_owned = false;
27053         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
27054         return ret_conv;
27055 }
27056
27057 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
27058         LDKInMemorySigner this_arg_conv;
27059         this_arg_conv.inner = untag_ptr(this_arg);
27060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27062         this_arg_conv.is_owned = false;
27063         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
27064         return ret_conv;
27065 }
27066
27067 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
27068         LDKInMemorySigner this_arg_conv;
27069         this_arg_conv.inner = untag_ptr(this_arg);
27070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27072         this_arg_conv.is_owned = false;
27073         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
27074         uint64_t ret_ref = 0;
27075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27077         return ret_ref;
27078 }
27079
27080 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
27081         LDKInMemorySigner this_arg_conv;
27082         this_arg_conv.inner = untag_ptr(this_arg);
27083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27085         this_arg_conv.is_owned = false;
27086         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
27087         uint64_t ret_ref = 0;
27088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27090         return ret_ref;
27091 }
27092
27093 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
27094         LDKInMemorySigner this_arg_conv;
27095         this_arg_conv.inner = untag_ptr(this_arg);
27096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27098         this_arg_conv.is_owned = false;
27099         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
27100         return ret_conv;
27101 }
27102
27103 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) {
27104         LDKInMemorySigner this_arg_conv;
27105         this_arg_conv.inner = untag_ptr(this_arg);
27106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27108         this_arg_conv.is_owned = false;
27109         LDKTransaction spend_tx_ref;
27110         spend_tx_ref.datalen = spend_tx->arr_len;
27111         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27112         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
27113         spend_tx_ref.data_is_owned = true;
27114         LDKStaticPaymentOutputDescriptor descriptor_conv;
27115         descriptor_conv.inner = untag_ptr(descriptor);
27116         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27117         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27118         descriptor_conv.is_owned = false;
27119         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27120         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27121         return tag_ptr(ret_conv, true);
27122 }
27123
27124 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) {
27125         LDKInMemorySigner this_arg_conv;
27126         this_arg_conv.inner = untag_ptr(this_arg);
27127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27129         this_arg_conv.is_owned = false;
27130         LDKTransaction spend_tx_ref;
27131         spend_tx_ref.datalen = spend_tx->arr_len;
27132         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27133         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
27134         spend_tx_ref.data_is_owned = true;
27135         LDKDelayedPaymentOutputDescriptor descriptor_conv;
27136         descriptor_conv.inner = untag_ptr(descriptor);
27137         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27138         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27139         descriptor_conv.is_owned = false;
27140         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27141         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27142         return tag_ptr(ret_conv, true);
27143 }
27144
27145 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
27146         LDKInMemorySigner this_arg_conv;
27147         this_arg_conv.inner = untag_ptr(this_arg);
27148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27150         this_arg_conv.is_owned = false;
27151         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
27152         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
27153         return tag_ptr(ret_ret, true);
27154 }
27155
27156 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
27157         LDKInMemorySigner this_arg_conv;
27158         this_arg_conv.inner = untag_ptr(this_arg);
27159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27161         this_arg_conv.is_owned = false;
27162         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
27163         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
27164         return tag_ptr(ret_ret, true);
27165 }
27166
27167 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
27168         LDKInMemorySigner this_arg_conv;
27169         this_arg_conv.inner = untag_ptr(this_arg);
27170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27172         this_arg_conv.is_owned = false;
27173         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
27174         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
27175         return tag_ptr(ret_ret, true);
27176 }
27177
27178 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
27179         LDKInMemorySigner obj_conv;
27180         obj_conv.inner = untag_ptr(obj);
27181         obj_conv.is_owned = ptr_is_owned(obj);
27182         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27183         obj_conv.is_owned = false;
27184         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27185         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27186         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27187         CVec_u8Z_free(ret_var);
27188         return ret_arr;
27189 }
27190
27191 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser) {
27192         LDKu8slice ser_ref;
27193         ser_ref.datalen = ser->arr_len;
27194         ser_ref.data = ser->elems;
27195         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27196         *ret_conv = InMemorySigner_read(ser_ref);
27197         FREE(ser);
27198         return tag_ptr(ret_conv, true);
27199 }
27200
27201 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
27202         LDKKeysManager this_obj_conv;
27203         this_obj_conv.inner = untag_ptr(this_obj);
27204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27206         KeysManager_free(this_obj_conv);
27207 }
27208
27209 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
27210         uint8_t seed_arr[32];
27211         CHECK(seed->arr_len == 32);
27212         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27213         uint8_t (*seed_ref)[32] = &seed_arr;
27214         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27215         uint64_t ret_ref = 0;
27216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27218         return ret_ref;
27219 }
27220
27221 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
27222         LDKKeysManager this_arg_conv;
27223         this_arg_conv.inner = untag_ptr(this_arg);
27224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27226         this_arg_conv.is_owned = false;
27227         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27228         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27229         return ret_arr;
27230 }
27231
27232 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) {
27233         LDKKeysManager this_arg_conv;
27234         this_arg_conv.inner = untag_ptr(this_arg);
27235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27237         this_arg_conv.is_owned = false;
27238         uint8_t params_arr[32];
27239         CHECK(params->arr_len == 32);
27240         memcpy(params_arr, params->elems, 32); FREE(params);
27241         uint8_t (*params_ref)[32] = &params_arr;
27242         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27243         uint64_t ret_ref = 0;
27244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27246         return ret_ref;
27247 }
27248
27249 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) {
27250         LDKKeysManager this_arg_conv;
27251         this_arg_conv.inner = untag_ptr(this_arg);
27252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27254         this_arg_conv.is_owned = false;
27255         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27256         descriptors_constr.datalen = descriptors->arr_len;
27257         if (descriptors_constr.datalen > 0)
27258                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27259         else
27260                 descriptors_constr.data = NULL;
27261         uint64_t* descriptors_vals = descriptors->elems;
27262         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27263                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27264                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27265                 CHECK_ACCESS(descriptors_conv_27_ptr);
27266                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27267                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27268                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27269         }
27270         FREE(descriptors);
27271         LDKCVec_TxOutZ outputs_constr;
27272         outputs_constr.datalen = outputs->arr_len;
27273         if (outputs_constr.datalen > 0)
27274                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27275         else
27276                 outputs_constr.data = NULL;
27277         uint64_t* outputs_vals = outputs->elems;
27278         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27279                 uint64_t outputs_conv_7 = outputs_vals[h];
27280                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27281                 CHECK_ACCESS(outputs_conv_7_ptr);
27282                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27283                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27284                 outputs_constr.data[h] = outputs_conv_7_conv;
27285         }
27286         FREE(outputs);
27287         LDKCVec_u8Z change_destination_script_ref;
27288         change_destination_script_ref.datalen = change_destination_script->arr_len;
27289         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27290         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27291         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27292         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27293         return tag_ptr(ret_conv, true);
27294 }
27295
27296 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
27297         LDKKeysManager this_arg_conv;
27298         this_arg_conv.inner = untag_ptr(this_arg);
27299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27301         this_arg_conv.is_owned = false;
27302         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27303         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
27304         return tag_ptr(ret_ret, true);
27305 }
27306
27307 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
27308         LDKKeysManager this_arg_conv;
27309         this_arg_conv.inner = untag_ptr(this_arg);
27310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27312         this_arg_conv.is_owned = false;
27313         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27314         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
27315         return tag_ptr(ret_ret, true);
27316 }
27317
27318 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
27319         LDKKeysManager this_arg_conv;
27320         this_arg_conv.inner = untag_ptr(this_arg);
27321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27323         this_arg_conv.is_owned = false;
27324         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27325         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
27326         return tag_ptr(ret_ret, true);
27327 }
27328
27329 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
27330         LDKPhantomKeysManager this_obj_conv;
27331         this_obj_conv.inner = untag_ptr(this_obj);
27332         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27334         PhantomKeysManager_free(this_obj_conv);
27335 }
27336
27337 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
27338         LDKPhantomKeysManager this_arg_conv;
27339         this_arg_conv.inner = untag_ptr(this_arg);
27340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27342         this_arg_conv.is_owned = false;
27343         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27344         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
27345         return tag_ptr(ret_ret, true);
27346 }
27347
27348 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
27349         LDKPhantomKeysManager this_arg_conv;
27350         this_arg_conv.inner = untag_ptr(this_arg);
27351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27353         this_arg_conv.is_owned = false;
27354         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27355         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
27356         return tag_ptr(ret_ret, true);
27357 }
27358
27359 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
27360         LDKPhantomKeysManager this_arg_conv;
27361         this_arg_conv.inner = untag_ptr(this_arg);
27362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27364         this_arg_conv.is_owned = false;
27365         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27366         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
27367         return tag_ptr(ret_ret, true);
27368 }
27369
27370 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) {
27371         uint8_t seed_arr[32];
27372         CHECK(seed->arr_len == 32);
27373         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27374         uint8_t (*seed_ref)[32] = &seed_arr;
27375         uint8_t cross_node_seed_arr[32];
27376         CHECK(cross_node_seed->arr_len == 32);
27377         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
27378         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27379         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27380         uint64_t ret_ref = 0;
27381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27383         return ret_ref;
27384 }
27385
27386 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) {
27387         LDKPhantomKeysManager this_arg_conv;
27388         this_arg_conv.inner = untag_ptr(this_arg);
27389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27391         this_arg_conv.is_owned = false;
27392         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27393         descriptors_constr.datalen = descriptors->arr_len;
27394         if (descriptors_constr.datalen > 0)
27395                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27396         else
27397                 descriptors_constr.data = NULL;
27398         uint64_t* descriptors_vals = descriptors->elems;
27399         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27400                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27401                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27402                 CHECK_ACCESS(descriptors_conv_27_ptr);
27403                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27404                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27405                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27406         }
27407         FREE(descriptors);
27408         LDKCVec_TxOutZ outputs_constr;
27409         outputs_constr.datalen = outputs->arr_len;
27410         if (outputs_constr.datalen > 0)
27411                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27412         else
27413                 outputs_constr.data = NULL;
27414         uint64_t* outputs_vals = outputs->elems;
27415         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27416                 uint64_t outputs_conv_7 = outputs_vals[h];
27417                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27418                 CHECK_ACCESS(outputs_conv_7_ptr);
27419                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27420                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27421                 outputs_constr.data[h] = outputs_conv_7_conv;
27422         }
27423         FREE(outputs);
27424         LDKCVec_u8Z change_destination_script_ref;
27425         change_destination_script_ref.datalen = change_destination_script->arr_len;
27426         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27427         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27428         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27429         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27430         return tag_ptr(ret_conv, true);
27431 }
27432
27433 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) {
27434         LDKPhantomKeysManager this_arg_conv;
27435         this_arg_conv.inner = untag_ptr(this_arg);
27436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27438         this_arg_conv.is_owned = false;
27439         uint8_t params_arr[32];
27440         CHECK(params->arr_len == 32);
27441         memcpy(params_arr, params->elems, 32); FREE(params);
27442         uint8_t (*params_ref)[32] = &params_arr;
27443         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27444         uint64_t ret_ref = 0;
27445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27447         return ret_ref;
27448 }
27449
27450 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
27451         LDKPhantomKeysManager this_arg_conv;
27452         this_arg_conv.inner = untag_ptr(this_arg);
27453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27455         this_arg_conv.is_owned = false;
27456         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27457         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27458         return ret_arr;
27459 }
27460
27461 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
27462         LDKPhantomKeysManager this_arg_conv;
27463         this_arg_conv.inner = untag_ptr(this_arg);
27464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27466         this_arg_conv.is_owned = false;
27467         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27468         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
27469         return ret_arr;
27470 }
27471
27472 uint32_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
27473         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
27474         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_clone(orig_conv));
27475         return ret_conv;
27476 }
27477
27478 uint32_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
27479         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_temporary_node_failure());
27480         return ret_conv;
27481 }
27482
27483 uint32_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
27484         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_required_node_feature_missing());
27485         return ret_conv;
27486 }
27487
27488 uint32_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
27489         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_incorrect_or_unknown_payment_details());
27490         return ret_conv;
27491 }
27492
27493 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
27494         LDKChannelManager this_obj_conv;
27495         this_obj_conv.inner = untag_ptr(this_obj);
27496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27498         ChannelManager_free(this_obj_conv);
27499 }
27500
27501 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
27502         LDKChainParameters this_obj_conv;
27503         this_obj_conv.inner = untag_ptr(this_obj);
27504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27506         ChainParameters_free(this_obj_conv);
27507 }
27508
27509 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
27510         LDKChainParameters this_ptr_conv;
27511         this_ptr_conv.inner = untag_ptr(this_ptr);
27512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27514         this_ptr_conv.is_owned = false;
27515         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
27516         return ret_conv;
27517 }
27518
27519 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
27520         LDKChainParameters this_ptr_conv;
27521         this_ptr_conv.inner = untag_ptr(this_ptr);
27522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27524         this_ptr_conv.is_owned = false;
27525         LDKNetwork val_conv = LDKNetwork_from_js(val);
27526         ChainParameters_set_network(&this_ptr_conv, val_conv);
27527 }
27528
27529 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
27530         LDKChainParameters this_ptr_conv;
27531         this_ptr_conv.inner = untag_ptr(this_ptr);
27532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27534         this_ptr_conv.is_owned = false;
27535         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27536         uint64_t ret_ref = 0;
27537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27539         return ret_ref;
27540 }
27541
27542 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
27543         LDKChainParameters this_ptr_conv;
27544         this_ptr_conv.inner = untag_ptr(this_ptr);
27545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27547         this_ptr_conv.is_owned = false;
27548         LDKBestBlock val_conv;
27549         val_conv.inner = untag_ptr(val);
27550         val_conv.is_owned = ptr_is_owned(val);
27551         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27552         val_conv = BestBlock_clone(&val_conv);
27553         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27554 }
27555
27556 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
27557         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
27558         LDKBestBlock best_block_arg_conv;
27559         best_block_arg_conv.inner = untag_ptr(best_block_arg);
27560         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
27561         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27562         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27563         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27564         uint64_t ret_ref = 0;
27565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27567         return ret_ref;
27568 }
27569
27570 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27571         LDKChainParameters ret_var = ChainParameters_clone(arg);
27572         uint64_t ret_ref = 0;
27573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27575         return ret_ref;
27576 }
27577 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
27578         LDKChainParameters arg_conv;
27579         arg_conv.inner = untag_ptr(arg);
27580         arg_conv.is_owned = ptr_is_owned(arg);
27581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27582         arg_conv.is_owned = false;
27583         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
27584         return ret_conv;
27585 }
27586
27587 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
27588         LDKChainParameters orig_conv;
27589         orig_conv.inner = untag_ptr(orig);
27590         orig_conv.is_owned = ptr_is_owned(orig);
27591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27592         orig_conv.is_owned = false;
27593         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27594         uint64_t ret_ref = 0;
27595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27597         return ret_ref;
27598 }
27599
27600 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
27601         LDKCounterpartyForwardingInfo this_obj_conv;
27602         this_obj_conv.inner = untag_ptr(this_obj);
27603         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27605         CounterpartyForwardingInfo_free(this_obj_conv);
27606 }
27607
27608 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
27609         LDKCounterpartyForwardingInfo this_ptr_conv;
27610         this_ptr_conv.inner = untag_ptr(this_ptr);
27611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27613         this_ptr_conv.is_owned = false;
27614         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27615         return ret_conv;
27616 }
27617
27618 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
27619         LDKCounterpartyForwardingInfo this_ptr_conv;
27620         this_ptr_conv.inner = untag_ptr(this_ptr);
27621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27623         this_ptr_conv.is_owned = false;
27624         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27625 }
27626
27627 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
27628         LDKCounterpartyForwardingInfo this_ptr_conv;
27629         this_ptr_conv.inner = untag_ptr(this_ptr);
27630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27632         this_ptr_conv.is_owned = false;
27633         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27634         return ret_conv;
27635 }
27636
27637 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
27638         LDKCounterpartyForwardingInfo this_ptr_conv;
27639         this_ptr_conv.inner = untag_ptr(this_ptr);
27640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27642         this_ptr_conv.is_owned = false;
27643         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27644 }
27645
27646 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
27647         LDKCounterpartyForwardingInfo this_ptr_conv;
27648         this_ptr_conv.inner = untag_ptr(this_ptr);
27649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27651         this_ptr_conv.is_owned = false;
27652         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27653         return ret_conv;
27654 }
27655
27656 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
27657         LDKCounterpartyForwardingInfo this_ptr_conv;
27658         this_ptr_conv.inner = untag_ptr(this_ptr);
27659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27661         this_ptr_conv.is_owned = false;
27662         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27663 }
27664
27665 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) {
27666         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27667         uint64_t ret_ref = 0;
27668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27670         return ret_ref;
27671 }
27672
27673 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27674         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27675         uint64_t ret_ref = 0;
27676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27678         return ret_ref;
27679 }
27680 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
27681         LDKCounterpartyForwardingInfo arg_conv;
27682         arg_conv.inner = untag_ptr(arg);
27683         arg_conv.is_owned = ptr_is_owned(arg);
27684         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27685         arg_conv.is_owned = false;
27686         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27687         return ret_conv;
27688 }
27689
27690 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
27691         LDKCounterpartyForwardingInfo orig_conv;
27692         orig_conv.inner = untag_ptr(orig);
27693         orig_conv.is_owned = ptr_is_owned(orig);
27694         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27695         orig_conv.is_owned = false;
27696         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27697         uint64_t ret_ref = 0;
27698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27700         return ret_ref;
27701 }
27702
27703 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
27704         LDKChannelCounterparty this_obj_conv;
27705         this_obj_conv.inner = untag_ptr(this_obj);
27706         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27708         ChannelCounterparty_free(this_obj_conv);
27709 }
27710
27711 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
27712         LDKChannelCounterparty this_ptr_conv;
27713         this_ptr_conv.inner = untag_ptr(this_ptr);
27714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27716         this_ptr_conv.is_owned = false;
27717         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27718         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
27719         return ret_arr;
27720 }
27721
27722 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
27723         LDKChannelCounterparty this_ptr_conv;
27724         this_ptr_conv.inner = untag_ptr(this_ptr);
27725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27727         this_ptr_conv.is_owned = false;
27728         LDKPublicKey val_ref;
27729         CHECK(val->arr_len == 33);
27730         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27731         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27732 }
27733
27734 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
27735         LDKChannelCounterparty this_ptr_conv;
27736         this_ptr_conv.inner = untag_ptr(this_ptr);
27737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27739         this_ptr_conv.is_owned = false;
27740         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27741         uint64_t ret_ref = 0;
27742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27744         return ret_ref;
27745 }
27746
27747 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
27748         LDKChannelCounterparty this_ptr_conv;
27749         this_ptr_conv.inner = untag_ptr(this_ptr);
27750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27752         this_ptr_conv.is_owned = false;
27753         LDKInitFeatures val_conv;
27754         val_conv.inner = untag_ptr(val);
27755         val_conv.is_owned = ptr_is_owned(val);
27756         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27757         val_conv = InitFeatures_clone(&val_conv);
27758         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27759 }
27760
27761 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27762         LDKChannelCounterparty this_ptr_conv;
27763         this_ptr_conv.inner = untag_ptr(this_ptr);
27764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27766         this_ptr_conv.is_owned = false;
27767         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27768         return ret_conv;
27769 }
27770
27771 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
27772         LDKChannelCounterparty this_ptr_conv;
27773         this_ptr_conv.inner = untag_ptr(this_ptr);
27774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27776         this_ptr_conv.is_owned = false;
27777         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27778 }
27779
27780 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
27781         LDKChannelCounterparty this_ptr_conv;
27782         this_ptr_conv.inner = untag_ptr(this_ptr);
27783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27785         this_ptr_conv.is_owned = false;
27786         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27787         uint64_t ret_ref = 0;
27788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27790         return ret_ref;
27791 }
27792
27793 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
27794         LDKChannelCounterparty this_ptr_conv;
27795         this_ptr_conv.inner = untag_ptr(this_ptr);
27796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27798         this_ptr_conv.is_owned = false;
27799         LDKCounterpartyForwardingInfo val_conv;
27800         val_conv.inner = untag_ptr(val);
27801         val_conv.is_owned = ptr_is_owned(val);
27802         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27803         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27804         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27805 }
27806
27807 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
27808         LDKChannelCounterparty this_ptr_conv;
27809         this_ptr_conv.inner = untag_ptr(this_ptr);
27810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27812         this_ptr_conv.is_owned = false;
27813         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27814         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
27815         uint64_t ret_ref = tag_ptr(ret_copy, true);
27816         return ret_ref;
27817 }
27818
27819 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) {
27820         LDKChannelCounterparty this_ptr_conv;
27821         this_ptr_conv.inner = untag_ptr(this_ptr);
27822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27824         this_ptr_conv.is_owned = false;
27825         void* val_ptr = untag_ptr(val);
27826         CHECK_ACCESS(val_ptr);
27827         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27828         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27829         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27830 }
27831
27832 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
27833         LDKChannelCounterparty this_ptr_conv;
27834         this_ptr_conv.inner = untag_ptr(this_ptr);
27835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27837         this_ptr_conv.is_owned = false;
27838         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27839         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
27840         uint64_t ret_ref = tag_ptr(ret_copy, true);
27841         return ret_ref;
27842 }
27843
27844 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) {
27845         LDKChannelCounterparty this_ptr_conv;
27846         this_ptr_conv.inner = untag_ptr(this_ptr);
27847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27849         this_ptr_conv.is_owned = false;
27850         void* val_ptr = untag_ptr(val);
27851         CHECK_ACCESS(val_ptr);
27852         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27853         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27854         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27855 }
27856
27857 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) {
27858         LDKPublicKey node_id_arg_ref;
27859         CHECK(node_id_arg->arr_len == 33);
27860         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
27861         LDKInitFeatures features_arg_conv;
27862         features_arg_conv.inner = untag_ptr(features_arg);
27863         features_arg_conv.is_owned = ptr_is_owned(features_arg);
27864         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27865         features_arg_conv = InitFeatures_clone(&features_arg_conv);
27866         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27867         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
27868         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
27869         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27870         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27871         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
27872         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
27873         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
27874         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
27875         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
27876         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
27877         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
27878         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
27879         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);
27880         uint64_t ret_ref = 0;
27881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27883         return ret_ref;
27884 }
27885
27886 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27887         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
27888         uint64_t ret_ref = 0;
27889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27891         return ret_ref;
27892 }
27893 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
27894         LDKChannelCounterparty arg_conv;
27895         arg_conv.inner = untag_ptr(arg);
27896         arg_conv.is_owned = ptr_is_owned(arg);
27897         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27898         arg_conv.is_owned = false;
27899         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
27900         return ret_conv;
27901 }
27902
27903 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
27904         LDKChannelCounterparty orig_conv;
27905         orig_conv.inner = untag_ptr(orig);
27906         orig_conv.is_owned = ptr_is_owned(orig);
27907         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27908         orig_conv.is_owned = false;
27909         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27910         uint64_t ret_ref = 0;
27911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27913         return ret_ref;
27914 }
27915
27916 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
27917         LDKChannelDetails this_obj_conv;
27918         this_obj_conv.inner = untag_ptr(this_obj);
27919         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27921         ChannelDetails_free(this_obj_conv);
27922 }
27923
27924 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
27925         LDKChannelDetails this_ptr_conv;
27926         this_ptr_conv.inner = untag_ptr(this_ptr);
27927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27929         this_ptr_conv.is_owned = false;
27930         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27931         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
27932         return ret_arr;
27933 }
27934
27935 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27936         LDKChannelDetails this_ptr_conv;
27937         this_ptr_conv.inner = untag_ptr(this_ptr);
27938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27940         this_ptr_conv.is_owned = false;
27941         LDKThirtyTwoBytes val_ref;
27942         CHECK(val->arr_len == 32);
27943         memcpy(val_ref.data, val->elems, 32); FREE(val);
27944         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27945 }
27946
27947 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
27948         LDKChannelDetails this_ptr_conv;
27949         this_ptr_conv.inner = untag_ptr(this_ptr);
27950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27952         this_ptr_conv.is_owned = false;
27953         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27954         uint64_t ret_ref = 0;
27955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27957         return ret_ref;
27958 }
27959
27960 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
27961         LDKChannelDetails this_ptr_conv;
27962         this_ptr_conv.inner = untag_ptr(this_ptr);
27963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27965         this_ptr_conv.is_owned = false;
27966         LDKChannelCounterparty val_conv;
27967         val_conv.inner = untag_ptr(val);
27968         val_conv.is_owned = ptr_is_owned(val);
27969         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27970         val_conv = ChannelCounterparty_clone(&val_conv);
27971         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27972 }
27973
27974 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
27975         LDKChannelDetails this_ptr_conv;
27976         this_ptr_conv.inner = untag_ptr(this_ptr);
27977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27979         this_ptr_conv.is_owned = false;
27980         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27981         uint64_t ret_ref = 0;
27982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27984         return ret_ref;
27985 }
27986
27987 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
27988         LDKChannelDetails this_ptr_conv;
27989         this_ptr_conv.inner = untag_ptr(this_ptr);
27990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27992         this_ptr_conv.is_owned = false;
27993         LDKOutPoint val_conv;
27994         val_conv.inner = untag_ptr(val);
27995         val_conv.is_owned = ptr_is_owned(val);
27996         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27997         val_conv = OutPoint_clone(&val_conv);
27998         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27999 }
28000
28001 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
28002         LDKChannelDetails this_ptr_conv;
28003         this_ptr_conv.inner = untag_ptr(this_ptr);
28004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28006         this_ptr_conv.is_owned = false;
28007         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
28008         uint64_t ret_ref = 0;
28009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28011         return ret_ref;
28012 }
28013
28014 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
28015         LDKChannelDetails this_ptr_conv;
28016         this_ptr_conv.inner = untag_ptr(this_ptr);
28017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28019         this_ptr_conv.is_owned = false;
28020         LDKChannelTypeFeatures val_conv;
28021         val_conv.inner = untag_ptr(val);
28022         val_conv.is_owned = ptr_is_owned(val);
28023         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28024         val_conv = ChannelTypeFeatures_clone(&val_conv);
28025         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
28026 }
28027
28028 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
28029         LDKChannelDetails this_ptr_conv;
28030         this_ptr_conv.inner = untag_ptr(this_ptr);
28031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28033         this_ptr_conv.is_owned = false;
28034         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28035         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
28036         uint64_t ret_ref = tag_ptr(ret_copy, true);
28037         return ret_ref;
28038 }
28039
28040 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
28041         LDKChannelDetails this_ptr_conv;
28042         this_ptr_conv.inner = untag_ptr(this_ptr);
28043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28045         this_ptr_conv.is_owned = false;
28046         void* val_ptr = untag_ptr(val);
28047         CHECK_ACCESS(val_ptr);
28048         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28049         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28050         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
28051 }
28052
28053 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
28054         LDKChannelDetails this_ptr_conv;
28055         this_ptr_conv.inner = untag_ptr(this_ptr);
28056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28058         this_ptr_conv.is_owned = false;
28059         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28060         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
28061         uint64_t ret_ref = tag_ptr(ret_copy, true);
28062         return ret_ref;
28063 }
28064
28065 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
28066         LDKChannelDetails this_ptr_conv;
28067         this_ptr_conv.inner = untag_ptr(this_ptr);
28068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28070         this_ptr_conv.is_owned = false;
28071         void* val_ptr = untag_ptr(val);
28072         CHECK_ACCESS(val_ptr);
28073         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28074         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28075         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
28076 }
28077
28078 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
28079         LDKChannelDetails this_ptr_conv;
28080         this_ptr_conv.inner = untag_ptr(this_ptr);
28081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28083         this_ptr_conv.is_owned = false;
28084         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28085         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
28086         uint64_t ret_ref = tag_ptr(ret_copy, true);
28087         return ret_ref;
28088 }
28089
28090 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
28091         LDKChannelDetails this_ptr_conv;
28092         this_ptr_conv.inner = untag_ptr(this_ptr);
28093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28095         this_ptr_conv.is_owned = false;
28096         void* val_ptr = untag_ptr(val);
28097         CHECK_ACCESS(val_ptr);
28098         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28099         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28100         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
28101 }
28102
28103 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
28104         LDKChannelDetails this_ptr_conv;
28105         this_ptr_conv.inner = untag_ptr(this_ptr);
28106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28108         this_ptr_conv.is_owned = false;
28109         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
28110         return ret_conv;
28111 }
28112
28113 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
28114         LDKChannelDetails this_ptr_conv;
28115         this_ptr_conv.inner = untag_ptr(this_ptr);
28116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28118         this_ptr_conv.is_owned = false;
28119         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
28120 }
28121
28122 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
28123         LDKChannelDetails this_ptr_conv;
28124         this_ptr_conv.inner = untag_ptr(this_ptr);
28125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28127         this_ptr_conv.is_owned = false;
28128         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28129         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
28130         uint64_t ret_ref = tag_ptr(ret_copy, true);
28131         return ret_ref;
28132 }
28133
28134 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
28135         LDKChannelDetails this_ptr_conv;
28136         this_ptr_conv.inner = untag_ptr(this_ptr);
28137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28139         this_ptr_conv.is_owned = false;
28140         void* val_ptr = untag_ptr(val);
28141         CHECK_ACCESS(val_ptr);
28142         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28143         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28144         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
28145 }
28146
28147 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
28148         LDKChannelDetails this_ptr_conv;
28149         this_ptr_conv.inner = untag_ptr(this_ptr);
28150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28152         this_ptr_conv.is_owned = false;
28153         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
28154         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
28155         return ret_arr;
28156 }
28157
28158 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
28159         LDKChannelDetails this_ptr_conv;
28160         this_ptr_conv.inner = untag_ptr(this_ptr);
28161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28163         this_ptr_conv.is_owned = false;
28164         LDKU128 val_ref;
28165         CHECK(val->arr_len == 16);
28166         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
28167         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
28168 }
28169
28170 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
28171         LDKChannelDetails this_ptr_conv;
28172         this_ptr_conv.inner = untag_ptr(this_ptr);
28173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28175         this_ptr_conv.is_owned = false;
28176         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28177         return ret_conv;
28178 }
28179
28180 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
28181         LDKChannelDetails this_ptr_conv;
28182         this_ptr_conv.inner = untag_ptr(this_ptr);
28183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28185         this_ptr_conv.is_owned = false;
28186         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28187 }
28188
28189 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
28190         LDKChannelDetails this_ptr_conv;
28191         this_ptr_conv.inner = untag_ptr(this_ptr);
28192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28194         this_ptr_conv.is_owned = false;
28195         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28196         return ret_conv;
28197 }
28198
28199 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28200         LDKChannelDetails this_ptr_conv;
28201         this_ptr_conv.inner = untag_ptr(this_ptr);
28202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28204         this_ptr_conv.is_owned = false;
28205         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28206 }
28207
28208 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) {
28209         LDKChannelDetails this_ptr_conv;
28210         this_ptr_conv.inner = untag_ptr(this_ptr);
28211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28213         this_ptr_conv.is_owned = false;
28214         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
28215         return ret_conv;
28216 }
28217
28218 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) {
28219         LDKChannelDetails this_ptr_conv;
28220         this_ptr_conv.inner = untag_ptr(this_ptr);
28221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28223         this_ptr_conv.is_owned = false;
28224         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
28225 }
28226
28227 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
28228         LDKChannelDetails this_ptr_conv;
28229         this_ptr_conv.inner = untag_ptr(this_ptr);
28230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28232         this_ptr_conv.is_owned = false;
28233         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28234         return ret_conv;
28235 }
28236
28237 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28238         LDKChannelDetails this_ptr_conv;
28239         this_ptr_conv.inner = untag_ptr(this_ptr);
28240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28242         this_ptr_conv.is_owned = false;
28243         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28244 }
28245
28246 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
28247         LDKChannelDetails this_ptr_conv;
28248         this_ptr_conv.inner = untag_ptr(this_ptr);
28249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28251         this_ptr_conv.is_owned = false;
28252         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28253         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28254         uint64_t ret_ref = tag_ptr(ret_copy, true);
28255         return ret_ref;
28256 }
28257
28258 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
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         void* val_ptr = untag_ptr(val);
28265         CHECK_ACCESS(val_ptr);
28266         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28267         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28268         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28269 }
28270
28271 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
28272         LDKChannelDetails this_ptr_conv;
28273         this_ptr_conv.inner = untag_ptr(this_ptr);
28274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28276         this_ptr_conv.is_owned = false;
28277         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28278         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
28279         uint64_t ret_ref = tag_ptr(ret_copy, true);
28280         return ret_ref;
28281 }
28282
28283 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
28284         LDKChannelDetails this_ptr_conv;
28285         this_ptr_conv.inner = untag_ptr(this_ptr);
28286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28288         this_ptr_conv.is_owned = false;
28289         void* val_ptr = untag_ptr(val);
28290         CHECK_ACCESS(val_ptr);
28291         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28292         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28293         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
28294 }
28295
28296 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
28297         LDKChannelDetails this_ptr_conv;
28298         this_ptr_conv.inner = untag_ptr(this_ptr);
28299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28301         this_ptr_conv.is_owned = false;
28302         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28303         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28304         uint64_t ret_ref = tag_ptr(ret_copy, true);
28305         return ret_ref;
28306 }
28307
28308 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) {
28309         LDKChannelDetails this_ptr_conv;
28310         this_ptr_conv.inner = untag_ptr(this_ptr);
28311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28313         this_ptr_conv.is_owned = false;
28314         void* val_ptr = untag_ptr(val);
28315         CHECK_ACCESS(val_ptr);
28316         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28317         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
28318         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28319 }
28320
28321 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
28322         LDKChannelDetails this_ptr_conv;
28323         this_ptr_conv.inner = untag_ptr(this_ptr);
28324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28326         this_ptr_conv.is_owned = false;
28327         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28328         return ret_conv;
28329 }
28330
28331 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
28332         LDKChannelDetails this_ptr_conv;
28333         this_ptr_conv.inner = untag_ptr(this_ptr);
28334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28336         this_ptr_conv.is_owned = false;
28337         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28338 }
28339
28340 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
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         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
28347         return ret_conv;
28348 }
28349
28350 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
28351         LDKChannelDetails this_ptr_conv;
28352         this_ptr_conv.inner = untag_ptr(this_ptr);
28353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28355         this_ptr_conv.is_owned = false;
28356         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
28357 }
28358
28359 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
28360         LDKChannelDetails this_ptr_conv;
28361         this_ptr_conv.inner = untag_ptr(this_ptr);
28362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28364         this_ptr_conv.is_owned = false;
28365         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28366         return ret_conv;
28367 }
28368
28369 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
28370         LDKChannelDetails this_ptr_conv;
28371         this_ptr_conv.inner = untag_ptr(this_ptr);
28372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28374         this_ptr_conv.is_owned = false;
28375         ChannelDetails_set_is_usable(&this_ptr_conv, val);
28376 }
28377
28378 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
28379         LDKChannelDetails this_ptr_conv;
28380         this_ptr_conv.inner = untag_ptr(this_ptr);
28381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28383         this_ptr_conv.is_owned = false;
28384         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
28385         return ret_conv;
28386 }
28387
28388 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
28389         LDKChannelDetails this_ptr_conv;
28390         this_ptr_conv.inner = untag_ptr(this_ptr);
28391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28393         this_ptr_conv.is_owned = false;
28394         ChannelDetails_set_is_public(&this_ptr_conv, val);
28395 }
28396
28397 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
28398         LDKChannelDetails this_ptr_conv;
28399         this_ptr_conv.inner = untag_ptr(this_ptr);
28400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28402         this_ptr_conv.is_owned = false;
28403         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28404         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
28405         uint64_t ret_ref = tag_ptr(ret_copy, true);
28406         return ret_ref;
28407 }
28408
28409 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) {
28410         LDKChannelDetails this_ptr_conv;
28411         this_ptr_conv.inner = untag_ptr(this_ptr);
28412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28414         this_ptr_conv.is_owned = false;
28415         void* val_ptr = untag_ptr(val);
28416         CHECK_ACCESS(val_ptr);
28417         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28418         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28419         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28420 }
28421
28422 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
28423         LDKChannelDetails this_ptr_conv;
28424         this_ptr_conv.inner = untag_ptr(this_ptr);
28425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28427         this_ptr_conv.is_owned = false;
28428         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28429         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
28430         uint64_t ret_ref = tag_ptr(ret_copy, true);
28431         return ret_ref;
28432 }
28433
28434 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) {
28435         LDKChannelDetails this_ptr_conv;
28436         this_ptr_conv.inner = untag_ptr(this_ptr);
28437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28439         this_ptr_conv.is_owned = false;
28440         void* val_ptr = untag_ptr(val);
28441         CHECK_ACCESS(val_ptr);
28442         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28443         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28444         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28445 }
28446
28447 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
28448         LDKChannelDetails this_ptr_conv;
28449         this_ptr_conv.inner = untag_ptr(this_ptr);
28450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28452         this_ptr_conv.is_owned = false;
28453         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
28454         uint64_t ret_ref = 0;
28455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28457         return ret_ref;
28458 }
28459
28460 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
28461         LDKChannelDetails this_ptr_conv;
28462         this_ptr_conv.inner = untag_ptr(this_ptr);
28463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28465         this_ptr_conv.is_owned = false;
28466         LDKChannelConfig val_conv;
28467         val_conv.inner = untag_ptr(val);
28468         val_conv.is_owned = ptr_is_owned(val);
28469         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28470         val_conv = ChannelConfig_clone(&val_conv);
28471         ChannelDetails_set_config(&this_ptr_conv, val_conv);
28472 }
28473
28474 uint64_t  __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint64_t counterparty_arg, uint64_t funding_txo_arg, uint64_t channel_type_arg, uint64_t short_channel_id_arg, uint64_t outbound_scid_alias_arg, uint64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, uint64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t inbound_capacity_msat_arg, uint64_t confirmations_required_arg, uint64_t confirmations_arg, uint64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, jboolean is_usable_arg, jboolean is_public_arg, uint64_t inbound_htlc_minimum_msat_arg, uint64_t inbound_htlc_maximum_msat_arg, uint64_t config_arg) {
28475         LDKThirtyTwoBytes channel_id_arg_ref;
28476         CHECK(channel_id_arg->arr_len == 32);
28477         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28478         LDKChannelCounterparty counterparty_arg_conv;
28479         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
28480         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
28481         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28482         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28483         LDKOutPoint funding_txo_arg_conv;
28484         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
28485         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
28486         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28487         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28488         LDKChannelTypeFeatures channel_type_arg_conv;
28489         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
28490         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
28491         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
28492         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
28493         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
28494         CHECK_ACCESS(short_channel_id_arg_ptr);
28495         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28496         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
28497         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
28498         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
28499         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
28500         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
28501         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
28502         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
28503         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
28504         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
28505         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
28506         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28507         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28508         LDKU128 user_channel_id_arg_ref;
28509         CHECK(user_channel_id_arg->arr_len == 16);
28510         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
28511         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
28512         CHECK_ACCESS(confirmations_required_arg_ptr);
28513         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28514         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
28515         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
28516         CHECK_ACCESS(confirmations_arg_ptr);
28517         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
28518         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
28519         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
28520         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28521         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28522         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
28523         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
28524         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
28525         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
28526         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
28527         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
28528         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
28529         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
28530         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
28531         LDKChannelConfig config_arg_conv;
28532         config_arg_conv.inner = untag_ptr(config_arg);
28533         config_arg_conv.is_owned = ptr_is_owned(config_arg);
28534         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
28535         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
28536         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
28537         uint64_t ret_ref = 0;
28538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28540         return ret_ref;
28541 }
28542
28543 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28544         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28545         uint64_t ret_ref = 0;
28546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28548         return ret_ref;
28549 }
28550 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
28551         LDKChannelDetails arg_conv;
28552         arg_conv.inner = untag_ptr(arg);
28553         arg_conv.is_owned = ptr_is_owned(arg);
28554         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28555         arg_conv.is_owned = false;
28556         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28557         return ret_conv;
28558 }
28559
28560 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
28561         LDKChannelDetails orig_conv;
28562         orig_conv.inner = untag_ptr(orig);
28563         orig_conv.is_owned = ptr_is_owned(orig);
28564         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28565         orig_conv.is_owned = false;
28566         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28567         uint64_t ret_ref = 0;
28568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28570         return ret_ref;
28571 }
28572
28573 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
28574         LDKChannelDetails this_arg_conv;
28575         this_arg_conv.inner = untag_ptr(this_arg);
28576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28578         this_arg_conv.is_owned = false;
28579         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28580         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28581         uint64_t ret_ref = tag_ptr(ret_copy, true);
28582         return ret_ref;
28583 }
28584
28585 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
28586         LDKChannelDetails this_arg_conv;
28587         this_arg_conv.inner = untag_ptr(this_arg);
28588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28590         this_arg_conv.is_owned = false;
28591         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28592         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
28593         uint64_t ret_ref = tag_ptr(ret_copy, true);
28594         return ret_ref;
28595 }
28596
28597 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
28598         if (!ptr_is_owned(this_ptr)) return;
28599         void* this_ptr_ptr = untag_ptr(this_ptr);
28600         CHECK_ACCESS(this_ptr_ptr);
28601         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
28602         FREE(untag_ptr(this_ptr));
28603         RecentPaymentDetails_free(this_ptr_conv);
28604 }
28605
28606 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
28607         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28608         *ret_copy = RecentPaymentDetails_clone(arg);
28609         uint64_t ret_ref = tag_ptr(ret_copy, true);
28610         return ret_ref;
28611 }
28612 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
28613         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
28614         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
28615         return ret_conv;
28616 }
28617
28618 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
28619         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
28620         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28621         *ret_copy = RecentPaymentDetails_clone(orig_conv);
28622         uint64_t ret_ref = tag_ptr(ret_copy, true);
28623         return ret_ref;
28624 }
28625
28626 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_hash, int64_t total_msat) {
28627         LDKThirtyTwoBytes payment_hash_ref;
28628         CHECK(payment_hash->arr_len == 32);
28629         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28630         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28631         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
28632         uint64_t ret_ref = tag_ptr(ret_copy, true);
28633         return ret_ref;
28634 }
28635
28636 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_hash) {
28637         LDKThirtyTwoBytes payment_hash_ref;
28638         CHECK(payment_hash->arr_len == 32);
28639         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28640         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28641         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref);
28642         uint64_t ret_ref = tag_ptr(ret_copy, true);
28643         return ret_ref;
28644 }
28645
28646 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_hash) {
28647         LDKThirtyTwoBytes payment_hash_ref;
28648         CHECK(payment_hash->arr_len == 32);
28649         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28650         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28651         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
28652         uint64_t ret_ref = tag_ptr(ret_copy, true);
28653         return ret_ref;
28654 }
28655
28656 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
28657         LDKPhantomRouteHints this_obj_conv;
28658         this_obj_conv.inner = untag_ptr(this_obj);
28659         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28661         PhantomRouteHints_free(this_obj_conv);
28662 }
28663
28664 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
28665         LDKPhantomRouteHints this_ptr_conv;
28666         this_ptr_conv.inner = untag_ptr(this_ptr);
28667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28669         this_ptr_conv.is_owned = false;
28670         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28671         uint64_tArray ret_arr = NULL;
28672         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28673         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28674         for (size_t q = 0; q < ret_var.datalen; q++) {
28675                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28676                 uint64_t ret_conv_16_ref = 0;
28677                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28678                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28679                 ret_arr_ptr[q] = ret_conv_16_ref;
28680         }
28681         
28682         FREE(ret_var.data);
28683         return ret_arr;
28684 }
28685
28686 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
28687         LDKPhantomRouteHints this_ptr_conv;
28688         this_ptr_conv.inner = untag_ptr(this_ptr);
28689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28691         this_ptr_conv.is_owned = false;
28692         LDKCVec_ChannelDetailsZ val_constr;
28693         val_constr.datalen = val->arr_len;
28694         if (val_constr.datalen > 0)
28695                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28696         else
28697                 val_constr.data = NULL;
28698         uint64_t* val_vals = val->elems;
28699         for (size_t q = 0; q < val_constr.datalen; q++) {
28700                 uint64_t val_conv_16 = val_vals[q];
28701                 LDKChannelDetails val_conv_16_conv;
28702                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
28703                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
28704                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28705                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28706                 val_constr.data[q] = val_conv_16_conv;
28707         }
28708         FREE(val);
28709         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28710 }
28711
28712 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
28713         LDKPhantomRouteHints this_ptr_conv;
28714         this_ptr_conv.inner = untag_ptr(this_ptr);
28715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28717         this_ptr_conv.is_owned = false;
28718         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28719         return ret_conv;
28720 }
28721
28722 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
28723         LDKPhantomRouteHints this_ptr_conv;
28724         this_ptr_conv.inner = untag_ptr(this_ptr);
28725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28727         this_ptr_conv.is_owned = false;
28728         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28729 }
28730
28731 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
28732         LDKPhantomRouteHints this_ptr_conv;
28733         this_ptr_conv.inner = untag_ptr(this_ptr);
28734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28736         this_ptr_conv.is_owned = false;
28737         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28738         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
28739         return ret_arr;
28740 }
28741
28742 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
28743         LDKPhantomRouteHints this_ptr_conv;
28744         this_ptr_conv.inner = untag_ptr(this_ptr);
28745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28747         this_ptr_conv.is_owned = false;
28748         LDKPublicKey val_ref;
28749         CHECK(val->arr_len == 33);
28750         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28751         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28752 }
28753
28754 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) {
28755         LDKCVec_ChannelDetailsZ channels_arg_constr;
28756         channels_arg_constr.datalen = channels_arg->arr_len;
28757         if (channels_arg_constr.datalen > 0)
28758                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28759         else
28760                 channels_arg_constr.data = NULL;
28761         uint64_t* channels_arg_vals = channels_arg->elems;
28762         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28763                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
28764                 LDKChannelDetails channels_arg_conv_16_conv;
28765                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
28766                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
28767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28768                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28769                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28770         }
28771         FREE(channels_arg);
28772         LDKPublicKey real_node_pubkey_arg_ref;
28773         CHECK(real_node_pubkey_arg->arr_len == 33);
28774         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
28775         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28776         uint64_t ret_ref = 0;
28777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28779         return ret_ref;
28780 }
28781
28782 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28783         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28784         uint64_t ret_ref = 0;
28785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28787         return ret_ref;
28788 }
28789 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
28790         LDKPhantomRouteHints arg_conv;
28791         arg_conv.inner = untag_ptr(arg);
28792         arg_conv.is_owned = ptr_is_owned(arg);
28793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28794         arg_conv.is_owned = false;
28795         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
28796         return ret_conv;
28797 }
28798
28799 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
28800         LDKPhantomRouteHints orig_conv;
28801         orig_conv.inner = untag_ptr(orig);
28802         orig_conv.is_owned = ptr_is_owned(orig);
28803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28804         orig_conv.is_owned = false;
28805         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28806         uint64_t ret_ref = 0;
28807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28809         return ret_ref;
28810 }
28811
28812 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) {
28813         void* fee_est_ptr = untag_ptr(fee_est);
28814         CHECK_ACCESS(fee_est_ptr);
28815         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28816         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28817                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28818                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28819         }
28820         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28821         CHECK_ACCESS(chain_monitor_ptr);
28822         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28823         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28824                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28825                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28826         }
28827         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28828         CHECK_ACCESS(tx_broadcaster_ptr);
28829         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28830         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28831                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28832                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28833         }
28834         void* router_ptr = untag_ptr(router);
28835         CHECK_ACCESS(router_ptr);
28836         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
28837         if (router_conv.free == LDKRouter_JCalls_free) {
28838                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28839                 LDKRouter_JCalls_cloned(&router_conv);
28840         }
28841         void* logger_ptr = untag_ptr(logger);
28842         CHECK_ACCESS(logger_ptr);
28843         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28844         if (logger_conv.free == LDKLogger_JCalls_free) {
28845                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28846                 LDKLogger_JCalls_cloned(&logger_conv);
28847         }
28848         void* entropy_source_ptr = untag_ptr(entropy_source);
28849         CHECK_ACCESS(entropy_source_ptr);
28850         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
28851         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
28852                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28853                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
28854         }
28855         void* node_signer_ptr = untag_ptr(node_signer);
28856         CHECK_ACCESS(node_signer_ptr);
28857         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
28858         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
28859                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28860                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
28861         }
28862         void* signer_provider_ptr = untag_ptr(signer_provider);
28863         CHECK_ACCESS(signer_provider_ptr);
28864         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
28865         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
28866                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28867                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
28868         }
28869         LDKUserConfig config_conv;
28870         config_conv.inner = untag_ptr(config);
28871         config_conv.is_owned = ptr_is_owned(config);
28872         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28873         config_conv = UserConfig_clone(&config_conv);
28874         LDKChainParameters params_conv;
28875         params_conv.inner = untag_ptr(params);
28876         params_conv.is_owned = ptr_is_owned(params);
28877         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28878         params_conv = ChainParameters_clone(&params_conv);
28879         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);
28880         uint64_t ret_ref = 0;
28881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28883         return ret_ref;
28884 }
28885
28886 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
28887         LDKChannelManager this_arg_conv;
28888         this_arg_conv.inner = untag_ptr(this_arg);
28889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28891         this_arg_conv.is_owned = false;
28892         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28893         uint64_t ret_ref = 0;
28894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28896         return ret_ref;
28897 }
28898
28899 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) {
28900         LDKChannelManager this_arg_conv;
28901         this_arg_conv.inner = untag_ptr(this_arg);
28902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28904         this_arg_conv.is_owned = false;
28905         LDKPublicKey their_network_key_ref;
28906         CHECK(their_network_key->arr_len == 33);
28907         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
28908         LDKU128 user_channel_id_ref;
28909         CHECK(user_channel_id->arr_len == 16);
28910         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28911         LDKUserConfig override_config_conv;
28912         override_config_conv.inner = untag_ptr(override_config);
28913         override_config_conv.is_owned = ptr_is_owned(override_config);
28914         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28915         override_config_conv = UserConfig_clone(&override_config_conv);
28916         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28917         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
28918         return tag_ptr(ret_conv, true);
28919 }
28920
28921 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
28922         LDKChannelManager this_arg_conv;
28923         this_arg_conv.inner = untag_ptr(this_arg);
28924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28926         this_arg_conv.is_owned = false;
28927         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28928         uint64_tArray ret_arr = NULL;
28929         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28930         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28931         for (size_t q = 0; q < ret_var.datalen; q++) {
28932                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28933                 uint64_t ret_conv_16_ref = 0;
28934                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28935                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28936                 ret_arr_ptr[q] = ret_conv_16_ref;
28937         }
28938         
28939         FREE(ret_var.data);
28940         return ret_arr;
28941 }
28942
28943 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
28944         LDKChannelManager this_arg_conv;
28945         this_arg_conv.inner = untag_ptr(this_arg);
28946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28948         this_arg_conv.is_owned = false;
28949         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28950         uint64_tArray ret_arr = NULL;
28951         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28952         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28953         for (size_t q = 0; q < ret_var.datalen; q++) {
28954                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28955                 uint64_t ret_conv_16_ref = 0;
28956                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28957                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28958                 ret_arr_ptr[q] = ret_conv_16_ref;
28959         }
28960         
28961         FREE(ret_var.data);
28962         return ret_arr;
28963 }
28964
28965 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
28966         LDKChannelManager this_arg_conv;
28967         this_arg_conv.inner = untag_ptr(this_arg);
28968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28970         this_arg_conv.is_owned = false;
28971         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
28972         uint64_tArray ret_arr = NULL;
28973         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28974         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28975         for (size_t w = 0; w < ret_var.datalen; w++) {
28976                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28977                 *ret_conv_22_copy = ret_var.data[w];
28978                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
28979                 ret_arr_ptr[w] = ret_conv_22_ref;
28980         }
28981         
28982         FREE(ret_var.data);
28983         return ret_arr;
28984 }
28985
28986 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) {
28987         LDKChannelManager this_arg_conv;
28988         this_arg_conv.inner = untag_ptr(this_arg);
28989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28991         this_arg_conv.is_owned = false;
28992         uint8_t channel_id_arr[32];
28993         CHECK(channel_id->arr_len == 32);
28994         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28995         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28996         LDKPublicKey counterparty_node_id_ref;
28997         CHECK(counterparty_node_id->arr_len == 33);
28998         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28999         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29000         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29001         return tag_ptr(ret_conv, true);
29002 }
29003
29004 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) {
29005         LDKChannelManager this_arg_conv;
29006         this_arg_conv.inner = untag_ptr(this_arg);
29007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29009         this_arg_conv.is_owned = false;
29010         uint8_t channel_id_arr[32];
29011         CHECK(channel_id->arr_len == 32);
29012         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
29013         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
29014         LDKPublicKey counterparty_node_id_ref;
29015         CHECK(counterparty_node_id->arr_len == 33);
29016         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29017         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29018         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
29019         return tag_ptr(ret_conv, true);
29020 }
29021
29022 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) {
29023         LDKChannelManager this_arg_conv;
29024         this_arg_conv.inner = untag_ptr(this_arg);
29025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29027         this_arg_conv.is_owned = false;
29028         uint8_t channel_id_arr[32];
29029         CHECK(channel_id->arr_len == 32);
29030         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
29031         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
29032         LDKPublicKey counterparty_node_id_ref;
29033         CHECK(counterparty_node_id->arr_len == 33);
29034         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29035         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29036         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29037         return tag_ptr(ret_conv, true);
29038 }
29039
29040 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) {
29041         LDKChannelManager this_arg_conv;
29042         this_arg_conv.inner = untag_ptr(this_arg);
29043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29045         this_arg_conv.is_owned = false;
29046         uint8_t channel_id_arr[32];
29047         CHECK(channel_id->arr_len == 32);
29048         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
29049         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
29050         LDKPublicKey counterparty_node_id_ref;
29051         CHECK(counterparty_node_id->arr_len == 33);
29052         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29053         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29054         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29055         return tag_ptr(ret_conv, true);
29056 }
29057
29058 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) {
29059         LDKChannelManager this_arg_conv;
29060         this_arg_conv.inner = untag_ptr(this_arg);
29061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29063         this_arg_conv.is_owned = false;
29064         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
29065 }
29066
29067 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) {
29068         LDKChannelManager this_arg_conv;
29069         this_arg_conv.inner = untag_ptr(this_arg);
29070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29072         this_arg_conv.is_owned = false;
29073         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
29074 }
29075
29076 uint64_t  __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_ChannelManager_send_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id) {
29077         LDKChannelManager this_arg_conv;
29078         this_arg_conv.inner = untag_ptr(this_arg);
29079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29081         this_arg_conv.is_owned = false;
29082         LDKRoute route_conv;
29083         route_conv.inner = untag_ptr(route);
29084         route_conv.is_owned = ptr_is_owned(route);
29085         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29086         route_conv.is_owned = false;
29087         LDKThirtyTwoBytes payment_hash_ref;
29088         CHECK(payment_hash->arr_len == 32);
29089         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29090         LDKThirtyTwoBytes payment_secret_ref;
29091         CHECK(payment_secret->arr_len == 32);
29092         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29093         LDKThirtyTwoBytes payment_id_ref;
29094         CHECK(payment_id->arr_len == 32);
29095         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29096         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29097         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref);
29098         return tag_ptr(ret_conv, true);
29099 }
29100
29101 uint64_t  __attribute__((export_name("TS_ChannelManager_send_payment_with_retry"))) TS_ChannelManager_send_payment_with_retry(uint64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) {
29102         LDKChannelManager this_arg_conv;
29103         this_arg_conv.inner = untag_ptr(this_arg);
29104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29106         this_arg_conv.is_owned = false;
29107         LDKThirtyTwoBytes payment_hash_ref;
29108         CHECK(payment_hash->arr_len == 32);
29109         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29110         LDKThirtyTwoBytes payment_secret_ref;
29111         CHECK(payment_secret->arr_len == 32);
29112         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29113         LDKThirtyTwoBytes payment_id_ref;
29114         CHECK(payment_id->arr_len == 32);
29115         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29116         LDKRouteParameters route_params_conv;
29117         route_params_conv.inner = untag_ptr(route_params);
29118         route_params_conv.is_owned = ptr_is_owned(route_params);
29119         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29120         route_params_conv = RouteParameters_clone(&route_params_conv);
29121         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29122         CHECK_ACCESS(retry_strategy_ptr);
29123         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29124         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29125         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29126         *ret_conv = ChannelManager_send_payment_with_retry(&this_arg_conv, payment_hash_ref, payment_secret_ref, payment_id_ref, route_params_conv, retry_strategy_conv);
29127         return tag_ptr(ret_conv, true);
29128 }
29129
29130 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
29131         LDKChannelManager this_arg_conv;
29132         this_arg_conv.inner = untag_ptr(this_arg);
29133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29135         this_arg_conv.is_owned = false;
29136         LDKThirtyTwoBytes payment_id_ref;
29137         CHECK(payment_id->arr_len == 32);
29138         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29139         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29140 }
29141
29142 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment"))) TS_ChannelManager_send_spontaneous_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_preimage, int8_tArray payment_id) {
29143         LDKChannelManager this_arg_conv;
29144         this_arg_conv.inner = untag_ptr(this_arg);
29145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29147         this_arg_conv.is_owned = false;
29148         LDKRoute route_conv;
29149         route_conv.inner = untag_ptr(route);
29150         route_conv.is_owned = ptr_is_owned(route);
29151         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29152         route_conv.is_owned = false;
29153         LDKThirtyTwoBytes payment_preimage_ref;
29154         CHECK(payment_preimage->arr_len == 32);
29155         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29156         LDKThirtyTwoBytes payment_id_ref;
29157         CHECK(payment_id->arr_len == 32);
29158         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29159         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
29160         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, payment_id_ref);
29161         return tag_ptr(ret_conv, true);
29162 }
29163
29164 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment_with_retry"))) TS_ChannelManager_send_spontaneous_payment_with_retry(uint64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) {
29165         LDKChannelManager this_arg_conv;
29166         this_arg_conv.inner = untag_ptr(this_arg);
29167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29169         this_arg_conv.is_owned = false;
29170         LDKThirtyTwoBytes payment_preimage_ref;
29171         CHECK(payment_preimage->arr_len == 32);
29172         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29173         LDKThirtyTwoBytes payment_id_ref;
29174         CHECK(payment_id->arr_len == 32);
29175         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29176         LDKRouteParameters route_params_conv;
29177         route_params_conv.inner = untag_ptr(route_params);
29178         route_params_conv.is_owned = ptr_is_owned(route_params);
29179         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29180         route_params_conv = RouteParameters_clone(&route_params_conv);
29181         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29182         CHECK_ACCESS(retry_strategy_ptr);
29183         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29184         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29185         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
29186         *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_ref, payment_id_ref, route_params_conv, retry_strategy_conv);
29187         return tag_ptr(ret_conv, true);
29188 }
29189
29190 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
29191         LDKChannelManager this_arg_conv;
29192         this_arg_conv.inner = untag_ptr(this_arg);
29193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29195         this_arg_conv.is_owned = false;
29196         LDKCVec_RouteHopZ hops_constr;
29197         hops_constr.datalen = hops->arr_len;
29198         if (hops_constr.datalen > 0)
29199                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
29200         else
29201                 hops_constr.data = NULL;
29202         uint64_t* hops_vals = hops->elems;
29203         for (size_t k = 0; k < hops_constr.datalen; k++) {
29204                 uint64_t hops_conv_10 = hops_vals[k];
29205                 LDKRouteHop hops_conv_10_conv;
29206                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
29207                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
29208                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
29209                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
29210                 hops_constr.data[k] = hops_conv_10_conv;
29211         }
29212         FREE(hops);
29213         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29214         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
29215         return tag_ptr(ret_conv, true);
29216 }
29217
29218 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) {
29219         LDKChannelManager this_arg_conv;
29220         this_arg_conv.inner = untag_ptr(this_arg);
29221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29223         this_arg_conv.is_owned = false;
29224         uint8_t temporary_channel_id_arr[32];
29225         CHECK(temporary_channel_id->arr_len == 32);
29226         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29227         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29228         LDKPublicKey counterparty_node_id_ref;
29229         CHECK(counterparty_node_id->arr_len == 33);
29230         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29231         LDKTransaction funding_transaction_ref;
29232         funding_transaction_ref.datalen = funding_transaction->arr_len;
29233         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29234         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
29235         funding_transaction_ref.data_is_owned = true;
29236         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29237         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
29238         return tag_ptr(ret_conv, true);
29239 }
29240
29241 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) {
29242         LDKChannelManager this_arg_conv;
29243         this_arg_conv.inner = untag_ptr(this_arg);
29244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29246         this_arg_conv.is_owned = false;
29247         LDKPublicKey counterparty_node_id_ref;
29248         CHECK(counterparty_node_id->arr_len == 33);
29249         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29250         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
29251         channel_ids_constr.datalen = channel_ids->arr_len;
29252         if (channel_ids_constr.datalen > 0)
29253                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
29254         else
29255                 channel_ids_constr.data = NULL;
29256         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
29257         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
29258                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
29259                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
29260                 CHECK(channel_ids_conv_12->arr_len == 32);
29261                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
29262                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
29263         }
29264         FREE(channel_ids);
29265         LDKChannelConfig config_conv;
29266         config_conv.inner = untag_ptr(config);
29267         config_conv.is_owned = ptr_is_owned(config);
29268         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29269         config_conv.is_owned = false;
29270         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29271         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
29272         return tag_ptr(ret_conv, true);
29273 }
29274
29275 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) {
29276         LDKChannelManager this_arg_conv;
29277         this_arg_conv.inner = untag_ptr(this_arg);
29278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29280         this_arg_conv.is_owned = false;
29281         LDKThirtyTwoBytes intercept_id_ref;
29282         CHECK(intercept_id->arr_len == 32);
29283         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29284         uint8_t next_hop_channel_id_arr[32];
29285         CHECK(next_hop_channel_id->arr_len == 32);
29286         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
29287         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
29288         LDKPublicKey next_node_id_ref;
29289         CHECK(next_node_id->arr_len == 33);
29290         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
29291         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29292         *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);
29293         return tag_ptr(ret_conv, true);
29294 }
29295
29296 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
29297         LDKChannelManager this_arg_conv;
29298         this_arg_conv.inner = untag_ptr(this_arg);
29299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29301         this_arg_conv.is_owned = false;
29302         LDKThirtyTwoBytes intercept_id_ref;
29303         CHECK(intercept_id->arr_len == 32);
29304         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29305         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29306         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
29307         return tag_ptr(ret_conv, true);
29308 }
29309
29310 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
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         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29317 }
29318
29319 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
29320         LDKChannelManager this_arg_conv;
29321         this_arg_conv.inner = untag_ptr(this_arg);
29322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29324         this_arg_conv.is_owned = false;
29325         ChannelManager_timer_tick_occurred(&this_arg_conv);
29326 }
29327
29328 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
29329         LDKChannelManager this_arg_conv;
29330         this_arg_conv.inner = untag_ptr(this_arg);
29331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29333         this_arg_conv.is_owned = false;
29334         uint8_t payment_hash_arr[32];
29335         CHECK(payment_hash->arr_len == 32);
29336         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29337         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29338         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29339 }
29340
29341 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) {
29342         LDKChannelManager this_arg_conv;
29343         this_arg_conv.inner = untag_ptr(this_arg);
29344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29346         this_arg_conv.is_owned = false;
29347         uint8_t payment_hash_arr[32];
29348         CHECK(payment_hash->arr_len == 32);
29349         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29350         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29351         LDKFailureCode failure_code_conv = LDKFailureCode_from_js(failure_code);
29352         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
29353 }
29354
29355 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
29356         LDKChannelManager this_arg_conv;
29357         this_arg_conv.inner = untag_ptr(this_arg);
29358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29360         this_arg_conv.is_owned = false;
29361         LDKThirtyTwoBytes payment_preimage_ref;
29362         CHECK(payment_preimage->arr_len == 32);
29363         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29364         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29365 }
29366
29367 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
29368         LDKChannelManager this_arg_conv;
29369         this_arg_conv.inner = untag_ptr(this_arg);
29370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29372         this_arg_conv.is_owned = false;
29373         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29374         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
29375         return ret_arr;
29376 }
29377
29378 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) {
29379         LDKChannelManager this_arg_conv;
29380         this_arg_conv.inner = untag_ptr(this_arg);
29381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29383         this_arg_conv.is_owned = false;
29384         uint8_t temporary_channel_id_arr[32];
29385         CHECK(temporary_channel_id->arr_len == 32);
29386         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29387         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29388         LDKPublicKey counterparty_node_id_ref;
29389         CHECK(counterparty_node_id->arr_len == 33);
29390         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29391         LDKU128 user_channel_id_ref;
29392         CHECK(user_channel_id->arr_len == 16);
29393         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29394         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29395         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
29396         return tag_ptr(ret_conv, true);
29397 }
29398
29399 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) {
29400         LDKChannelManager this_arg_conv;
29401         this_arg_conv.inner = untag_ptr(this_arg);
29402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29404         this_arg_conv.is_owned = false;
29405         uint8_t temporary_channel_id_arr[32];
29406         CHECK(temporary_channel_id->arr_len == 32);
29407         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29408         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29409         LDKPublicKey counterparty_node_id_ref;
29410         CHECK(counterparty_node_id->arr_len == 33);
29411         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29412         LDKU128 user_channel_id_ref;
29413         CHECK(user_channel_id->arr_len == 16);
29414         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29415         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29416         *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);
29417         return tag_ptr(ret_conv, true);
29418 }
29419
29420 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) {
29421         LDKChannelManager this_arg_conv;
29422         this_arg_conv.inner = untag_ptr(this_arg);
29423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29425         this_arg_conv.is_owned = false;
29426         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29427         CHECK_ACCESS(min_value_msat_ptr);
29428         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29429         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29430         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
29431         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
29432         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
29433         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
29434         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29435         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
29436         return tag_ptr(ret_conv, true);
29437 }
29438
29439 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) {
29440         LDKChannelManager this_arg_conv;
29441         this_arg_conv.inner = untag_ptr(this_arg);
29442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29444         this_arg_conv.is_owned = false;
29445         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29446         CHECK_ACCESS(min_value_msat_ptr);
29447         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29448         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29449         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
29450         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29451         return tag_ptr(ret_conv, true);
29452 }
29453
29454 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) {
29455         LDKChannelManager this_arg_conv;
29456         this_arg_conv.inner = untag_ptr(this_arg);
29457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29459         this_arg_conv.is_owned = false;
29460         LDKThirtyTwoBytes payment_hash_ref;
29461         CHECK(payment_hash->arr_len == 32);
29462         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29463         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29464         CHECK_ACCESS(min_value_msat_ptr);
29465         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29466         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29467         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
29468         CHECK_ACCESS(min_final_cltv_expiry_ptr);
29469         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
29470         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
29471         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29472         *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);
29473         return tag_ptr(ret_conv, true);
29474 }
29475
29476 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) {
29477         LDKChannelManager this_arg_conv;
29478         this_arg_conv.inner = untag_ptr(this_arg);
29479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29481         this_arg_conv.is_owned = false;
29482         LDKThirtyTwoBytes payment_hash_ref;
29483         CHECK(payment_hash->arr_len == 32);
29484         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29485         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29486         CHECK_ACCESS(min_value_msat_ptr);
29487         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29488         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29489         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
29490         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29491         return tag_ptr(ret_conv, true);
29492 }
29493
29494 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) {
29495         LDKChannelManager this_arg_conv;
29496         this_arg_conv.inner = untag_ptr(this_arg);
29497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29499         this_arg_conv.is_owned = false;
29500         LDKThirtyTwoBytes payment_hash_ref;
29501         CHECK(payment_hash->arr_len == 32);
29502         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29503         LDKThirtyTwoBytes payment_secret_ref;
29504         CHECK(payment_secret->arr_len == 32);
29505         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29506         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
29507         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
29508         return tag_ptr(ret_conv, true);
29509 }
29510
29511 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
29512         LDKChannelManager this_arg_conv;
29513         this_arg_conv.inner = untag_ptr(this_arg);
29514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29516         this_arg_conv.is_owned = false;
29517         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
29518         return ret_conv;
29519 }
29520
29521 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
29522         LDKChannelManager this_arg_conv;
29523         this_arg_conv.inner = untag_ptr(this_arg);
29524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29526         this_arg_conv.is_owned = false;
29527         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
29528         uint64_t ret_ref = 0;
29529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29531         return ret_ref;
29532 }
29533
29534 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
29535         LDKChannelManager this_arg_conv;
29536         this_arg_conv.inner = untag_ptr(this_arg);
29537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29539         this_arg_conv.is_owned = false;
29540         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
29541         return ret_conv;
29542 }
29543
29544 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
29545         LDKChannelManager this_arg_conv;
29546         this_arg_conv.inner = untag_ptr(this_arg);
29547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29549         this_arg_conv.is_owned = false;
29550         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
29551         uint64_t ret_ref = 0;
29552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29554         return ret_ref;
29555 }
29556
29557 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
29558         LDKChannelManager this_arg_conv;
29559         this_arg_conv.inner = untag_ptr(this_arg);
29560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29562         this_arg_conv.is_owned = false;
29563         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29564         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
29565         return tag_ptr(ret_ret, true);
29566 }
29567
29568 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
29569         LDKChannelManager this_arg_conv;
29570         this_arg_conv.inner = untag_ptr(this_arg);
29571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29573         this_arg_conv.is_owned = false;
29574         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29575         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
29576         return tag_ptr(ret_ret, true);
29577 }
29578
29579 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
29580         LDKChannelManager this_arg_conv;
29581         this_arg_conv.inner = untag_ptr(this_arg);
29582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29584         this_arg_conv.is_owned = false;
29585         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29586         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29587         return tag_ptr(ret_ret, true);
29588 }
29589
29590 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(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         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29597         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29598         return tag_ptr(ret_ret, true);
29599 }
29600
29601 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
29602         LDKChannelManager this_arg_conv;
29603         this_arg_conv.inner = untag_ptr(this_arg);
29604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29606         this_arg_conv.is_owned = false;
29607         ChannelManager_await_persistable_update(&this_arg_conv);
29608 }
29609
29610 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
29611         LDKChannelManager this_arg_conv;
29612         this_arg_conv.inner = untag_ptr(this_arg);
29613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29615         this_arg_conv.is_owned = false;
29616         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
29617         uint64_t ret_ref = 0;
29618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29620         return ret_ref;
29621 }
29622
29623 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
29624         LDKChannelManager this_arg_conv;
29625         this_arg_conv.inner = untag_ptr(this_arg);
29626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29628         this_arg_conv.is_owned = false;
29629         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29630         uint64_t ret_ref = 0;
29631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29633         return ret_ref;
29634 }
29635
29636 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
29637         LDKChannelManager this_arg_conv;
29638         this_arg_conv.inner = untag_ptr(this_arg);
29639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29641         this_arg_conv.is_owned = false;
29642         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
29643         uint64_t ret_ref = 0;
29644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29646         return ret_ref;
29647 }
29648
29649 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
29650         LDKChannelManager this_arg_conv;
29651         this_arg_conv.inner = untag_ptr(this_arg);
29652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29654         this_arg_conv.is_owned = false;
29655         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
29656         uint64_t ret_ref = 0;
29657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29659         return ret_ref;
29660 }
29661
29662 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
29663         LDKChannelManager this_arg_conv;
29664         this_arg_conv.inner = untag_ptr(this_arg);
29665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29667         this_arg_conv.is_owned = false;
29668         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
29669         uint64_t ret_ref = 0;
29670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29672         return ret_ref;
29673 }
29674
29675 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
29676         LDKChannelManager this_arg_conv;
29677         this_arg_conv.inner = untag_ptr(this_arg);
29678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29680         this_arg_conv.is_owned = false;
29681         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
29682         uint64_t ret_ref = 0;
29683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29685         return ret_ref;
29686 }
29687
29688 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
29689         LDKChannelManager this_arg_conv;
29690         this_arg_conv.inner = untag_ptr(this_arg);
29691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29693         this_arg_conv.is_owned = false;
29694         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29695         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29696         return tag_ptr(ret_ret, true);
29697 }
29698
29699 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t _config) {
29700         LDKUserConfig _config_conv;
29701         _config_conv.inner = untag_ptr(_config);
29702         _config_conv.is_owned = ptr_is_owned(_config);
29703         CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv);
29704         _config_conv.is_owned = false;
29705         LDKInitFeatures ret_var = provided_init_features(&_config_conv);
29706         uint64_t ret_ref = 0;
29707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29709         return ret_ref;
29710 }
29711
29712 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
29713         LDKCounterpartyForwardingInfo obj_conv;
29714         obj_conv.inner = untag_ptr(obj);
29715         obj_conv.is_owned = ptr_is_owned(obj);
29716         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29717         obj_conv.is_owned = false;
29718         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29721         CVec_u8Z_free(ret_var);
29722         return ret_arr;
29723 }
29724
29725 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
29726         LDKu8slice ser_ref;
29727         ser_ref.datalen = ser->arr_len;
29728         ser_ref.data = ser->elems;
29729         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29730         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29731         FREE(ser);
29732         return tag_ptr(ret_conv, true);
29733 }
29734
29735 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
29736         LDKChannelCounterparty obj_conv;
29737         obj_conv.inner = untag_ptr(obj);
29738         obj_conv.is_owned = ptr_is_owned(obj);
29739         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29740         obj_conv.is_owned = false;
29741         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29742         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29743         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29744         CVec_u8Z_free(ret_var);
29745         return ret_arr;
29746 }
29747
29748 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
29749         LDKu8slice ser_ref;
29750         ser_ref.datalen = ser->arr_len;
29751         ser_ref.data = ser->elems;
29752         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29753         *ret_conv = ChannelCounterparty_read(ser_ref);
29754         FREE(ser);
29755         return tag_ptr(ret_conv, true);
29756 }
29757
29758 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
29759         LDKChannelDetails obj_conv;
29760         obj_conv.inner = untag_ptr(obj);
29761         obj_conv.is_owned = ptr_is_owned(obj);
29762         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29763         obj_conv.is_owned = false;
29764         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29765         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29766         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29767         CVec_u8Z_free(ret_var);
29768         return ret_arr;
29769 }
29770
29771 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
29772         LDKu8slice ser_ref;
29773         ser_ref.datalen = ser->arr_len;
29774         ser_ref.data = ser->elems;
29775         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29776         *ret_conv = ChannelDetails_read(ser_ref);
29777         FREE(ser);
29778         return tag_ptr(ret_conv, true);
29779 }
29780
29781 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
29782         LDKPhantomRouteHints obj_conv;
29783         obj_conv.inner = untag_ptr(obj);
29784         obj_conv.is_owned = ptr_is_owned(obj);
29785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29786         obj_conv.is_owned = false;
29787         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29788         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29789         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29790         CVec_u8Z_free(ret_var);
29791         return ret_arr;
29792 }
29793
29794 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
29795         LDKu8slice ser_ref;
29796         ser_ref.datalen = ser->arr_len;
29797         ser_ref.data = ser->elems;
29798         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29799         *ret_conv = PhantomRouteHints_read(ser_ref);
29800         FREE(ser);
29801         return tag_ptr(ret_conv, true);
29802 }
29803
29804 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
29805         LDKChannelManager obj_conv;
29806         obj_conv.inner = untag_ptr(obj);
29807         obj_conv.is_owned = ptr_is_owned(obj);
29808         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29809         obj_conv.is_owned = false;
29810         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29811         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29812         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29813         CVec_u8Z_free(ret_var);
29814         return ret_arr;
29815 }
29816
29817 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
29818         LDKChannelManagerReadArgs this_obj_conv;
29819         this_obj_conv.inner = untag_ptr(this_obj);
29820         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29822         ChannelManagerReadArgs_free(this_obj_conv);
29823 }
29824
29825 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
29826         LDKChannelManagerReadArgs this_ptr_conv;
29827         this_ptr_conv.inner = untag_ptr(this_ptr);
29828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29830         this_ptr_conv.is_owned = false;
29831         // WARNING: This object doesn't live past this scope, needs clone!
29832         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
29833         return ret_ret;
29834 }
29835
29836 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
29837         LDKChannelManagerReadArgs this_ptr_conv;
29838         this_ptr_conv.inner = untag_ptr(this_ptr);
29839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29841         this_ptr_conv.is_owned = false;
29842         void* val_ptr = untag_ptr(val);
29843         CHECK_ACCESS(val_ptr);
29844         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
29845         if (val_conv.free == LDKEntropySource_JCalls_free) {
29846                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29847                 LDKEntropySource_JCalls_cloned(&val_conv);
29848         }
29849         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
29850 }
29851
29852 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
29853         LDKChannelManagerReadArgs this_ptr_conv;
29854         this_ptr_conv.inner = untag_ptr(this_ptr);
29855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29857         this_ptr_conv.is_owned = false;
29858         // WARNING: This object doesn't live past this scope, needs clone!
29859         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
29860         return ret_ret;
29861 }
29862
29863 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
29864         LDKChannelManagerReadArgs this_ptr_conv;
29865         this_ptr_conv.inner = untag_ptr(this_ptr);
29866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29868         this_ptr_conv.is_owned = false;
29869         void* val_ptr = untag_ptr(val);
29870         CHECK_ACCESS(val_ptr);
29871         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
29872         if (val_conv.free == LDKNodeSigner_JCalls_free) {
29873                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29874                 LDKNodeSigner_JCalls_cloned(&val_conv);
29875         }
29876         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
29877 }
29878
29879 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
29880         LDKChannelManagerReadArgs this_ptr_conv;
29881         this_ptr_conv.inner = untag_ptr(this_ptr);
29882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29884         this_ptr_conv.is_owned = false;
29885         // WARNING: This object doesn't live past this scope, needs clone!
29886         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
29887         return ret_ret;
29888 }
29889
29890 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
29891         LDKChannelManagerReadArgs this_ptr_conv;
29892         this_ptr_conv.inner = untag_ptr(this_ptr);
29893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29895         this_ptr_conv.is_owned = false;
29896         void* val_ptr = untag_ptr(val);
29897         CHECK_ACCESS(val_ptr);
29898         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
29899         if (val_conv.free == LDKSignerProvider_JCalls_free) {
29900                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29901                 LDKSignerProvider_JCalls_cloned(&val_conv);
29902         }
29903         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
29904 }
29905
29906 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
29907         LDKChannelManagerReadArgs this_ptr_conv;
29908         this_ptr_conv.inner = untag_ptr(this_ptr);
29909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29911         this_ptr_conv.is_owned = false;
29912         // WARNING: This object doesn't live past this scope, needs clone!
29913         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
29914         return ret_ret;
29915 }
29916
29917 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
29918         LDKChannelManagerReadArgs this_ptr_conv;
29919         this_ptr_conv.inner = untag_ptr(this_ptr);
29920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29922         this_ptr_conv.is_owned = false;
29923         void* val_ptr = untag_ptr(val);
29924         CHECK_ACCESS(val_ptr);
29925         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29926         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29927                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29928                 LDKFeeEstimator_JCalls_cloned(&val_conv);
29929         }
29930         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29931 }
29932
29933 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
29934         LDKChannelManagerReadArgs this_ptr_conv;
29935         this_ptr_conv.inner = untag_ptr(this_ptr);
29936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29938         this_ptr_conv.is_owned = false;
29939         // WARNING: This object doesn't live past this scope, needs clone!
29940         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
29941         return ret_ret;
29942 }
29943
29944 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
29945         LDKChannelManagerReadArgs this_ptr_conv;
29946         this_ptr_conv.inner = untag_ptr(this_ptr);
29947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29949         this_ptr_conv.is_owned = false;
29950         void* val_ptr = untag_ptr(val);
29951         CHECK_ACCESS(val_ptr);
29952         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29953         if (val_conv.free == LDKWatch_JCalls_free) {
29954                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29955                 LDKWatch_JCalls_cloned(&val_conv);
29956         }
29957         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29958 }
29959
29960 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
29961         LDKChannelManagerReadArgs this_ptr_conv;
29962         this_ptr_conv.inner = untag_ptr(this_ptr);
29963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29965         this_ptr_conv.is_owned = false;
29966         // WARNING: This object doesn't live past this scope, needs clone!
29967         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
29968         return ret_ret;
29969 }
29970
29971 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
29972         LDKChannelManagerReadArgs this_ptr_conv;
29973         this_ptr_conv.inner = untag_ptr(this_ptr);
29974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29976         this_ptr_conv.is_owned = false;
29977         void* val_ptr = untag_ptr(val);
29978         CHECK_ACCESS(val_ptr);
29979         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29980         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29981                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29982                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29983         }
29984         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29985 }
29986
29987 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
29988         LDKChannelManagerReadArgs this_ptr_conv;
29989         this_ptr_conv.inner = untag_ptr(this_ptr);
29990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29992         this_ptr_conv.is_owned = false;
29993         // WARNING: This object doesn't live past this scope, needs clone!
29994         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
29995         return ret_ret;
29996 }
29997
29998 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
29999         LDKChannelManagerReadArgs this_ptr_conv;
30000         this_ptr_conv.inner = untag_ptr(this_ptr);
30001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30003         this_ptr_conv.is_owned = false;
30004         void* val_ptr = untag_ptr(val);
30005         CHECK_ACCESS(val_ptr);
30006         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
30007         if (val_conv.free == LDKRouter_JCalls_free) {
30008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30009                 LDKRouter_JCalls_cloned(&val_conv);
30010         }
30011         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
30012 }
30013
30014 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
30015         LDKChannelManagerReadArgs this_ptr_conv;
30016         this_ptr_conv.inner = untag_ptr(this_ptr);
30017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30019         this_ptr_conv.is_owned = false;
30020         // WARNING: This object doesn't live past this scope, needs clone!
30021         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
30022         return ret_ret;
30023 }
30024
30025 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
30026         LDKChannelManagerReadArgs this_ptr_conv;
30027         this_ptr_conv.inner = untag_ptr(this_ptr);
30028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30030         this_ptr_conv.is_owned = false;
30031         void* val_ptr = untag_ptr(val);
30032         CHECK_ACCESS(val_ptr);
30033         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
30034         if (val_conv.free == LDKLogger_JCalls_free) {
30035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30036                 LDKLogger_JCalls_cloned(&val_conv);
30037         }
30038         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
30039 }
30040
30041 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
30042         LDKChannelManagerReadArgs this_ptr_conv;
30043         this_ptr_conv.inner = untag_ptr(this_ptr);
30044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30046         this_ptr_conv.is_owned = false;
30047         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
30048         uint64_t ret_ref = 0;
30049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30051         return ret_ref;
30052 }
30053
30054 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
30055         LDKChannelManagerReadArgs this_ptr_conv;
30056         this_ptr_conv.inner = untag_ptr(this_ptr);
30057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30059         this_ptr_conv.is_owned = false;
30060         LDKUserConfig val_conv;
30061         val_conv.inner = untag_ptr(val);
30062         val_conv.is_owned = ptr_is_owned(val);
30063         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30064         val_conv = UserConfig_clone(&val_conv);
30065         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
30066 }
30067
30068 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) {
30069         void* entropy_source_ptr = untag_ptr(entropy_source);
30070         CHECK_ACCESS(entropy_source_ptr);
30071         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
30072         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
30073                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30074                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
30075         }
30076         void* node_signer_ptr = untag_ptr(node_signer);
30077         CHECK_ACCESS(node_signer_ptr);
30078         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
30079         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
30080                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30081                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
30082         }
30083         void* signer_provider_ptr = untag_ptr(signer_provider);
30084         CHECK_ACCESS(signer_provider_ptr);
30085         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
30086         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
30087                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30088                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
30089         }
30090         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30091         CHECK_ACCESS(fee_estimator_ptr);
30092         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30093         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30094                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30095                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30096         }
30097         void* chain_monitor_ptr = untag_ptr(chain_monitor);
30098         CHECK_ACCESS(chain_monitor_ptr);
30099         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30100         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30101                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30102                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30103         }
30104         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
30105         CHECK_ACCESS(tx_broadcaster_ptr);
30106         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30107         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30108                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30109                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30110         }
30111         void* router_ptr = untag_ptr(router);
30112         CHECK_ACCESS(router_ptr);
30113         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
30114         if (router_conv.free == LDKRouter_JCalls_free) {
30115                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30116                 LDKRouter_JCalls_cloned(&router_conv);
30117         }
30118         void* logger_ptr = untag_ptr(logger);
30119         CHECK_ACCESS(logger_ptr);
30120         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30121         if (logger_conv.free == LDKLogger_JCalls_free) {
30122                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30123                 LDKLogger_JCalls_cloned(&logger_conv);
30124         }
30125         LDKUserConfig default_config_conv;
30126         default_config_conv.inner = untag_ptr(default_config);
30127         default_config_conv.is_owned = ptr_is_owned(default_config);
30128         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30129         default_config_conv = UserConfig_clone(&default_config_conv);
30130         LDKCVec_ChannelMonitorZ channel_monitors_constr;
30131         channel_monitors_constr.datalen = channel_monitors->arr_len;
30132         if (channel_monitors_constr.datalen > 0)
30133                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30134         else
30135                 channel_monitors_constr.data = NULL;
30136         uint64_t* channel_monitors_vals = channel_monitors->elems;
30137         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30138                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30139                 LDKChannelMonitor channel_monitors_conv_16_conv;
30140                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
30141                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
30142                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30143                 channel_monitors_conv_16_conv.is_owned = false;
30144                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30145         }
30146         FREE(channel_monitors);
30147         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);
30148         uint64_t ret_ref = 0;
30149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30151         return ret_ref;
30152 }
30153
30154 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
30155         LDKu8slice ser_ref;
30156         ser_ref.datalen = ser->arr_len;
30157         ser_ref.data = ser->elems;
30158         LDKChannelManagerReadArgs arg_conv;
30159         arg_conv.inner = untag_ptr(arg);
30160         arg_conv.is_owned = ptr_is_owned(arg);
30161         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30162         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30163         
30164         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30165         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30166         FREE(ser);
30167         return tag_ptr(ret_conv, true);
30168 }
30169
30170 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
30171         LDKExpandedKey this_obj_conv;
30172         this_obj_conv.inner = untag_ptr(this_obj);
30173         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30175         ExpandedKey_free(this_obj_conv);
30176 }
30177
30178 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
30179         uint8_t key_material_arr[32];
30180         CHECK(key_material->arr_len == 32);
30181         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
30182         uint8_t (*key_material_ref)[32] = &key_material_arr;
30183         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30184         uint64_t ret_ref = 0;
30185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30187         return ret_ref;
30188 }
30189
30190 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) {
30191         LDKExpandedKey keys_conv;
30192         keys_conv.inner = untag_ptr(keys);
30193         keys_conv.is_owned = ptr_is_owned(keys);
30194         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30195         keys_conv.is_owned = false;
30196         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30197         CHECK_ACCESS(min_value_msat_ptr);
30198         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30199         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30200         void* entropy_source_ptr = untag_ptr(entropy_source);
30201         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
30202         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
30203         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30204         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30205         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30206         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30207         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30208         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
30209         return tag_ptr(ret_conv, true);
30210 }
30211
30212 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) {
30213         LDKExpandedKey keys_conv;
30214         keys_conv.inner = untag_ptr(keys);
30215         keys_conv.is_owned = ptr_is_owned(keys);
30216         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30217         keys_conv.is_owned = false;
30218         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30219         CHECK_ACCESS(min_value_msat_ptr);
30220         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30221         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30222         LDKThirtyTwoBytes payment_hash_ref;
30223         CHECK(payment_hash->arr_len == 32);
30224         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30225         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30226         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30227         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30228         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30229         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30230         *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);
30231         return tag_ptr(ret_conv, true);
30232 }
30233
30234 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
30235         if (!ptr_is_owned(this_ptr)) return;
30236         void* this_ptr_ptr = untag_ptr(this_ptr);
30237         CHECK_ACCESS(this_ptr_ptr);
30238         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
30239         FREE(untag_ptr(this_ptr));
30240         DecodeError_free(this_ptr_conv);
30241 }
30242
30243 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30244         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30245         *ret_copy = DecodeError_clone(arg);
30246         uint64_t ret_ref = tag_ptr(ret_copy, true);
30247         return ret_ref;
30248 }
30249 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
30250         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
30251         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
30252         return ret_conv;
30253 }
30254
30255 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
30256         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
30257         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30258         *ret_copy = DecodeError_clone(orig_conv);
30259         uint64_t ret_ref = tag_ptr(ret_copy, true);
30260         return ret_ref;
30261 }
30262
30263 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
30264         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30265         *ret_copy = DecodeError_unknown_version();
30266         uint64_t ret_ref = tag_ptr(ret_copy, true);
30267         return ret_ref;
30268 }
30269
30270 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
30271         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30272         *ret_copy = DecodeError_unknown_required_feature();
30273         uint64_t ret_ref = tag_ptr(ret_copy, true);
30274         return ret_ref;
30275 }
30276
30277 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
30278         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30279         *ret_copy = DecodeError_invalid_value();
30280         uint64_t ret_ref = tag_ptr(ret_copy, true);
30281         return ret_ref;
30282 }
30283
30284 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
30285         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30286         *ret_copy = DecodeError_short_read();
30287         uint64_t ret_ref = tag_ptr(ret_copy, true);
30288         return ret_ref;
30289 }
30290
30291 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
30292         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30293         *ret_copy = DecodeError_bad_length_descriptor();
30294         uint64_t ret_ref = tag_ptr(ret_copy, true);
30295         return ret_ref;
30296 }
30297
30298 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
30299         LDKIOError a_conv = LDKIOError_from_js(a);
30300         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30301         *ret_copy = DecodeError_io(a_conv);
30302         uint64_t ret_ref = tag_ptr(ret_copy, true);
30303         return ret_ref;
30304 }
30305
30306 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
30307         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30308         *ret_copy = DecodeError_unsupported_compression();
30309         uint64_t ret_ref = tag_ptr(ret_copy, true);
30310         return ret_ref;
30311 }
30312
30313 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
30314         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
30315         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
30316         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
30317         return ret_conv;
30318 }
30319
30320 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
30321         LDKInit this_obj_conv;
30322         this_obj_conv.inner = untag_ptr(this_obj);
30323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30325         Init_free(this_obj_conv);
30326 }
30327
30328 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
30329         LDKInit this_ptr_conv;
30330         this_ptr_conv.inner = untag_ptr(this_ptr);
30331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30333         this_ptr_conv.is_owned = false;
30334         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30335         uint64_t ret_ref = 0;
30336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30338         return ret_ref;
30339 }
30340
30341 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
30342         LDKInit this_ptr_conv;
30343         this_ptr_conv.inner = untag_ptr(this_ptr);
30344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30346         this_ptr_conv.is_owned = false;
30347         LDKInitFeatures val_conv;
30348         val_conv.inner = untag_ptr(val);
30349         val_conv.is_owned = ptr_is_owned(val);
30350         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30351         val_conv = InitFeatures_clone(&val_conv);
30352         Init_set_features(&this_ptr_conv, val_conv);
30353 }
30354
30355 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
30356         LDKInit this_ptr_conv;
30357         this_ptr_conv.inner = untag_ptr(this_ptr);
30358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30360         this_ptr_conv.is_owned = false;
30361         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30362         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30363         uint64_t ret_ref = tag_ptr(ret_copy, true);
30364         return ret_ref;
30365 }
30366
30367 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
30368         LDKInit this_ptr_conv;
30369         this_ptr_conv.inner = untag_ptr(this_ptr);
30370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30372         this_ptr_conv.is_owned = false;
30373         void* val_ptr = untag_ptr(val);
30374         CHECK_ACCESS(val_ptr);
30375         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30376         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
30377         Init_set_remote_network_address(&this_ptr_conv, val_conv);
30378 }
30379
30380 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
30381         LDKInitFeatures features_arg_conv;
30382         features_arg_conv.inner = untag_ptr(features_arg);
30383         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30384         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30385         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30386         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
30387         CHECK_ACCESS(remote_network_address_arg_ptr);
30388         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30389         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30390         uint64_t ret_ref = 0;
30391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30393         return ret_ref;
30394 }
30395
30396 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30397         LDKInit ret_var = Init_clone(arg);
30398         uint64_t ret_ref = 0;
30399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30401         return ret_ref;
30402 }
30403 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
30404         LDKInit arg_conv;
30405         arg_conv.inner = untag_ptr(arg);
30406         arg_conv.is_owned = ptr_is_owned(arg);
30407         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30408         arg_conv.is_owned = false;
30409         int64_t ret_conv = Init_clone_ptr(&arg_conv);
30410         return ret_conv;
30411 }
30412
30413 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
30414         LDKInit orig_conv;
30415         orig_conv.inner = untag_ptr(orig);
30416         orig_conv.is_owned = ptr_is_owned(orig);
30417         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30418         orig_conv.is_owned = false;
30419         LDKInit ret_var = Init_clone(&orig_conv);
30420         uint64_t ret_ref = 0;
30421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30423         return ret_ref;
30424 }
30425
30426 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
30427         LDKInit a_conv;
30428         a_conv.inner = untag_ptr(a);
30429         a_conv.is_owned = ptr_is_owned(a);
30430         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30431         a_conv.is_owned = false;
30432         LDKInit b_conv;
30433         b_conv.inner = untag_ptr(b);
30434         b_conv.is_owned = ptr_is_owned(b);
30435         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30436         b_conv.is_owned = false;
30437         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
30438         return ret_conv;
30439 }
30440
30441 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
30442         LDKErrorMessage this_obj_conv;
30443         this_obj_conv.inner = untag_ptr(this_obj);
30444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30446         ErrorMessage_free(this_obj_conv);
30447 }
30448
30449 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
30450         LDKErrorMessage this_ptr_conv;
30451         this_ptr_conv.inner = untag_ptr(this_ptr);
30452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30454         this_ptr_conv.is_owned = false;
30455         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30456         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
30457         return ret_arr;
30458 }
30459
30460 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30461         LDKErrorMessage this_ptr_conv;
30462         this_ptr_conv.inner = untag_ptr(this_ptr);
30463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30465         this_ptr_conv.is_owned = false;
30466         LDKThirtyTwoBytes val_ref;
30467         CHECK(val->arr_len == 32);
30468         memcpy(val_ref.data, val->elems, 32); FREE(val);
30469         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30470 }
30471
30472 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
30473         LDKErrorMessage 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         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30479         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30480         Str_free(ret_str);
30481         return ret_conv;
30482 }
30483
30484 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
30485         LDKErrorMessage 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 val_conv = str_ref_to_owned_c(val);
30491         ErrorMessage_set_data(&this_ptr_conv, val_conv);
30492 }
30493
30494 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30495         LDKThirtyTwoBytes channel_id_arg_ref;
30496         CHECK(channel_id_arg->arr_len == 32);
30497         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30498         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30499         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30500         uint64_t ret_ref = 0;
30501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30503         return ret_ref;
30504 }
30505
30506 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30507         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30508         uint64_t ret_ref = 0;
30509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30511         return ret_ref;
30512 }
30513 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
30514         LDKErrorMessage arg_conv;
30515         arg_conv.inner = untag_ptr(arg);
30516         arg_conv.is_owned = ptr_is_owned(arg);
30517         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30518         arg_conv.is_owned = false;
30519         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30520         return ret_conv;
30521 }
30522
30523 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
30524         LDKErrorMessage orig_conv;
30525         orig_conv.inner = untag_ptr(orig);
30526         orig_conv.is_owned = ptr_is_owned(orig);
30527         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30528         orig_conv.is_owned = false;
30529         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30530         uint64_t ret_ref = 0;
30531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30533         return ret_ref;
30534 }
30535
30536 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
30537         LDKErrorMessage a_conv;
30538         a_conv.inner = untag_ptr(a);
30539         a_conv.is_owned = ptr_is_owned(a);
30540         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30541         a_conv.is_owned = false;
30542         LDKErrorMessage b_conv;
30543         b_conv.inner = untag_ptr(b);
30544         b_conv.is_owned = ptr_is_owned(b);
30545         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30546         b_conv.is_owned = false;
30547         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
30548         return ret_conv;
30549 }
30550
30551 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
30552         LDKWarningMessage this_obj_conv;
30553         this_obj_conv.inner = untag_ptr(this_obj);
30554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30556         WarningMessage_free(this_obj_conv);
30557 }
30558
30559 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
30560         LDKWarningMessage this_ptr_conv;
30561         this_ptr_conv.inner = untag_ptr(this_ptr);
30562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30564         this_ptr_conv.is_owned = false;
30565         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30566         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
30567         return ret_arr;
30568 }
30569
30570 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30571         LDKWarningMessage this_ptr_conv;
30572         this_ptr_conv.inner = untag_ptr(this_ptr);
30573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30575         this_ptr_conv.is_owned = false;
30576         LDKThirtyTwoBytes val_ref;
30577         CHECK(val->arr_len == 32);
30578         memcpy(val_ref.data, val->elems, 32); FREE(val);
30579         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30580 }
30581
30582 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
30583         LDKWarningMessage this_ptr_conv;
30584         this_ptr_conv.inner = untag_ptr(this_ptr);
30585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30587         this_ptr_conv.is_owned = false;
30588         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30589         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30590         Str_free(ret_str);
30591         return ret_conv;
30592 }
30593
30594 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
30595         LDKWarningMessage this_ptr_conv;
30596         this_ptr_conv.inner = untag_ptr(this_ptr);
30597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30599         this_ptr_conv.is_owned = false;
30600         LDKStr val_conv = str_ref_to_owned_c(val);
30601         WarningMessage_set_data(&this_ptr_conv, val_conv);
30602 }
30603
30604 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30605         LDKThirtyTwoBytes channel_id_arg_ref;
30606         CHECK(channel_id_arg->arr_len == 32);
30607         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30608         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30609         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30610         uint64_t ret_ref = 0;
30611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30613         return ret_ref;
30614 }
30615
30616 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30617         LDKWarningMessage ret_var = WarningMessage_clone(arg);
30618         uint64_t ret_ref = 0;
30619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30621         return ret_ref;
30622 }
30623 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
30624         LDKWarningMessage arg_conv;
30625         arg_conv.inner = untag_ptr(arg);
30626         arg_conv.is_owned = ptr_is_owned(arg);
30627         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30628         arg_conv.is_owned = false;
30629         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30630         return ret_conv;
30631 }
30632
30633 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
30634         LDKWarningMessage orig_conv;
30635         orig_conv.inner = untag_ptr(orig);
30636         orig_conv.is_owned = ptr_is_owned(orig);
30637         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30638         orig_conv.is_owned = false;
30639         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30640         uint64_t ret_ref = 0;
30641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30643         return ret_ref;
30644 }
30645
30646 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
30647         LDKWarningMessage a_conv;
30648         a_conv.inner = untag_ptr(a);
30649         a_conv.is_owned = ptr_is_owned(a);
30650         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30651         a_conv.is_owned = false;
30652         LDKWarningMessage b_conv;
30653         b_conv.inner = untag_ptr(b);
30654         b_conv.is_owned = ptr_is_owned(b);
30655         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30656         b_conv.is_owned = false;
30657         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
30658         return ret_conv;
30659 }
30660
30661 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
30662         LDKPing this_obj_conv;
30663         this_obj_conv.inner = untag_ptr(this_obj);
30664         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30666         Ping_free(this_obj_conv);
30667 }
30668
30669 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
30670         LDKPing this_ptr_conv;
30671         this_ptr_conv.inner = untag_ptr(this_ptr);
30672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30674         this_ptr_conv.is_owned = false;
30675         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30676         return ret_conv;
30677 }
30678
30679 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
30680         LDKPing this_ptr_conv;
30681         this_ptr_conv.inner = untag_ptr(this_ptr);
30682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30684         this_ptr_conv.is_owned = false;
30685         Ping_set_ponglen(&this_ptr_conv, val);
30686 }
30687
30688 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
30689         LDKPing this_ptr_conv;
30690         this_ptr_conv.inner = untag_ptr(this_ptr);
30691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30693         this_ptr_conv.is_owned = false;
30694         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30695         return ret_conv;
30696 }
30697
30698 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
30699         LDKPing this_ptr_conv;
30700         this_ptr_conv.inner = untag_ptr(this_ptr);
30701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30703         this_ptr_conv.is_owned = false;
30704         Ping_set_byteslen(&this_ptr_conv, val);
30705 }
30706
30707 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
30708         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30709         uint64_t ret_ref = 0;
30710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30712         return ret_ref;
30713 }
30714
30715 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30716         LDKPing ret_var = Ping_clone(arg);
30717         uint64_t ret_ref = 0;
30718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30720         return ret_ref;
30721 }
30722 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
30723         LDKPing arg_conv;
30724         arg_conv.inner = untag_ptr(arg);
30725         arg_conv.is_owned = ptr_is_owned(arg);
30726         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30727         arg_conv.is_owned = false;
30728         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30729         return ret_conv;
30730 }
30731
30732 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
30733         LDKPing orig_conv;
30734         orig_conv.inner = untag_ptr(orig);
30735         orig_conv.is_owned = ptr_is_owned(orig);
30736         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30737         orig_conv.is_owned = false;
30738         LDKPing ret_var = Ping_clone(&orig_conv);
30739         uint64_t ret_ref = 0;
30740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30742         return ret_ref;
30743 }
30744
30745 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
30746         LDKPing a_conv;
30747         a_conv.inner = untag_ptr(a);
30748         a_conv.is_owned = ptr_is_owned(a);
30749         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30750         a_conv.is_owned = false;
30751         LDKPing b_conv;
30752         b_conv.inner = untag_ptr(b);
30753         b_conv.is_owned = ptr_is_owned(b);
30754         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30755         b_conv.is_owned = false;
30756         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
30757         return ret_conv;
30758 }
30759
30760 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
30761         LDKPong this_obj_conv;
30762         this_obj_conv.inner = untag_ptr(this_obj);
30763         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30765         Pong_free(this_obj_conv);
30766 }
30767
30768 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
30769         LDKPong this_ptr_conv;
30770         this_ptr_conv.inner = untag_ptr(this_ptr);
30771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30773         this_ptr_conv.is_owned = false;
30774         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30775         return ret_conv;
30776 }
30777
30778 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
30779         LDKPong this_ptr_conv;
30780         this_ptr_conv.inner = untag_ptr(this_ptr);
30781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30783         this_ptr_conv.is_owned = false;
30784         Pong_set_byteslen(&this_ptr_conv, val);
30785 }
30786
30787 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
30788         LDKPong ret_var = Pong_new(byteslen_arg);
30789         uint64_t ret_ref = 0;
30790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30792         return ret_ref;
30793 }
30794
30795 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30796         LDKPong ret_var = Pong_clone(arg);
30797         uint64_t ret_ref = 0;
30798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30800         return ret_ref;
30801 }
30802 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
30803         LDKPong arg_conv;
30804         arg_conv.inner = untag_ptr(arg);
30805         arg_conv.is_owned = ptr_is_owned(arg);
30806         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30807         arg_conv.is_owned = false;
30808         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30809         return ret_conv;
30810 }
30811
30812 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
30813         LDKPong orig_conv;
30814         orig_conv.inner = untag_ptr(orig);
30815         orig_conv.is_owned = ptr_is_owned(orig);
30816         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30817         orig_conv.is_owned = false;
30818         LDKPong ret_var = Pong_clone(&orig_conv);
30819         uint64_t ret_ref = 0;
30820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30822         return ret_ref;
30823 }
30824
30825 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
30826         LDKPong a_conv;
30827         a_conv.inner = untag_ptr(a);
30828         a_conv.is_owned = ptr_is_owned(a);
30829         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30830         a_conv.is_owned = false;
30831         LDKPong b_conv;
30832         b_conv.inner = untag_ptr(b);
30833         b_conv.is_owned = ptr_is_owned(b);
30834         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30835         b_conv.is_owned = false;
30836         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
30837         return ret_conv;
30838 }
30839
30840 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
30841         LDKOpenChannel this_obj_conv;
30842         this_obj_conv.inner = untag_ptr(this_obj);
30843         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30845         OpenChannel_free(this_obj_conv);
30846 }
30847
30848 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
30849         LDKOpenChannel this_ptr_conv;
30850         this_ptr_conv.inner = untag_ptr(this_ptr);
30851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30853         this_ptr_conv.is_owned = false;
30854         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30855         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
30856         return ret_arr;
30857 }
30858
30859 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30860         LDKOpenChannel this_ptr_conv;
30861         this_ptr_conv.inner = untag_ptr(this_ptr);
30862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30864         this_ptr_conv.is_owned = false;
30865         LDKThirtyTwoBytes val_ref;
30866         CHECK(val->arr_len == 32);
30867         memcpy(val_ref.data, val->elems, 32); FREE(val);
30868         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30869 }
30870
30871 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
30872         LDKOpenChannel this_ptr_conv;
30873         this_ptr_conv.inner = untag_ptr(this_ptr);
30874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30876         this_ptr_conv.is_owned = false;
30877         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30878         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30879         return ret_arr;
30880 }
30881
30882 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray 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         LDKThirtyTwoBytes val_ref;
30889         CHECK(val->arr_len == 32);
30890         memcpy(val_ref.data, val->elems, 32); FREE(val);
30891         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30892 }
30893
30894 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
30895         LDKOpenChannel this_ptr_conv;
30896         this_ptr_conv.inner = untag_ptr(this_ptr);
30897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30899         this_ptr_conv.is_owned = false;
30900         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30901         return ret_conv;
30902 }
30903
30904 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
30905         LDKOpenChannel this_ptr_conv;
30906         this_ptr_conv.inner = untag_ptr(this_ptr);
30907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30909         this_ptr_conv.is_owned = false;
30910         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30911 }
30912
30913 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
30914         LDKOpenChannel this_ptr_conv;
30915         this_ptr_conv.inner = untag_ptr(this_ptr);
30916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30918         this_ptr_conv.is_owned = false;
30919         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30920         return ret_conv;
30921 }
30922
30923 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
30924         LDKOpenChannel this_ptr_conv;
30925         this_ptr_conv.inner = untag_ptr(this_ptr);
30926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30928         this_ptr_conv.is_owned = false;
30929         OpenChannel_set_push_msat(&this_ptr_conv, val);
30930 }
30931
30932 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30933         LDKOpenChannel this_ptr_conv;
30934         this_ptr_conv.inner = untag_ptr(this_ptr);
30935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30937         this_ptr_conv.is_owned = false;
30938         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30939         return ret_conv;
30940 }
30941
30942 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30943         LDKOpenChannel this_ptr_conv;
30944         this_ptr_conv.inner = untag_ptr(this_ptr);
30945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30947         this_ptr_conv.is_owned = false;
30948         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30949 }
30950
30951 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) {
30952         LDKOpenChannel this_ptr_conv;
30953         this_ptr_conv.inner = untag_ptr(this_ptr);
30954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30956         this_ptr_conv.is_owned = false;
30957         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30958         return ret_conv;
30959 }
30960
30961 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) {
30962         LDKOpenChannel this_ptr_conv;
30963         this_ptr_conv.inner = untag_ptr(this_ptr);
30964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30966         this_ptr_conv.is_owned = false;
30967         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30968 }
30969
30970 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30971         LDKOpenChannel this_ptr_conv;
30972         this_ptr_conv.inner = untag_ptr(this_ptr);
30973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30975         this_ptr_conv.is_owned = false;
30976         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30977         return ret_conv;
30978 }
30979
30980 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
30981         LDKOpenChannel this_ptr_conv;
30982         this_ptr_conv.inner = untag_ptr(this_ptr);
30983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30985         this_ptr_conv.is_owned = false;
30986         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30987 }
30988
30989 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30990         LDKOpenChannel this_ptr_conv;
30991         this_ptr_conv.inner = untag_ptr(this_ptr);
30992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30994         this_ptr_conv.is_owned = false;
30995         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30996         return ret_conv;
30997 }
30998
30999 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
31000         LDKOpenChannel this_ptr_conv;
31001         this_ptr_conv.inner = untag_ptr(this_ptr);
31002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31004         this_ptr_conv.is_owned = false;
31005         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31006 }
31007
31008 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
31009         LDKOpenChannel this_ptr_conv;
31010         this_ptr_conv.inner = untag_ptr(this_ptr);
31011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31013         this_ptr_conv.is_owned = false;
31014         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
31015         return ret_conv;
31016 }
31017
31018 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
31019         LDKOpenChannel this_ptr_conv;
31020         this_ptr_conv.inner = untag_ptr(this_ptr);
31021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31023         this_ptr_conv.is_owned = false;
31024         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
31025 }
31026
31027 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
31028         LDKOpenChannel this_ptr_conv;
31029         this_ptr_conv.inner = untag_ptr(this_ptr);
31030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31032         this_ptr_conv.is_owned = false;
31033         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
31034         return ret_conv;
31035 }
31036
31037 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
31038         LDKOpenChannel this_ptr_conv;
31039         this_ptr_conv.inner = untag_ptr(this_ptr);
31040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31042         this_ptr_conv.is_owned = false;
31043         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
31044 }
31045
31046 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
31047         LDKOpenChannel this_ptr_conv;
31048         this_ptr_conv.inner = untag_ptr(this_ptr);
31049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31051         this_ptr_conv.is_owned = false;
31052         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
31053         return ret_conv;
31054 }
31055
31056 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
31057         LDKOpenChannel this_ptr_conv;
31058         this_ptr_conv.inner = untag_ptr(this_ptr);
31059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31061         this_ptr_conv.is_owned = false;
31062         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31063 }
31064
31065 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
31066         LDKOpenChannel this_ptr_conv;
31067         this_ptr_conv.inner = untag_ptr(this_ptr);
31068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31070         this_ptr_conv.is_owned = false;
31071         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31072         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
31073         return ret_arr;
31074 }
31075
31076 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
31077         LDKOpenChannel this_ptr_conv;
31078         this_ptr_conv.inner = untag_ptr(this_ptr);
31079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31081         this_ptr_conv.is_owned = false;
31082         LDKPublicKey val_ref;
31083         CHECK(val->arr_len == 33);
31084         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31085         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31086 }
31087
31088 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
31089         LDKOpenChannel this_ptr_conv;
31090         this_ptr_conv.inner = untag_ptr(this_ptr);
31091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31093         this_ptr_conv.is_owned = false;
31094         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31095         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
31096         return ret_arr;
31097 }
31098
31099 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31100         LDKOpenChannel this_ptr_conv;
31101         this_ptr_conv.inner = untag_ptr(this_ptr);
31102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31104         this_ptr_conv.is_owned = false;
31105         LDKPublicKey val_ref;
31106         CHECK(val->arr_len == 33);
31107         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31108         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31109 }
31110
31111 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
31112         LDKOpenChannel this_ptr_conv;
31113         this_ptr_conv.inner = untag_ptr(this_ptr);
31114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31116         this_ptr_conv.is_owned = false;
31117         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31118         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31119         return ret_arr;
31120 }
31121
31122 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31123         LDKOpenChannel this_ptr_conv;
31124         this_ptr_conv.inner = untag_ptr(this_ptr);
31125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31127         this_ptr_conv.is_owned = false;
31128         LDKPublicKey val_ref;
31129         CHECK(val->arr_len == 33);
31130         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31131         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31132 }
31133
31134 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31135         LDKOpenChannel this_ptr_conv;
31136         this_ptr_conv.inner = untag_ptr(this_ptr);
31137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31139         this_ptr_conv.is_owned = false;
31140         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31141         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31142         return ret_arr;
31143 }
31144
31145 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31146         LDKOpenChannel this_ptr_conv;
31147         this_ptr_conv.inner = untag_ptr(this_ptr);
31148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31150         this_ptr_conv.is_owned = false;
31151         LDKPublicKey val_ref;
31152         CHECK(val->arr_len == 33);
31153         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31154         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31155 }
31156
31157 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
31158         LDKOpenChannel this_ptr_conv;
31159         this_ptr_conv.inner = untag_ptr(this_ptr);
31160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31162         this_ptr_conv.is_owned = false;
31163         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31164         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31165         return ret_arr;
31166 }
31167
31168 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31169         LDKOpenChannel this_ptr_conv;
31170         this_ptr_conv.inner = untag_ptr(this_ptr);
31171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31173         this_ptr_conv.is_owned = false;
31174         LDKPublicKey val_ref;
31175         CHECK(val->arr_len == 33);
31176         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31177         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31178 }
31179
31180 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31181         LDKOpenChannel this_ptr_conv;
31182         this_ptr_conv.inner = untag_ptr(this_ptr);
31183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31185         this_ptr_conv.is_owned = false;
31186         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31187         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31188         return ret_arr;
31189 }
31190
31191 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) {
31192         LDKOpenChannel this_ptr_conv;
31193         this_ptr_conv.inner = untag_ptr(this_ptr);
31194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31196         this_ptr_conv.is_owned = false;
31197         LDKPublicKey val_ref;
31198         CHECK(val->arr_len == 33);
31199         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31200         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31201 }
31202
31203 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
31204         LDKOpenChannel this_ptr_conv;
31205         this_ptr_conv.inner = untag_ptr(this_ptr);
31206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31208         this_ptr_conv.is_owned = false;
31209         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31210         return ret_conv;
31211 }
31212
31213 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
31214         LDKOpenChannel this_ptr_conv;
31215         this_ptr_conv.inner = untag_ptr(this_ptr);
31216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31218         this_ptr_conv.is_owned = false;
31219         OpenChannel_set_channel_flags(&this_ptr_conv, val);
31220 }
31221
31222 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
31223         LDKOpenChannel this_ptr_conv;
31224         this_ptr_conv.inner = untag_ptr(this_ptr);
31225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31227         this_ptr_conv.is_owned = false;
31228         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31229         uint64_t ret_ref = 0;
31230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31232         return ret_ref;
31233 }
31234
31235 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31236         LDKOpenChannel this_ptr_conv;
31237         this_ptr_conv.inner = untag_ptr(this_ptr);
31238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31240         this_ptr_conv.is_owned = false;
31241         LDKChannelTypeFeatures val_conv;
31242         val_conv.inner = untag_ptr(val);
31243         val_conv.is_owned = ptr_is_owned(val);
31244         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31245         val_conv = ChannelTypeFeatures_clone(&val_conv);
31246         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31247 }
31248
31249 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31250         LDKOpenChannel ret_var = OpenChannel_clone(arg);
31251         uint64_t ret_ref = 0;
31252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31254         return ret_ref;
31255 }
31256 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
31257         LDKOpenChannel arg_conv;
31258         arg_conv.inner = untag_ptr(arg);
31259         arg_conv.is_owned = ptr_is_owned(arg);
31260         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31261         arg_conv.is_owned = false;
31262         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31263         return ret_conv;
31264 }
31265
31266 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
31267         LDKOpenChannel orig_conv;
31268         orig_conv.inner = untag_ptr(orig);
31269         orig_conv.is_owned = ptr_is_owned(orig);
31270         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31271         orig_conv.is_owned = false;
31272         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31273         uint64_t ret_ref = 0;
31274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31276         return ret_ref;
31277 }
31278
31279 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
31280         LDKOpenChannel a_conv;
31281         a_conv.inner = untag_ptr(a);
31282         a_conv.is_owned = ptr_is_owned(a);
31283         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31284         a_conv.is_owned = false;
31285         LDKOpenChannel b_conv;
31286         b_conv.inner = untag_ptr(b);
31287         b_conv.is_owned = ptr_is_owned(b);
31288         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31289         b_conv.is_owned = false;
31290         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
31291         return ret_conv;
31292 }
31293
31294 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
31295         LDKAcceptChannel this_obj_conv;
31296         this_obj_conv.inner = untag_ptr(this_obj);
31297         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31299         AcceptChannel_free(this_obj_conv);
31300 }
31301
31302 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
31303         LDKAcceptChannel this_ptr_conv;
31304         this_ptr_conv.inner = untag_ptr(this_ptr);
31305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31307         this_ptr_conv.is_owned = false;
31308         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31309         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
31310         return ret_arr;
31311 }
31312
31313 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray 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         LDKThirtyTwoBytes val_ref;
31320         CHECK(val->arr_len == 32);
31321         memcpy(val_ref.data, val->elems, 32); FREE(val);
31322         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31323 }
31324
31325 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
31326         LDKAcceptChannel this_ptr_conv;
31327         this_ptr_conv.inner = untag_ptr(this_ptr);
31328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31330         this_ptr_conv.is_owned = false;
31331         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31332         return ret_conv;
31333 }
31334
31335 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
31336         LDKAcceptChannel this_ptr_conv;
31337         this_ptr_conv.inner = untag_ptr(this_ptr);
31338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31340         this_ptr_conv.is_owned = false;
31341         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31342 }
31343
31344 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) {
31345         LDKAcceptChannel this_ptr_conv;
31346         this_ptr_conv.inner = untag_ptr(this_ptr);
31347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31349         this_ptr_conv.is_owned = false;
31350         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31351         return ret_conv;
31352 }
31353
31354 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) {
31355         LDKAcceptChannel this_ptr_conv;
31356         this_ptr_conv.inner = untag_ptr(this_ptr);
31357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31359         this_ptr_conv.is_owned = false;
31360         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31361 }
31362
31363 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
31364         LDKAcceptChannel this_ptr_conv;
31365         this_ptr_conv.inner = untag_ptr(this_ptr);
31366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31368         this_ptr_conv.is_owned = false;
31369         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31370         return ret_conv;
31371 }
31372
31373 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
31374         LDKAcceptChannel this_ptr_conv;
31375         this_ptr_conv.inner = untag_ptr(this_ptr);
31376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31378         this_ptr_conv.is_owned = false;
31379         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31380 }
31381
31382 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
31383         LDKAcceptChannel this_ptr_conv;
31384         this_ptr_conv.inner = untag_ptr(this_ptr);
31385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31387         this_ptr_conv.is_owned = false;
31388         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31389         return ret_conv;
31390 }
31391
31392 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
31393         LDKAcceptChannel this_ptr_conv;
31394         this_ptr_conv.inner = untag_ptr(this_ptr);
31395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31397         this_ptr_conv.is_owned = false;
31398         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31399 }
31400
31401 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
31402         LDKAcceptChannel this_ptr_conv;
31403         this_ptr_conv.inner = untag_ptr(this_ptr);
31404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31406         this_ptr_conv.is_owned = false;
31407         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31408         return ret_conv;
31409 }
31410
31411 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
31412         LDKAcceptChannel this_ptr_conv;
31413         this_ptr_conv.inner = untag_ptr(this_ptr);
31414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31416         this_ptr_conv.is_owned = false;
31417         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31418 }
31419
31420 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
31421         LDKAcceptChannel this_ptr_conv;
31422         this_ptr_conv.inner = untag_ptr(this_ptr);
31423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31425         this_ptr_conv.is_owned = false;
31426         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31427         return ret_conv;
31428 }
31429
31430 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
31431         LDKAcceptChannel this_ptr_conv;
31432         this_ptr_conv.inner = untag_ptr(this_ptr);
31433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31435         this_ptr_conv.is_owned = false;
31436         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31437 }
31438
31439 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
31440         LDKAcceptChannel this_ptr_conv;
31441         this_ptr_conv.inner = untag_ptr(this_ptr);
31442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31444         this_ptr_conv.is_owned = false;
31445         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31446         return ret_conv;
31447 }
31448
31449 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
31450         LDKAcceptChannel this_ptr_conv;
31451         this_ptr_conv.inner = untag_ptr(this_ptr);
31452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31454         this_ptr_conv.is_owned = false;
31455         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31456 }
31457
31458 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
31459         LDKAcceptChannel this_ptr_conv;
31460         this_ptr_conv.inner = untag_ptr(this_ptr);
31461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31463         this_ptr_conv.is_owned = false;
31464         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31465         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
31466         return ret_arr;
31467 }
31468
31469 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
31470         LDKAcceptChannel this_ptr_conv;
31471         this_ptr_conv.inner = untag_ptr(this_ptr);
31472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31474         this_ptr_conv.is_owned = false;
31475         LDKPublicKey val_ref;
31476         CHECK(val->arr_len == 33);
31477         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31478         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31479 }
31480
31481 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
31482         LDKAcceptChannel this_ptr_conv;
31483         this_ptr_conv.inner = untag_ptr(this_ptr);
31484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31486         this_ptr_conv.is_owned = false;
31487         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31488         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
31489         return ret_arr;
31490 }
31491
31492 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31493         LDKAcceptChannel this_ptr_conv;
31494         this_ptr_conv.inner = untag_ptr(this_ptr);
31495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31497         this_ptr_conv.is_owned = false;
31498         LDKPublicKey val_ref;
31499         CHECK(val->arr_len == 33);
31500         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31501         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31502 }
31503
31504 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
31505         LDKAcceptChannel this_ptr_conv;
31506         this_ptr_conv.inner = untag_ptr(this_ptr);
31507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31509         this_ptr_conv.is_owned = false;
31510         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31511         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31512         return ret_arr;
31513 }
31514
31515 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31516         LDKAcceptChannel this_ptr_conv;
31517         this_ptr_conv.inner = untag_ptr(this_ptr);
31518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31520         this_ptr_conv.is_owned = false;
31521         LDKPublicKey val_ref;
31522         CHECK(val->arr_len == 33);
31523         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31524         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31525 }
31526
31527 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31528         LDKAcceptChannel this_ptr_conv;
31529         this_ptr_conv.inner = untag_ptr(this_ptr);
31530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31532         this_ptr_conv.is_owned = false;
31533         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31534         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31535         return ret_arr;
31536 }
31537
31538 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31539         LDKAcceptChannel this_ptr_conv;
31540         this_ptr_conv.inner = untag_ptr(this_ptr);
31541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31543         this_ptr_conv.is_owned = false;
31544         LDKPublicKey val_ref;
31545         CHECK(val->arr_len == 33);
31546         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31547         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31548 }
31549
31550 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
31551         LDKAcceptChannel this_ptr_conv;
31552         this_ptr_conv.inner = untag_ptr(this_ptr);
31553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31555         this_ptr_conv.is_owned = false;
31556         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31557         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31558         return ret_arr;
31559 }
31560
31561 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31562         LDKAcceptChannel this_ptr_conv;
31563         this_ptr_conv.inner = untag_ptr(this_ptr);
31564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31566         this_ptr_conv.is_owned = false;
31567         LDKPublicKey val_ref;
31568         CHECK(val->arr_len == 33);
31569         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31570         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31571 }
31572
31573 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31574         LDKAcceptChannel this_ptr_conv;
31575         this_ptr_conv.inner = untag_ptr(this_ptr);
31576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31578         this_ptr_conv.is_owned = false;
31579         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31580         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31581         return ret_arr;
31582 }
31583
31584 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) {
31585         LDKAcceptChannel this_ptr_conv;
31586         this_ptr_conv.inner = untag_ptr(this_ptr);
31587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31589         this_ptr_conv.is_owned = false;
31590         LDKPublicKey val_ref;
31591         CHECK(val->arr_len == 33);
31592         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31593         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31594 }
31595
31596 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
31597         LDKAcceptChannel this_ptr_conv;
31598         this_ptr_conv.inner = untag_ptr(this_ptr);
31599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31601         this_ptr_conv.is_owned = false;
31602         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31603         uint64_t ret_ref = 0;
31604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31606         return ret_ref;
31607 }
31608
31609 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31610         LDKAcceptChannel this_ptr_conv;
31611         this_ptr_conv.inner = untag_ptr(this_ptr);
31612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31614         this_ptr_conv.is_owned = false;
31615         LDKChannelTypeFeatures val_conv;
31616         val_conv.inner = untag_ptr(val);
31617         val_conv.is_owned = ptr_is_owned(val);
31618         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31619         val_conv = ChannelTypeFeatures_clone(&val_conv);
31620         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31621 }
31622
31623 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31624         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31625         uint64_t ret_ref = 0;
31626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31628         return ret_ref;
31629 }
31630 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
31631         LDKAcceptChannel arg_conv;
31632         arg_conv.inner = untag_ptr(arg);
31633         arg_conv.is_owned = ptr_is_owned(arg);
31634         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31635         arg_conv.is_owned = false;
31636         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31637         return ret_conv;
31638 }
31639
31640 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
31641         LDKAcceptChannel orig_conv;
31642         orig_conv.inner = untag_ptr(orig);
31643         orig_conv.is_owned = ptr_is_owned(orig);
31644         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31645         orig_conv.is_owned = false;
31646         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31647         uint64_t ret_ref = 0;
31648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31650         return ret_ref;
31651 }
31652
31653 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
31654         LDKAcceptChannel a_conv;
31655         a_conv.inner = untag_ptr(a);
31656         a_conv.is_owned = ptr_is_owned(a);
31657         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31658         a_conv.is_owned = false;
31659         LDKAcceptChannel b_conv;
31660         b_conv.inner = untag_ptr(b);
31661         b_conv.is_owned = ptr_is_owned(b);
31662         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31663         b_conv.is_owned = false;
31664         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
31665         return ret_conv;
31666 }
31667
31668 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
31669         LDKFundingCreated this_obj_conv;
31670         this_obj_conv.inner = untag_ptr(this_obj);
31671         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31673         FundingCreated_free(this_obj_conv);
31674 }
31675
31676 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
31677         LDKFundingCreated this_ptr_conv;
31678         this_ptr_conv.inner = untag_ptr(this_ptr);
31679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31681         this_ptr_conv.is_owned = false;
31682         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31683         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
31684         return ret_arr;
31685 }
31686
31687 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31688         LDKFundingCreated this_ptr_conv;
31689         this_ptr_conv.inner = untag_ptr(this_ptr);
31690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31692         this_ptr_conv.is_owned = false;
31693         LDKThirtyTwoBytes val_ref;
31694         CHECK(val->arr_len == 32);
31695         memcpy(val_ref.data, val->elems, 32); FREE(val);
31696         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31697 }
31698
31699 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
31700         LDKFundingCreated this_ptr_conv;
31701         this_ptr_conv.inner = untag_ptr(this_ptr);
31702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31704         this_ptr_conv.is_owned = false;
31705         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31706         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
31707         return ret_arr;
31708 }
31709
31710 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
31711         LDKFundingCreated this_ptr_conv;
31712         this_ptr_conv.inner = untag_ptr(this_ptr);
31713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31715         this_ptr_conv.is_owned = false;
31716         LDKThirtyTwoBytes val_ref;
31717         CHECK(val->arr_len == 32);
31718         memcpy(val_ref.data, val->elems, 32); FREE(val);
31719         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31720 }
31721
31722 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
31723         LDKFundingCreated this_ptr_conv;
31724         this_ptr_conv.inner = untag_ptr(this_ptr);
31725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31727         this_ptr_conv.is_owned = false;
31728         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31729         return ret_conv;
31730 }
31731
31732 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
31733         LDKFundingCreated this_ptr_conv;
31734         this_ptr_conv.inner = untag_ptr(this_ptr);
31735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31737         this_ptr_conv.is_owned = false;
31738         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31739 }
31740
31741 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
31742         LDKFundingCreated this_ptr_conv;
31743         this_ptr_conv.inner = untag_ptr(this_ptr);
31744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31746         this_ptr_conv.is_owned = false;
31747         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31748         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
31749         return ret_arr;
31750 }
31751
31752 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
31753         LDKFundingCreated this_ptr_conv;
31754         this_ptr_conv.inner = untag_ptr(this_ptr);
31755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31757         this_ptr_conv.is_owned = false;
31758         LDKSignature val_ref;
31759         CHECK(val->arr_len == 64);
31760         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31761         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31762 }
31763
31764 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) {
31765         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31766         CHECK(temporary_channel_id_arg->arr_len == 32);
31767         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
31768         LDKThirtyTwoBytes funding_txid_arg_ref;
31769         CHECK(funding_txid_arg->arr_len == 32);
31770         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
31771         LDKSignature signature_arg_ref;
31772         CHECK(signature_arg->arr_len == 64);
31773         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31774         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31775         uint64_t ret_ref = 0;
31776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31778         return ret_ref;
31779 }
31780
31781 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31782         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31783         uint64_t ret_ref = 0;
31784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31786         return ret_ref;
31787 }
31788 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
31789         LDKFundingCreated arg_conv;
31790         arg_conv.inner = untag_ptr(arg);
31791         arg_conv.is_owned = ptr_is_owned(arg);
31792         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31793         arg_conv.is_owned = false;
31794         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31795         return ret_conv;
31796 }
31797
31798 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
31799         LDKFundingCreated orig_conv;
31800         orig_conv.inner = untag_ptr(orig);
31801         orig_conv.is_owned = ptr_is_owned(orig);
31802         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31803         orig_conv.is_owned = false;
31804         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31805         uint64_t ret_ref = 0;
31806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31808         return ret_ref;
31809 }
31810
31811 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
31812         LDKFundingCreated a_conv;
31813         a_conv.inner = untag_ptr(a);
31814         a_conv.is_owned = ptr_is_owned(a);
31815         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31816         a_conv.is_owned = false;
31817         LDKFundingCreated b_conv;
31818         b_conv.inner = untag_ptr(b);
31819         b_conv.is_owned = ptr_is_owned(b);
31820         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31821         b_conv.is_owned = false;
31822         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
31823         return ret_conv;
31824 }
31825
31826 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
31827         LDKFundingSigned this_obj_conv;
31828         this_obj_conv.inner = untag_ptr(this_obj);
31829         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31831         FundingSigned_free(this_obj_conv);
31832 }
31833
31834 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
31835         LDKFundingSigned this_ptr_conv;
31836         this_ptr_conv.inner = untag_ptr(this_ptr);
31837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31839         this_ptr_conv.is_owned = false;
31840         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31841         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
31842         return ret_arr;
31843 }
31844
31845 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31846         LDKFundingSigned this_ptr_conv;
31847         this_ptr_conv.inner = untag_ptr(this_ptr);
31848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31850         this_ptr_conv.is_owned = false;
31851         LDKThirtyTwoBytes val_ref;
31852         CHECK(val->arr_len == 32);
31853         memcpy(val_ref.data, val->elems, 32); FREE(val);
31854         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31855 }
31856
31857 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
31858         LDKFundingSigned this_ptr_conv;
31859         this_ptr_conv.inner = untag_ptr(this_ptr);
31860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31862         this_ptr_conv.is_owned = false;
31863         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31864         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31865         return ret_arr;
31866 }
31867
31868 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31869         LDKFundingSigned this_ptr_conv;
31870         this_ptr_conv.inner = untag_ptr(this_ptr);
31871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31873         this_ptr_conv.is_owned = false;
31874         LDKSignature val_ref;
31875         CHECK(val->arr_len == 64);
31876         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31877         FundingSigned_set_signature(&this_ptr_conv, val_ref);
31878 }
31879
31880 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
31881         LDKThirtyTwoBytes channel_id_arg_ref;
31882         CHECK(channel_id_arg->arr_len == 32);
31883         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31884         LDKSignature signature_arg_ref;
31885         CHECK(signature_arg->arr_len == 64);
31886         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31887         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31888         uint64_t ret_ref = 0;
31889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31891         return ret_ref;
31892 }
31893
31894 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31895         LDKFundingSigned ret_var = FundingSigned_clone(arg);
31896         uint64_t ret_ref = 0;
31897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31899         return ret_ref;
31900 }
31901 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
31902         LDKFundingSigned arg_conv;
31903         arg_conv.inner = untag_ptr(arg);
31904         arg_conv.is_owned = ptr_is_owned(arg);
31905         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31906         arg_conv.is_owned = false;
31907         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31908         return ret_conv;
31909 }
31910
31911 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
31912         LDKFundingSigned orig_conv;
31913         orig_conv.inner = untag_ptr(orig);
31914         orig_conv.is_owned = ptr_is_owned(orig);
31915         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31916         orig_conv.is_owned = false;
31917         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31918         uint64_t ret_ref = 0;
31919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31921         return ret_ref;
31922 }
31923
31924 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
31925         LDKFundingSigned a_conv;
31926         a_conv.inner = untag_ptr(a);
31927         a_conv.is_owned = ptr_is_owned(a);
31928         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31929         a_conv.is_owned = false;
31930         LDKFundingSigned b_conv;
31931         b_conv.inner = untag_ptr(b);
31932         b_conv.is_owned = ptr_is_owned(b);
31933         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31934         b_conv.is_owned = false;
31935         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
31936         return ret_conv;
31937 }
31938
31939 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
31940         LDKChannelReady this_obj_conv;
31941         this_obj_conv.inner = untag_ptr(this_obj);
31942         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31944         ChannelReady_free(this_obj_conv);
31945 }
31946
31947 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
31948         LDKChannelReady this_ptr_conv;
31949         this_ptr_conv.inner = untag_ptr(this_ptr);
31950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31952         this_ptr_conv.is_owned = false;
31953         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31954         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
31955         return ret_arr;
31956 }
31957
31958 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31959         LDKChannelReady this_ptr_conv;
31960         this_ptr_conv.inner = untag_ptr(this_ptr);
31961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31963         this_ptr_conv.is_owned = false;
31964         LDKThirtyTwoBytes val_ref;
31965         CHECK(val->arr_len == 32);
31966         memcpy(val_ref.data, val->elems, 32); FREE(val);
31967         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
31968 }
31969
31970 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
31971         LDKChannelReady this_ptr_conv;
31972         this_ptr_conv.inner = untag_ptr(this_ptr);
31973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31975         this_ptr_conv.is_owned = false;
31976         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31977         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31978         return ret_arr;
31979 }
31980
31981 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) {
31982         LDKChannelReady this_ptr_conv;
31983         this_ptr_conv.inner = untag_ptr(this_ptr);
31984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31986         this_ptr_conv.is_owned = false;
31987         LDKPublicKey val_ref;
31988         CHECK(val->arr_len == 33);
31989         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31990         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31991 }
31992
31993 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
31994         LDKChannelReady this_ptr_conv;
31995         this_ptr_conv.inner = untag_ptr(this_ptr);
31996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31998         this_ptr_conv.is_owned = false;
31999         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32000         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
32001         uint64_t ret_ref = tag_ptr(ret_copy, true);
32002         return ret_ref;
32003 }
32004
32005 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) {
32006         LDKChannelReady this_ptr_conv;
32007         this_ptr_conv.inner = untag_ptr(this_ptr);
32008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32010         this_ptr_conv.is_owned = false;
32011         void* val_ptr = untag_ptr(val);
32012         CHECK_ACCESS(val_ptr);
32013         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32014         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32015         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
32016 }
32017
32018 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) {
32019         LDKThirtyTwoBytes channel_id_arg_ref;
32020         CHECK(channel_id_arg->arr_len == 32);
32021         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32022         LDKPublicKey next_per_commitment_point_arg_ref;
32023         CHECK(next_per_commitment_point_arg->arr_len == 33);
32024         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
32025         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
32026         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
32027         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
32028         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
32029         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
32030         uint64_t ret_ref = 0;
32031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32033         return ret_ref;
32034 }
32035
32036 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
32037         LDKChannelReady ret_var = ChannelReady_clone(arg);
32038         uint64_t ret_ref = 0;
32039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32041         return ret_ref;
32042 }
32043 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
32044         LDKChannelReady arg_conv;
32045         arg_conv.inner = untag_ptr(arg);
32046         arg_conv.is_owned = ptr_is_owned(arg);
32047         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32048         arg_conv.is_owned = false;
32049         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
32050         return ret_conv;
32051 }
32052
32053 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
32054         LDKChannelReady orig_conv;
32055         orig_conv.inner = untag_ptr(orig);
32056         orig_conv.is_owned = ptr_is_owned(orig);
32057         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32058         orig_conv.is_owned = false;
32059         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
32060         uint64_t ret_ref = 0;
32061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32063         return ret_ref;
32064 }
32065
32066 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
32067         LDKChannelReady a_conv;
32068         a_conv.inner = untag_ptr(a);
32069         a_conv.is_owned = ptr_is_owned(a);
32070         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32071         a_conv.is_owned = false;
32072         LDKChannelReady b_conv;
32073         b_conv.inner = untag_ptr(b);
32074         b_conv.is_owned = ptr_is_owned(b);
32075         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32076         b_conv.is_owned = false;
32077         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
32078         return ret_conv;
32079 }
32080
32081 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
32082         LDKShutdown this_obj_conv;
32083         this_obj_conv.inner = untag_ptr(this_obj);
32084         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32086         Shutdown_free(this_obj_conv);
32087 }
32088
32089 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
32090         LDKShutdown this_ptr_conv;
32091         this_ptr_conv.inner = untag_ptr(this_ptr);
32092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32094         this_ptr_conv.is_owned = false;
32095         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32096         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
32097         return ret_arr;
32098 }
32099
32100 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32101         LDKShutdown this_ptr_conv;
32102         this_ptr_conv.inner = untag_ptr(this_ptr);
32103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32105         this_ptr_conv.is_owned = false;
32106         LDKThirtyTwoBytes val_ref;
32107         CHECK(val->arr_len == 32);
32108         memcpy(val_ref.data, val->elems, 32); FREE(val);
32109         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
32110 }
32111
32112 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
32113         LDKShutdown this_ptr_conv;
32114         this_ptr_conv.inner = untag_ptr(this_ptr);
32115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32117         this_ptr_conv.is_owned = false;
32118         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32119         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32120         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32121         return ret_arr;
32122 }
32123
32124 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
32125         LDKShutdown this_ptr_conv;
32126         this_ptr_conv.inner = untag_ptr(this_ptr);
32127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32129         this_ptr_conv.is_owned = false;
32130         LDKCVec_u8Z val_ref;
32131         val_ref.datalen = val->arr_len;
32132         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32133         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32134         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32135 }
32136
32137 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32138         LDKThirtyTwoBytes channel_id_arg_ref;
32139         CHECK(channel_id_arg->arr_len == 32);
32140         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32141         LDKCVec_u8Z scriptpubkey_arg_ref;
32142         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
32143         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32144         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
32145         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32146         uint64_t ret_ref = 0;
32147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32149         return ret_ref;
32150 }
32151
32152 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32153         LDKShutdown ret_var = Shutdown_clone(arg);
32154         uint64_t ret_ref = 0;
32155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32157         return ret_ref;
32158 }
32159 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
32160         LDKShutdown arg_conv;
32161         arg_conv.inner = untag_ptr(arg);
32162         arg_conv.is_owned = ptr_is_owned(arg);
32163         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32164         arg_conv.is_owned = false;
32165         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32166         return ret_conv;
32167 }
32168
32169 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
32170         LDKShutdown orig_conv;
32171         orig_conv.inner = untag_ptr(orig);
32172         orig_conv.is_owned = ptr_is_owned(orig);
32173         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32174         orig_conv.is_owned = false;
32175         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32176         uint64_t ret_ref = 0;
32177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32179         return ret_ref;
32180 }
32181
32182 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
32183         LDKShutdown a_conv;
32184         a_conv.inner = untag_ptr(a);
32185         a_conv.is_owned = ptr_is_owned(a);
32186         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32187         a_conv.is_owned = false;
32188         LDKShutdown b_conv;
32189         b_conv.inner = untag_ptr(b);
32190         b_conv.is_owned = ptr_is_owned(b);
32191         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32192         b_conv.is_owned = false;
32193         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
32194         return ret_conv;
32195 }
32196
32197 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
32198         LDKClosingSignedFeeRange this_obj_conv;
32199         this_obj_conv.inner = untag_ptr(this_obj);
32200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32202         ClosingSignedFeeRange_free(this_obj_conv);
32203 }
32204
32205 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
32206         LDKClosingSignedFeeRange this_ptr_conv;
32207         this_ptr_conv.inner = untag_ptr(this_ptr);
32208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32210         this_ptr_conv.is_owned = false;
32211         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32212         return ret_conv;
32213 }
32214
32215 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
32216         LDKClosingSignedFeeRange this_ptr_conv;
32217         this_ptr_conv.inner = untag_ptr(this_ptr);
32218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32220         this_ptr_conv.is_owned = false;
32221         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32222 }
32223
32224 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
32225         LDKClosingSignedFeeRange this_ptr_conv;
32226         this_ptr_conv.inner = untag_ptr(this_ptr);
32227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32229         this_ptr_conv.is_owned = false;
32230         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32231         return ret_conv;
32232 }
32233
32234 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
32235         LDKClosingSignedFeeRange this_ptr_conv;
32236         this_ptr_conv.inner = untag_ptr(this_ptr);
32237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32239         this_ptr_conv.is_owned = false;
32240         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32241 }
32242
32243 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
32244         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32245         uint64_t ret_ref = 0;
32246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32248         return ret_ref;
32249 }
32250
32251 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32252         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32253         uint64_t ret_ref = 0;
32254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32256         return ret_ref;
32257 }
32258 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
32259         LDKClosingSignedFeeRange arg_conv;
32260         arg_conv.inner = untag_ptr(arg);
32261         arg_conv.is_owned = ptr_is_owned(arg);
32262         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32263         arg_conv.is_owned = false;
32264         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32265         return ret_conv;
32266 }
32267
32268 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
32269         LDKClosingSignedFeeRange orig_conv;
32270         orig_conv.inner = untag_ptr(orig);
32271         orig_conv.is_owned = ptr_is_owned(orig);
32272         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32273         orig_conv.is_owned = false;
32274         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32275         uint64_t ret_ref = 0;
32276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32278         return ret_ref;
32279 }
32280
32281 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
32282         LDKClosingSignedFeeRange a_conv;
32283         a_conv.inner = untag_ptr(a);
32284         a_conv.is_owned = ptr_is_owned(a);
32285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32286         a_conv.is_owned = false;
32287         LDKClosingSignedFeeRange b_conv;
32288         b_conv.inner = untag_ptr(b);
32289         b_conv.is_owned = ptr_is_owned(b);
32290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32291         b_conv.is_owned = false;
32292         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
32293         return ret_conv;
32294 }
32295
32296 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
32297         LDKClosingSigned this_obj_conv;
32298         this_obj_conv.inner = untag_ptr(this_obj);
32299         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32301         ClosingSigned_free(this_obj_conv);
32302 }
32303
32304 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
32305         LDKClosingSigned this_ptr_conv;
32306         this_ptr_conv.inner = untag_ptr(this_ptr);
32307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32309         this_ptr_conv.is_owned = false;
32310         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32311         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
32312         return ret_arr;
32313 }
32314
32315 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32316         LDKClosingSigned this_ptr_conv;
32317         this_ptr_conv.inner = untag_ptr(this_ptr);
32318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32320         this_ptr_conv.is_owned = false;
32321         LDKThirtyTwoBytes val_ref;
32322         CHECK(val->arr_len == 32);
32323         memcpy(val_ref.data, val->elems, 32); FREE(val);
32324         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32325 }
32326
32327 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
32328         LDKClosingSigned this_ptr_conv;
32329         this_ptr_conv.inner = untag_ptr(this_ptr);
32330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32332         this_ptr_conv.is_owned = false;
32333         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32334         return ret_conv;
32335 }
32336
32337 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
32338         LDKClosingSigned this_ptr_conv;
32339         this_ptr_conv.inner = untag_ptr(this_ptr);
32340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32342         this_ptr_conv.is_owned = false;
32343         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32344 }
32345
32346 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
32347         LDKClosingSigned this_ptr_conv;
32348         this_ptr_conv.inner = untag_ptr(this_ptr);
32349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32351         this_ptr_conv.is_owned = false;
32352         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32353         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
32354         return ret_arr;
32355 }
32356
32357 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32358         LDKClosingSigned this_ptr_conv;
32359         this_ptr_conv.inner = untag_ptr(this_ptr);
32360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32362         this_ptr_conv.is_owned = false;
32363         LDKSignature val_ref;
32364         CHECK(val->arr_len == 64);
32365         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32366         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32367 }
32368
32369 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
32370         LDKClosingSigned this_ptr_conv;
32371         this_ptr_conv.inner = untag_ptr(this_ptr);
32372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32374         this_ptr_conv.is_owned = false;
32375         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32376         uint64_t ret_ref = 0;
32377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32379         return ret_ref;
32380 }
32381
32382 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
32383         LDKClosingSigned this_ptr_conv;
32384         this_ptr_conv.inner = untag_ptr(this_ptr);
32385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32387         this_ptr_conv.is_owned = false;
32388         LDKClosingSignedFeeRange val_conv;
32389         val_conv.inner = untag_ptr(val);
32390         val_conv.is_owned = ptr_is_owned(val);
32391         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32392         val_conv = ClosingSignedFeeRange_clone(&val_conv);
32393         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32394 }
32395
32396 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) {
32397         LDKThirtyTwoBytes channel_id_arg_ref;
32398         CHECK(channel_id_arg->arr_len == 32);
32399         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32400         LDKSignature signature_arg_ref;
32401         CHECK(signature_arg->arr_len == 64);
32402         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32403         LDKClosingSignedFeeRange fee_range_arg_conv;
32404         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
32405         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
32406         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32407         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32408         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
32409         uint64_t ret_ref = 0;
32410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32412         return ret_ref;
32413 }
32414
32415 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32416         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
32417         uint64_t ret_ref = 0;
32418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32420         return ret_ref;
32421 }
32422 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
32423         LDKClosingSigned arg_conv;
32424         arg_conv.inner = untag_ptr(arg);
32425         arg_conv.is_owned = ptr_is_owned(arg);
32426         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32427         arg_conv.is_owned = false;
32428         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
32429         return ret_conv;
32430 }
32431
32432 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
32433         LDKClosingSigned orig_conv;
32434         orig_conv.inner = untag_ptr(orig);
32435         orig_conv.is_owned = ptr_is_owned(orig);
32436         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32437         orig_conv.is_owned = false;
32438         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
32439         uint64_t ret_ref = 0;
32440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32442         return ret_ref;
32443 }
32444
32445 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
32446         LDKClosingSigned a_conv;
32447         a_conv.inner = untag_ptr(a);
32448         a_conv.is_owned = ptr_is_owned(a);
32449         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32450         a_conv.is_owned = false;
32451         LDKClosingSigned b_conv;
32452         b_conv.inner = untag_ptr(b);
32453         b_conv.is_owned = ptr_is_owned(b);
32454         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32455         b_conv.is_owned = false;
32456         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
32457         return ret_conv;
32458 }
32459
32460 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
32461         LDKUpdateAddHTLC this_obj_conv;
32462         this_obj_conv.inner = untag_ptr(this_obj);
32463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32465         UpdateAddHTLC_free(this_obj_conv);
32466 }
32467
32468 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
32469         LDKUpdateAddHTLC this_ptr_conv;
32470         this_ptr_conv.inner = untag_ptr(this_ptr);
32471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32473         this_ptr_conv.is_owned = false;
32474         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32475         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
32476         return ret_arr;
32477 }
32478
32479 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32480         LDKUpdateAddHTLC this_ptr_conv;
32481         this_ptr_conv.inner = untag_ptr(this_ptr);
32482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32484         this_ptr_conv.is_owned = false;
32485         LDKThirtyTwoBytes val_ref;
32486         CHECK(val->arr_len == 32);
32487         memcpy(val_ref.data, val->elems, 32); FREE(val);
32488         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32489 }
32490
32491 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
32492         LDKUpdateAddHTLC this_ptr_conv;
32493         this_ptr_conv.inner = untag_ptr(this_ptr);
32494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32496         this_ptr_conv.is_owned = false;
32497         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32498         return ret_conv;
32499 }
32500
32501 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32502         LDKUpdateAddHTLC this_ptr_conv;
32503         this_ptr_conv.inner = untag_ptr(this_ptr);
32504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32506         this_ptr_conv.is_owned = false;
32507         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32508 }
32509
32510 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
32511         LDKUpdateAddHTLC this_ptr_conv;
32512         this_ptr_conv.inner = untag_ptr(this_ptr);
32513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32515         this_ptr_conv.is_owned = false;
32516         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32517         return ret_conv;
32518 }
32519
32520 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
32521         LDKUpdateAddHTLC this_ptr_conv;
32522         this_ptr_conv.inner = untag_ptr(this_ptr);
32523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32525         this_ptr_conv.is_owned = false;
32526         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32527 }
32528
32529 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
32530         LDKUpdateAddHTLC this_ptr_conv;
32531         this_ptr_conv.inner = untag_ptr(this_ptr);
32532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32534         this_ptr_conv.is_owned = false;
32535         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32536         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
32537         return ret_arr;
32538 }
32539
32540 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
32541         LDKUpdateAddHTLC this_ptr_conv;
32542         this_ptr_conv.inner = untag_ptr(this_ptr);
32543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32545         this_ptr_conv.is_owned = false;
32546         LDKThirtyTwoBytes val_ref;
32547         CHECK(val->arr_len == 32);
32548         memcpy(val_ref.data, val->elems, 32); FREE(val);
32549         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32550 }
32551
32552 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
32553         LDKUpdateAddHTLC this_ptr_conv;
32554         this_ptr_conv.inner = untag_ptr(this_ptr);
32555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32557         this_ptr_conv.is_owned = false;
32558         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32559         return ret_conv;
32560 }
32561
32562 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
32563         LDKUpdateAddHTLC this_ptr_conv;
32564         this_ptr_conv.inner = untag_ptr(this_ptr);
32565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32567         this_ptr_conv.is_owned = false;
32568         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32569 }
32570
32571 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32572         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
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 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
32579         LDKUpdateAddHTLC arg_conv;
32580         arg_conv.inner = untag_ptr(arg);
32581         arg_conv.is_owned = ptr_is_owned(arg);
32582         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32583         arg_conv.is_owned = false;
32584         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32585         return ret_conv;
32586 }
32587
32588 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
32589         LDKUpdateAddHTLC orig_conv;
32590         orig_conv.inner = untag_ptr(orig);
32591         orig_conv.is_owned = ptr_is_owned(orig);
32592         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32593         orig_conv.is_owned = false;
32594         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32595         uint64_t ret_ref = 0;
32596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32598         return ret_ref;
32599 }
32600
32601 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
32602         LDKUpdateAddHTLC a_conv;
32603         a_conv.inner = untag_ptr(a);
32604         a_conv.is_owned = ptr_is_owned(a);
32605         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32606         a_conv.is_owned = false;
32607         LDKUpdateAddHTLC b_conv;
32608         b_conv.inner = untag_ptr(b);
32609         b_conv.is_owned = ptr_is_owned(b);
32610         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32611         b_conv.is_owned = false;
32612         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
32613         return ret_conv;
32614 }
32615
32616 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
32617         LDKOnionMessage this_obj_conv;
32618         this_obj_conv.inner = untag_ptr(this_obj);
32619         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32621         OnionMessage_free(this_obj_conv);
32622 }
32623
32624 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
32625         LDKOnionMessage this_ptr_conv;
32626         this_ptr_conv.inner = untag_ptr(this_ptr);
32627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32629         this_ptr_conv.is_owned = false;
32630         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32631         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
32632         return ret_arr;
32633 }
32634
32635 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
32636         LDKOnionMessage 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         LDKPublicKey val_ref;
32642         CHECK(val->arr_len == 33);
32643         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32644         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
32645 }
32646
32647 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
32648         LDKOnionMessage ret_var = OnionMessage_clone(arg);
32649         uint64_t ret_ref = 0;
32650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32652         return ret_ref;
32653 }
32654 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
32655         LDKOnionMessage arg_conv;
32656         arg_conv.inner = untag_ptr(arg);
32657         arg_conv.is_owned = ptr_is_owned(arg);
32658         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32659         arg_conv.is_owned = false;
32660         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
32661         return ret_conv;
32662 }
32663
32664 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
32665         LDKOnionMessage orig_conv;
32666         orig_conv.inner = untag_ptr(orig);
32667         orig_conv.is_owned = ptr_is_owned(orig);
32668         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32669         orig_conv.is_owned = false;
32670         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
32671         uint64_t ret_ref = 0;
32672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32674         return ret_ref;
32675 }
32676
32677 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
32678         LDKOnionMessage a_conv;
32679         a_conv.inner = untag_ptr(a);
32680         a_conv.is_owned = ptr_is_owned(a);
32681         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32682         a_conv.is_owned = false;
32683         LDKOnionMessage b_conv;
32684         b_conv.inner = untag_ptr(b);
32685         b_conv.is_owned = ptr_is_owned(b);
32686         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32687         b_conv.is_owned = false;
32688         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
32689         return ret_conv;
32690 }
32691
32692 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
32693         LDKUpdateFulfillHTLC this_obj_conv;
32694         this_obj_conv.inner = untag_ptr(this_obj);
32695         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32697         UpdateFulfillHTLC_free(this_obj_conv);
32698 }
32699
32700 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
32701         LDKUpdateFulfillHTLC this_ptr_conv;
32702         this_ptr_conv.inner = untag_ptr(this_ptr);
32703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32705         this_ptr_conv.is_owned = false;
32706         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32707         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
32708         return ret_arr;
32709 }
32710
32711 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32712         LDKUpdateFulfillHTLC this_ptr_conv;
32713         this_ptr_conv.inner = untag_ptr(this_ptr);
32714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32716         this_ptr_conv.is_owned = false;
32717         LDKThirtyTwoBytes val_ref;
32718         CHECK(val->arr_len == 32);
32719         memcpy(val_ref.data, val->elems, 32); FREE(val);
32720         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32721 }
32722
32723 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
32724         LDKUpdateFulfillHTLC this_ptr_conv;
32725         this_ptr_conv.inner = untag_ptr(this_ptr);
32726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32728         this_ptr_conv.is_owned = false;
32729         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32730         return ret_conv;
32731 }
32732
32733 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32734         LDKUpdateFulfillHTLC this_ptr_conv;
32735         this_ptr_conv.inner = untag_ptr(this_ptr);
32736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32738         this_ptr_conv.is_owned = false;
32739         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32740 }
32741
32742 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
32743         LDKUpdateFulfillHTLC this_ptr_conv;
32744         this_ptr_conv.inner = untag_ptr(this_ptr);
32745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32747         this_ptr_conv.is_owned = false;
32748         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32749         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
32750         return ret_arr;
32751 }
32752
32753 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
32754         LDKUpdateFulfillHTLC this_ptr_conv;
32755         this_ptr_conv.inner = untag_ptr(this_ptr);
32756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32758         this_ptr_conv.is_owned = false;
32759         LDKThirtyTwoBytes val_ref;
32760         CHECK(val->arr_len == 32);
32761         memcpy(val_ref.data, val->elems, 32); FREE(val);
32762         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32763 }
32764
32765 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) {
32766         LDKThirtyTwoBytes channel_id_arg_ref;
32767         CHECK(channel_id_arg->arr_len == 32);
32768         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32769         LDKThirtyTwoBytes payment_preimage_arg_ref;
32770         CHECK(payment_preimage_arg->arr_len == 32);
32771         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
32772         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32773         uint64_t ret_ref = 0;
32774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32776         return ret_ref;
32777 }
32778
32779 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32780         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32781         uint64_t ret_ref = 0;
32782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32784         return ret_ref;
32785 }
32786 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
32787         LDKUpdateFulfillHTLC arg_conv;
32788         arg_conv.inner = untag_ptr(arg);
32789         arg_conv.is_owned = ptr_is_owned(arg);
32790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32791         arg_conv.is_owned = false;
32792         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32793         return ret_conv;
32794 }
32795
32796 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
32797         LDKUpdateFulfillHTLC orig_conv;
32798         orig_conv.inner = untag_ptr(orig);
32799         orig_conv.is_owned = ptr_is_owned(orig);
32800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32801         orig_conv.is_owned = false;
32802         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32803         uint64_t ret_ref = 0;
32804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32806         return ret_ref;
32807 }
32808
32809 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
32810         LDKUpdateFulfillHTLC a_conv;
32811         a_conv.inner = untag_ptr(a);
32812         a_conv.is_owned = ptr_is_owned(a);
32813         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32814         a_conv.is_owned = false;
32815         LDKUpdateFulfillHTLC b_conv;
32816         b_conv.inner = untag_ptr(b);
32817         b_conv.is_owned = ptr_is_owned(b);
32818         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32819         b_conv.is_owned = false;
32820         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
32821         return ret_conv;
32822 }
32823
32824 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
32825         LDKUpdateFailHTLC this_obj_conv;
32826         this_obj_conv.inner = untag_ptr(this_obj);
32827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32829         UpdateFailHTLC_free(this_obj_conv);
32830 }
32831
32832 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
32833         LDKUpdateFailHTLC this_ptr_conv;
32834         this_ptr_conv.inner = untag_ptr(this_ptr);
32835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32837         this_ptr_conv.is_owned = false;
32838         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32839         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
32840         return ret_arr;
32841 }
32842
32843 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32844         LDKUpdateFailHTLC this_ptr_conv;
32845         this_ptr_conv.inner = untag_ptr(this_ptr);
32846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32848         this_ptr_conv.is_owned = false;
32849         LDKThirtyTwoBytes val_ref;
32850         CHECK(val->arr_len == 32);
32851         memcpy(val_ref.data, val->elems, 32); FREE(val);
32852         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32853 }
32854
32855 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
32856         LDKUpdateFailHTLC this_ptr_conv;
32857         this_ptr_conv.inner = untag_ptr(this_ptr);
32858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32860         this_ptr_conv.is_owned = false;
32861         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32862         return ret_conv;
32863 }
32864
32865 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32866         LDKUpdateFailHTLC this_ptr_conv;
32867         this_ptr_conv.inner = untag_ptr(this_ptr);
32868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32870         this_ptr_conv.is_owned = false;
32871         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32872 }
32873
32874 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32875         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32876         uint64_t ret_ref = 0;
32877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32879         return ret_ref;
32880 }
32881 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
32882         LDKUpdateFailHTLC arg_conv;
32883         arg_conv.inner = untag_ptr(arg);
32884         arg_conv.is_owned = ptr_is_owned(arg);
32885         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32886         arg_conv.is_owned = false;
32887         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32888         return ret_conv;
32889 }
32890
32891 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
32892         LDKUpdateFailHTLC orig_conv;
32893         orig_conv.inner = untag_ptr(orig);
32894         orig_conv.is_owned = ptr_is_owned(orig);
32895         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32896         orig_conv.is_owned = false;
32897         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32898         uint64_t ret_ref = 0;
32899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32901         return ret_ref;
32902 }
32903
32904 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
32905         LDKUpdateFailHTLC a_conv;
32906         a_conv.inner = untag_ptr(a);
32907         a_conv.is_owned = ptr_is_owned(a);
32908         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32909         a_conv.is_owned = false;
32910         LDKUpdateFailHTLC b_conv;
32911         b_conv.inner = untag_ptr(b);
32912         b_conv.is_owned = ptr_is_owned(b);
32913         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32914         b_conv.is_owned = false;
32915         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
32916         return ret_conv;
32917 }
32918
32919 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
32920         LDKUpdateFailMalformedHTLC this_obj_conv;
32921         this_obj_conv.inner = untag_ptr(this_obj);
32922         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32924         UpdateFailMalformedHTLC_free(this_obj_conv);
32925 }
32926
32927 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
32928         LDKUpdateFailMalformedHTLC this_ptr_conv;
32929         this_ptr_conv.inner = untag_ptr(this_ptr);
32930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32932         this_ptr_conv.is_owned = false;
32933         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32934         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
32935         return ret_arr;
32936 }
32937
32938 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32939         LDKUpdateFailMalformedHTLC this_ptr_conv;
32940         this_ptr_conv.inner = untag_ptr(this_ptr);
32941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32943         this_ptr_conv.is_owned = false;
32944         LDKThirtyTwoBytes val_ref;
32945         CHECK(val->arr_len == 32);
32946         memcpy(val_ref.data, val->elems, 32); FREE(val);
32947         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32948 }
32949
32950 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
32951         LDKUpdateFailMalformedHTLC this_ptr_conv;
32952         this_ptr_conv.inner = untag_ptr(this_ptr);
32953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32955         this_ptr_conv.is_owned = false;
32956         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32957         return ret_conv;
32958 }
32959
32960 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32961         LDKUpdateFailMalformedHTLC this_ptr_conv;
32962         this_ptr_conv.inner = untag_ptr(this_ptr);
32963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32965         this_ptr_conv.is_owned = false;
32966         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32967 }
32968
32969 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
32970         LDKUpdateFailMalformedHTLC this_ptr_conv;
32971         this_ptr_conv.inner = untag_ptr(this_ptr);
32972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32974         this_ptr_conv.is_owned = false;
32975         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32976         return ret_conv;
32977 }
32978
32979 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
32980         LDKUpdateFailMalformedHTLC this_ptr_conv;
32981         this_ptr_conv.inner = untag_ptr(this_ptr);
32982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32984         this_ptr_conv.is_owned = false;
32985         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32986 }
32987
32988 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32989         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32990         uint64_t ret_ref = 0;
32991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32993         return ret_ref;
32994 }
32995 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
32996         LDKUpdateFailMalformedHTLC arg_conv;
32997         arg_conv.inner = untag_ptr(arg);
32998         arg_conv.is_owned = ptr_is_owned(arg);
32999         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33000         arg_conv.is_owned = false;
33001         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
33002         return ret_conv;
33003 }
33004
33005 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
33006         LDKUpdateFailMalformedHTLC orig_conv;
33007         orig_conv.inner = untag_ptr(orig);
33008         orig_conv.is_owned = ptr_is_owned(orig);
33009         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33010         orig_conv.is_owned = false;
33011         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
33012         uint64_t ret_ref = 0;
33013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33015         return ret_ref;
33016 }
33017
33018 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
33019         LDKUpdateFailMalformedHTLC a_conv;
33020         a_conv.inner = untag_ptr(a);
33021         a_conv.is_owned = ptr_is_owned(a);
33022         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33023         a_conv.is_owned = false;
33024         LDKUpdateFailMalformedHTLC b_conv;
33025         b_conv.inner = untag_ptr(b);
33026         b_conv.is_owned = ptr_is_owned(b);
33027         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33028         b_conv.is_owned = false;
33029         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
33030         return ret_conv;
33031 }
33032
33033 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
33034         LDKCommitmentSigned this_obj_conv;
33035         this_obj_conv.inner = untag_ptr(this_obj);
33036         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33038         CommitmentSigned_free(this_obj_conv);
33039 }
33040
33041 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
33042         LDKCommitmentSigned this_ptr_conv;
33043         this_ptr_conv.inner = untag_ptr(this_ptr);
33044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33046         this_ptr_conv.is_owned = false;
33047         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33048         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
33049         return ret_arr;
33050 }
33051
33052 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33053         LDKCommitmentSigned this_ptr_conv;
33054         this_ptr_conv.inner = untag_ptr(this_ptr);
33055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33057         this_ptr_conv.is_owned = false;
33058         LDKThirtyTwoBytes val_ref;
33059         CHECK(val->arr_len == 32);
33060         memcpy(val_ref.data, val->elems, 32); FREE(val);
33061         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
33062 }
33063
33064 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
33065         LDKCommitmentSigned this_ptr_conv;
33066         this_ptr_conv.inner = untag_ptr(this_ptr);
33067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33069         this_ptr_conv.is_owned = false;
33070         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33071         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
33072         return ret_arr;
33073 }
33074
33075 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
33076         LDKCommitmentSigned this_ptr_conv;
33077         this_ptr_conv.inner = untag_ptr(this_ptr);
33078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33080         this_ptr_conv.is_owned = false;
33081         LDKSignature val_ref;
33082         CHECK(val->arr_len == 64);
33083         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33084         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
33085 }
33086
33087 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
33088         LDKCommitmentSigned this_ptr_conv;
33089         this_ptr_conv.inner = untag_ptr(this_ptr);
33090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33092         this_ptr_conv.is_owned = false;
33093         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
33094         ptrArray ret_arr = NULL;
33095         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
33096         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
33097         for (size_t m = 0; m < ret_var.datalen; m++) {
33098                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
33099                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
33100                 ret_arr_ptr[m] = ret_conv_12_arr;
33101         }
33102         
33103         FREE(ret_var.data);
33104         return ret_arr;
33105 }
33106
33107 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
33108         LDKCommitmentSigned this_ptr_conv;
33109         this_ptr_conv.inner = untag_ptr(this_ptr);
33110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33112         this_ptr_conv.is_owned = false;
33113         LDKCVec_SignatureZ val_constr;
33114         val_constr.datalen = val->arr_len;
33115         if (val_constr.datalen > 0)
33116                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33117         else
33118                 val_constr.data = NULL;
33119         int8_tArray* val_vals = (void*) val->elems;
33120         for (size_t m = 0; m < val_constr.datalen; m++) {
33121                 int8_tArray val_conv_12 = val_vals[m];
33122                 LDKSignature val_conv_12_ref;
33123                 CHECK(val_conv_12->arr_len == 64);
33124                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
33125                 val_constr.data[m] = val_conv_12_ref;
33126         }
33127         FREE(val);
33128         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33129 }
33130
33131 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
33132         LDKThirtyTwoBytes channel_id_arg_ref;
33133         CHECK(channel_id_arg->arr_len == 32);
33134         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33135         LDKSignature signature_arg_ref;
33136         CHECK(signature_arg->arr_len == 64);
33137         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33138         LDKCVec_SignatureZ htlc_signatures_arg_constr;
33139         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
33140         if (htlc_signatures_arg_constr.datalen > 0)
33141                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33142         else
33143                 htlc_signatures_arg_constr.data = NULL;
33144         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
33145         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
33146                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
33147                 LDKSignature htlc_signatures_arg_conv_12_ref;
33148                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
33149                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
33150                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
33151         }
33152         FREE(htlc_signatures_arg);
33153         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33154         uint64_t ret_ref = 0;
33155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33157         return ret_ref;
33158 }
33159
33160 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33161         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33162         uint64_t ret_ref = 0;
33163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33165         return ret_ref;
33166 }
33167 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
33168         LDKCommitmentSigned arg_conv;
33169         arg_conv.inner = untag_ptr(arg);
33170         arg_conv.is_owned = ptr_is_owned(arg);
33171         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33172         arg_conv.is_owned = false;
33173         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33174         return ret_conv;
33175 }
33176
33177 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
33178         LDKCommitmentSigned orig_conv;
33179         orig_conv.inner = untag_ptr(orig);
33180         orig_conv.is_owned = ptr_is_owned(orig);
33181         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33182         orig_conv.is_owned = false;
33183         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33184         uint64_t ret_ref = 0;
33185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33187         return ret_ref;
33188 }
33189
33190 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
33191         LDKCommitmentSigned a_conv;
33192         a_conv.inner = untag_ptr(a);
33193         a_conv.is_owned = ptr_is_owned(a);
33194         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33195         a_conv.is_owned = false;
33196         LDKCommitmentSigned b_conv;
33197         b_conv.inner = untag_ptr(b);
33198         b_conv.is_owned = ptr_is_owned(b);
33199         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33200         b_conv.is_owned = false;
33201         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
33202         return ret_conv;
33203 }
33204
33205 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
33206         LDKRevokeAndACK this_obj_conv;
33207         this_obj_conv.inner = untag_ptr(this_obj);
33208         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33210         RevokeAndACK_free(this_obj_conv);
33211 }
33212
33213 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
33214         LDKRevokeAndACK this_ptr_conv;
33215         this_ptr_conv.inner = untag_ptr(this_ptr);
33216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33218         this_ptr_conv.is_owned = false;
33219         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33220         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
33221         return ret_arr;
33222 }
33223
33224 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33225         LDKRevokeAndACK this_ptr_conv;
33226         this_ptr_conv.inner = untag_ptr(this_ptr);
33227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33229         this_ptr_conv.is_owned = false;
33230         LDKThirtyTwoBytes val_ref;
33231         CHECK(val->arr_len == 32);
33232         memcpy(val_ref.data, val->elems, 32); FREE(val);
33233         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33234 }
33235
33236 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
33237         LDKRevokeAndACK this_ptr_conv;
33238         this_ptr_conv.inner = untag_ptr(this_ptr);
33239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33241         this_ptr_conv.is_owned = false;
33242         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33243         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
33244         return ret_arr;
33245 }
33246
33247 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
33248         LDKRevokeAndACK this_ptr_conv;
33249         this_ptr_conv.inner = untag_ptr(this_ptr);
33250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33252         this_ptr_conv.is_owned = false;
33253         LDKThirtyTwoBytes val_ref;
33254         CHECK(val->arr_len == 32);
33255         memcpy(val_ref.data, val->elems, 32); FREE(val);
33256         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33257 }
33258
33259 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
33260         LDKRevokeAndACK this_ptr_conv;
33261         this_ptr_conv.inner = untag_ptr(this_ptr);
33262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33264         this_ptr_conv.is_owned = false;
33265         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33266         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33267         return ret_arr;
33268 }
33269
33270 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) {
33271         LDKRevokeAndACK this_ptr_conv;
33272         this_ptr_conv.inner = untag_ptr(this_ptr);
33273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33275         this_ptr_conv.is_owned = false;
33276         LDKPublicKey val_ref;
33277         CHECK(val->arr_len == 33);
33278         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33279         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33280 }
33281
33282 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) {
33283         LDKThirtyTwoBytes channel_id_arg_ref;
33284         CHECK(channel_id_arg->arr_len == 32);
33285         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33286         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33287         CHECK(per_commitment_secret_arg->arr_len == 32);
33288         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
33289         LDKPublicKey next_per_commitment_point_arg_ref;
33290         CHECK(next_per_commitment_point_arg->arr_len == 33);
33291         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
33292         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33293         uint64_t ret_ref = 0;
33294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33296         return ret_ref;
33297 }
33298
33299 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33300         LDKRevokeAndACK ret_var = RevokeAndACK_clone(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 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
33307         LDKRevokeAndACK arg_conv;
33308         arg_conv.inner = untag_ptr(arg);
33309         arg_conv.is_owned = ptr_is_owned(arg);
33310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33311         arg_conv.is_owned = false;
33312         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33313         return ret_conv;
33314 }
33315
33316 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
33317         LDKRevokeAndACK orig_conv;
33318         orig_conv.inner = untag_ptr(orig);
33319         orig_conv.is_owned = ptr_is_owned(orig);
33320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33321         orig_conv.is_owned = false;
33322         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33323         uint64_t ret_ref = 0;
33324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33326         return ret_ref;
33327 }
33328
33329 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
33330         LDKRevokeAndACK a_conv;
33331         a_conv.inner = untag_ptr(a);
33332         a_conv.is_owned = ptr_is_owned(a);
33333         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33334         a_conv.is_owned = false;
33335         LDKRevokeAndACK b_conv;
33336         b_conv.inner = untag_ptr(b);
33337         b_conv.is_owned = ptr_is_owned(b);
33338         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33339         b_conv.is_owned = false;
33340         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
33341         return ret_conv;
33342 }
33343
33344 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
33345         LDKUpdateFee this_obj_conv;
33346         this_obj_conv.inner = untag_ptr(this_obj);
33347         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33349         UpdateFee_free(this_obj_conv);
33350 }
33351
33352 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
33353         LDKUpdateFee this_ptr_conv;
33354         this_ptr_conv.inner = untag_ptr(this_ptr);
33355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33357         this_ptr_conv.is_owned = false;
33358         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33359         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
33360         return ret_arr;
33361 }
33362
33363 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33364         LDKUpdateFee this_ptr_conv;
33365         this_ptr_conv.inner = untag_ptr(this_ptr);
33366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33368         this_ptr_conv.is_owned = false;
33369         LDKThirtyTwoBytes val_ref;
33370         CHECK(val->arr_len == 32);
33371         memcpy(val_ref.data, val->elems, 32); FREE(val);
33372         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33373 }
33374
33375 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
33376         LDKUpdateFee this_ptr_conv;
33377         this_ptr_conv.inner = untag_ptr(this_ptr);
33378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33380         this_ptr_conv.is_owned = false;
33381         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33382         return ret_conv;
33383 }
33384
33385 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
33386         LDKUpdateFee this_ptr_conv;
33387         this_ptr_conv.inner = untag_ptr(this_ptr);
33388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33390         this_ptr_conv.is_owned = false;
33391         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33392 }
33393
33394 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
33395         LDKThirtyTwoBytes channel_id_arg_ref;
33396         CHECK(channel_id_arg->arr_len == 32);
33397         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33398         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33399         uint64_t ret_ref = 0;
33400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33402         return ret_ref;
33403 }
33404
33405 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33406         LDKUpdateFee ret_var = UpdateFee_clone(arg);
33407         uint64_t ret_ref = 0;
33408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33410         return ret_ref;
33411 }
33412 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
33413         LDKUpdateFee arg_conv;
33414         arg_conv.inner = untag_ptr(arg);
33415         arg_conv.is_owned = ptr_is_owned(arg);
33416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33417         arg_conv.is_owned = false;
33418         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33419         return ret_conv;
33420 }
33421
33422 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
33423         LDKUpdateFee orig_conv;
33424         orig_conv.inner = untag_ptr(orig);
33425         orig_conv.is_owned = ptr_is_owned(orig);
33426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33427         orig_conv.is_owned = false;
33428         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33429         uint64_t ret_ref = 0;
33430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33432         return ret_ref;
33433 }
33434
33435 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
33436         LDKUpdateFee a_conv;
33437         a_conv.inner = untag_ptr(a);
33438         a_conv.is_owned = ptr_is_owned(a);
33439         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33440         a_conv.is_owned = false;
33441         LDKUpdateFee b_conv;
33442         b_conv.inner = untag_ptr(b);
33443         b_conv.is_owned = ptr_is_owned(b);
33444         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33445         b_conv.is_owned = false;
33446         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
33447         return ret_conv;
33448 }
33449
33450 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
33451         LDKDataLossProtect this_obj_conv;
33452         this_obj_conv.inner = untag_ptr(this_obj);
33453         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33455         DataLossProtect_free(this_obj_conv);
33456 }
33457
33458 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) {
33459         LDKDataLossProtect this_ptr_conv;
33460         this_ptr_conv.inner = untag_ptr(this_ptr);
33461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33463         this_ptr_conv.is_owned = false;
33464         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33465         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
33466         return ret_arr;
33467 }
33468
33469 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) {
33470         LDKDataLossProtect this_ptr_conv;
33471         this_ptr_conv.inner = untag_ptr(this_ptr);
33472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33474         this_ptr_conv.is_owned = false;
33475         LDKThirtyTwoBytes val_ref;
33476         CHECK(val->arr_len == 32);
33477         memcpy(val_ref.data, val->elems, 32); FREE(val);
33478         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33479 }
33480
33481 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) {
33482         LDKDataLossProtect this_ptr_conv;
33483         this_ptr_conv.inner = untag_ptr(this_ptr);
33484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33486         this_ptr_conv.is_owned = false;
33487         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33488         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33489         return ret_arr;
33490 }
33491
33492 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) {
33493         LDKDataLossProtect this_ptr_conv;
33494         this_ptr_conv.inner = untag_ptr(this_ptr);
33495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33497         this_ptr_conv.is_owned = false;
33498         LDKPublicKey val_ref;
33499         CHECK(val->arr_len == 33);
33500         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33501         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33502 }
33503
33504 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) {
33505         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33506         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
33507         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
33508         LDKPublicKey my_current_per_commitment_point_arg_ref;
33509         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
33510         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);
33511         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33512         uint64_t ret_ref = 0;
33513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33515         return ret_ref;
33516 }
33517
33518 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33519         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33520         uint64_t ret_ref = 0;
33521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33523         return ret_ref;
33524 }
33525 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
33526         LDKDataLossProtect arg_conv;
33527         arg_conv.inner = untag_ptr(arg);
33528         arg_conv.is_owned = ptr_is_owned(arg);
33529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33530         arg_conv.is_owned = false;
33531         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33532         return ret_conv;
33533 }
33534
33535 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
33536         LDKDataLossProtect orig_conv;
33537         orig_conv.inner = untag_ptr(orig);
33538         orig_conv.is_owned = ptr_is_owned(orig);
33539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33540         orig_conv.is_owned = false;
33541         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33542         uint64_t ret_ref = 0;
33543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33545         return ret_ref;
33546 }
33547
33548 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
33549         LDKDataLossProtect a_conv;
33550         a_conv.inner = untag_ptr(a);
33551         a_conv.is_owned = ptr_is_owned(a);
33552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33553         a_conv.is_owned = false;
33554         LDKDataLossProtect b_conv;
33555         b_conv.inner = untag_ptr(b);
33556         b_conv.is_owned = ptr_is_owned(b);
33557         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33558         b_conv.is_owned = false;
33559         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
33560         return ret_conv;
33561 }
33562
33563 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
33564         LDKChannelReestablish this_obj_conv;
33565         this_obj_conv.inner = untag_ptr(this_obj);
33566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33568         ChannelReestablish_free(this_obj_conv);
33569 }
33570
33571 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
33572         LDKChannelReestablish this_ptr_conv;
33573         this_ptr_conv.inner = untag_ptr(this_ptr);
33574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33576         this_ptr_conv.is_owned = false;
33577         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33578         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
33579         return ret_arr;
33580 }
33581
33582 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33583         LDKChannelReestablish this_ptr_conv;
33584         this_ptr_conv.inner = untag_ptr(this_ptr);
33585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33587         this_ptr_conv.is_owned = false;
33588         LDKThirtyTwoBytes val_ref;
33589         CHECK(val->arr_len == 32);
33590         memcpy(val_ref.data, val->elems, 32); FREE(val);
33591         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33592 }
33593
33594 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
33595         LDKChannelReestablish this_ptr_conv;
33596         this_ptr_conv.inner = untag_ptr(this_ptr);
33597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33599         this_ptr_conv.is_owned = false;
33600         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33601         return ret_conv;
33602 }
33603
33604 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) {
33605         LDKChannelReestablish this_ptr_conv;
33606         this_ptr_conv.inner = untag_ptr(this_ptr);
33607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33609         this_ptr_conv.is_owned = false;
33610         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33611 }
33612
33613 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
33614         LDKChannelReestablish this_ptr_conv;
33615         this_ptr_conv.inner = untag_ptr(this_ptr);
33616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33618         this_ptr_conv.is_owned = false;
33619         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33620         return ret_conv;
33621 }
33622
33623 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) {
33624         LDKChannelReestablish this_ptr_conv;
33625         this_ptr_conv.inner = untag_ptr(this_ptr);
33626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33628         this_ptr_conv.is_owned = false;
33629         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33630 }
33631
33632 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33633         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33634         uint64_t ret_ref = 0;
33635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33637         return ret_ref;
33638 }
33639 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
33640         LDKChannelReestablish arg_conv;
33641         arg_conv.inner = untag_ptr(arg);
33642         arg_conv.is_owned = ptr_is_owned(arg);
33643         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33644         arg_conv.is_owned = false;
33645         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33646         return ret_conv;
33647 }
33648
33649 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
33650         LDKChannelReestablish orig_conv;
33651         orig_conv.inner = untag_ptr(orig);
33652         orig_conv.is_owned = ptr_is_owned(orig);
33653         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33654         orig_conv.is_owned = false;
33655         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33656         uint64_t ret_ref = 0;
33657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33659         return ret_ref;
33660 }
33661
33662 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
33663         LDKChannelReestablish a_conv;
33664         a_conv.inner = untag_ptr(a);
33665         a_conv.is_owned = ptr_is_owned(a);
33666         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33667         a_conv.is_owned = false;
33668         LDKChannelReestablish b_conv;
33669         b_conv.inner = untag_ptr(b);
33670         b_conv.is_owned = ptr_is_owned(b);
33671         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33672         b_conv.is_owned = false;
33673         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
33674         return ret_conv;
33675 }
33676
33677 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
33678         LDKAnnouncementSignatures this_obj_conv;
33679         this_obj_conv.inner = untag_ptr(this_obj);
33680         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33682         AnnouncementSignatures_free(this_obj_conv);
33683 }
33684
33685 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
33686         LDKAnnouncementSignatures this_ptr_conv;
33687         this_ptr_conv.inner = untag_ptr(this_ptr);
33688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33690         this_ptr_conv.is_owned = false;
33691         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33692         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
33693         return ret_arr;
33694 }
33695
33696 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33697         LDKAnnouncementSignatures this_ptr_conv;
33698         this_ptr_conv.inner = untag_ptr(this_ptr);
33699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33701         this_ptr_conv.is_owned = false;
33702         LDKThirtyTwoBytes val_ref;
33703         CHECK(val->arr_len == 32);
33704         memcpy(val_ref.data, val->elems, 32); FREE(val);
33705         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33706 }
33707
33708 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
33709         LDKAnnouncementSignatures this_ptr_conv;
33710         this_ptr_conv.inner = untag_ptr(this_ptr);
33711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33713         this_ptr_conv.is_owned = false;
33714         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33715         return ret_conv;
33716 }
33717
33718 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
33719         LDKAnnouncementSignatures this_ptr_conv;
33720         this_ptr_conv.inner = untag_ptr(this_ptr);
33721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33723         this_ptr_conv.is_owned = false;
33724         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33725 }
33726
33727 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
33728         LDKAnnouncementSignatures this_ptr_conv;
33729         this_ptr_conv.inner = untag_ptr(this_ptr);
33730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33732         this_ptr_conv.is_owned = false;
33733         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33734         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
33735         return ret_arr;
33736 }
33737
33738 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
33739         LDKAnnouncementSignatures this_ptr_conv;
33740         this_ptr_conv.inner = untag_ptr(this_ptr);
33741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33743         this_ptr_conv.is_owned = false;
33744         LDKSignature val_ref;
33745         CHECK(val->arr_len == 64);
33746         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33747         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33748 }
33749
33750 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
33751         LDKAnnouncementSignatures this_ptr_conv;
33752         this_ptr_conv.inner = untag_ptr(this_ptr);
33753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33755         this_ptr_conv.is_owned = false;
33756         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33757         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
33758         return ret_arr;
33759 }
33760
33761 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
33762         LDKAnnouncementSignatures this_ptr_conv;
33763         this_ptr_conv.inner = untag_ptr(this_ptr);
33764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33766         this_ptr_conv.is_owned = false;
33767         LDKSignature val_ref;
33768         CHECK(val->arr_len == 64);
33769         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33770         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33771 }
33772
33773 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) {
33774         LDKThirtyTwoBytes channel_id_arg_ref;
33775         CHECK(channel_id_arg->arr_len == 32);
33776         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33777         LDKSignature node_signature_arg_ref;
33778         CHECK(node_signature_arg->arr_len == 64);
33779         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
33780         LDKSignature bitcoin_signature_arg_ref;
33781         CHECK(bitcoin_signature_arg->arr_len == 64);
33782         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
33783         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33784         uint64_t ret_ref = 0;
33785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33787         return ret_ref;
33788 }
33789
33790 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33791         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33792         uint64_t ret_ref = 0;
33793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33795         return ret_ref;
33796 }
33797 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
33798         LDKAnnouncementSignatures arg_conv;
33799         arg_conv.inner = untag_ptr(arg);
33800         arg_conv.is_owned = ptr_is_owned(arg);
33801         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33802         arg_conv.is_owned = false;
33803         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33804         return ret_conv;
33805 }
33806
33807 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
33808         LDKAnnouncementSignatures orig_conv;
33809         orig_conv.inner = untag_ptr(orig);
33810         orig_conv.is_owned = ptr_is_owned(orig);
33811         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33812         orig_conv.is_owned = false;
33813         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33814         uint64_t ret_ref = 0;
33815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33817         return ret_ref;
33818 }
33819
33820 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
33821         LDKAnnouncementSignatures a_conv;
33822         a_conv.inner = untag_ptr(a);
33823         a_conv.is_owned = ptr_is_owned(a);
33824         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33825         a_conv.is_owned = false;
33826         LDKAnnouncementSignatures b_conv;
33827         b_conv.inner = untag_ptr(b);
33828         b_conv.is_owned = ptr_is_owned(b);
33829         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33830         b_conv.is_owned = false;
33831         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
33832         return ret_conv;
33833 }
33834
33835 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
33836         if (!ptr_is_owned(this_ptr)) return;
33837         void* this_ptr_ptr = untag_ptr(this_ptr);
33838         CHECK_ACCESS(this_ptr_ptr);
33839         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33840         FREE(untag_ptr(this_ptr));
33841         NetAddress_free(this_ptr_conv);
33842 }
33843
33844 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33845         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33846         *ret_copy = NetAddress_clone(arg);
33847         uint64_t ret_ref = tag_ptr(ret_copy, true);
33848         return ret_ref;
33849 }
33850 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
33851         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33852         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33853         return ret_conv;
33854 }
33855
33856 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
33857         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33858         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33859         *ret_copy = NetAddress_clone(orig_conv);
33860         uint64_t ret_ref = tag_ptr(ret_copy, true);
33861         return ret_ref;
33862 }
33863
33864 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
33865         LDKFourBytes addr_ref;
33866         CHECK(addr->arr_len == 4);
33867         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
33868         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33869         *ret_copy = NetAddress_ipv4(addr_ref, port);
33870         uint64_t ret_ref = tag_ptr(ret_copy, true);
33871         return ret_ref;
33872 }
33873
33874 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
33875         LDKSixteenBytes addr_ref;
33876         CHECK(addr->arr_len == 16);
33877         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
33878         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33879         *ret_copy = NetAddress_ipv6(addr_ref, port);
33880         uint64_t ret_ref = tag_ptr(ret_copy, true);
33881         return ret_ref;
33882 }
33883
33884 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
33885         LDKTwelveBytes a_ref;
33886         CHECK(a->arr_len == 12);
33887         memcpy(a_ref.data, a->elems, 12); FREE(a);
33888         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33889         *ret_copy = NetAddress_onion_v2(a_ref);
33890         uint64_t ret_ref = tag_ptr(ret_copy, true);
33891         return ret_ref;
33892 }
33893
33894 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) {
33895         LDKThirtyTwoBytes ed25519_pubkey_ref;
33896         CHECK(ed25519_pubkey->arr_len == 32);
33897         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
33898         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33899         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33900         uint64_t ret_ref = tag_ptr(ret_copy, true);
33901         return ret_ref;
33902 }
33903
33904 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
33905         LDKHostname hostname_conv;
33906         hostname_conv.inner = untag_ptr(hostname);
33907         hostname_conv.is_owned = ptr_is_owned(hostname);
33908         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33909         hostname_conv = Hostname_clone(&hostname_conv);
33910         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33911         *ret_copy = NetAddress_hostname(hostname_conv, port);
33912         uint64_t ret_ref = tag_ptr(ret_copy, true);
33913         return ret_ref;
33914 }
33915
33916 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
33917         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
33918         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
33919         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
33920         return ret_conv;
33921 }
33922
33923 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
33924         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33925         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33926         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33927         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33928         CVec_u8Z_free(ret_var);
33929         return ret_arr;
33930 }
33931
33932 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
33933         LDKu8slice ser_ref;
33934         ser_ref.datalen = ser->arr_len;
33935         ser_ref.data = ser->elems;
33936         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33937         *ret_conv = NetAddress_read(ser_ref);
33938         FREE(ser);
33939         return tag_ptr(ret_conv, true);
33940 }
33941
33942 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
33943         if (!ptr_is_owned(this_ptr)) return;
33944         void* this_ptr_ptr = untag_ptr(this_ptr);
33945         CHECK_ACCESS(this_ptr_ptr);
33946         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
33947         FREE(untag_ptr(this_ptr));
33948         UnsignedGossipMessage_free(this_ptr_conv);
33949 }
33950
33951 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
33952         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33953         *ret_copy = UnsignedGossipMessage_clone(arg);
33954         uint64_t ret_ref = tag_ptr(ret_copy, true);
33955         return ret_ref;
33956 }
33957 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
33958         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
33959         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
33960         return ret_conv;
33961 }
33962
33963 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
33964         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
33965         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33966         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
33967         uint64_t ret_ref = tag_ptr(ret_copy, true);
33968         return ret_ref;
33969 }
33970
33971 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
33972         LDKUnsignedChannelAnnouncement a_conv;
33973         a_conv.inner = untag_ptr(a);
33974         a_conv.is_owned = ptr_is_owned(a);
33975         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33976         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
33977         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33978         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
33979         uint64_t ret_ref = tag_ptr(ret_copy, true);
33980         return ret_ref;
33981 }
33982
33983 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
33984         LDKUnsignedChannelUpdate a_conv;
33985         a_conv.inner = untag_ptr(a);
33986         a_conv.is_owned = ptr_is_owned(a);
33987         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33988         a_conv = UnsignedChannelUpdate_clone(&a_conv);
33989         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33990         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
33991         uint64_t ret_ref = tag_ptr(ret_copy, true);
33992         return ret_ref;
33993 }
33994
33995 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
33996         LDKUnsignedNodeAnnouncement a_conv;
33997         a_conv.inner = untag_ptr(a);
33998         a_conv.is_owned = ptr_is_owned(a);
33999         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34000         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
34001         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
34002         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
34003         uint64_t ret_ref = tag_ptr(ret_copy, true);
34004         return ret_ref;
34005 }
34006
34007 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
34008         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
34009         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
34010         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34011         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34012         CVec_u8Z_free(ret_var);
34013         return ret_arr;
34014 }
34015
34016 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
34017         LDKUnsignedNodeAnnouncement this_obj_conv;
34018         this_obj_conv.inner = untag_ptr(this_obj);
34019         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34021         UnsignedNodeAnnouncement_free(this_obj_conv);
34022 }
34023
34024 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
34025         LDKUnsignedNodeAnnouncement this_ptr_conv;
34026         this_ptr_conv.inner = untag_ptr(this_ptr);
34027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34029         this_ptr_conv.is_owned = false;
34030         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
34031         uint64_t ret_ref = 0;
34032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34034         return ret_ref;
34035 }
34036
34037 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
34038         LDKUnsignedNodeAnnouncement this_ptr_conv;
34039         this_ptr_conv.inner = untag_ptr(this_ptr);
34040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34042         this_ptr_conv.is_owned = false;
34043         LDKNodeFeatures val_conv;
34044         val_conv.inner = untag_ptr(val);
34045         val_conv.is_owned = ptr_is_owned(val);
34046         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34047         val_conv = NodeFeatures_clone(&val_conv);
34048         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
34049 }
34050
34051 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
34052         LDKUnsignedNodeAnnouncement this_ptr_conv;
34053         this_ptr_conv.inner = untag_ptr(this_ptr);
34054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34056         this_ptr_conv.is_owned = false;
34057         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
34058         return ret_conv;
34059 }
34060
34061 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
34062         LDKUnsignedNodeAnnouncement this_ptr_conv;
34063         this_ptr_conv.inner = untag_ptr(this_ptr);
34064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34066         this_ptr_conv.is_owned = false;
34067         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
34068 }
34069
34070 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
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         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
34077         uint64_t ret_ref = 0;
34078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34080         return ret_ref;
34081 }
34082
34083 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
34084         LDKUnsignedNodeAnnouncement this_ptr_conv;
34085         this_ptr_conv.inner = untag_ptr(this_ptr);
34086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34088         this_ptr_conv.is_owned = false;
34089         LDKNodeId val_conv;
34090         val_conv.inner = untag_ptr(val);
34091         val_conv.is_owned = ptr_is_owned(val);
34092         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34093         val_conv = NodeId_clone(&val_conv);
34094         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
34095 }
34096
34097 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
34098         LDKUnsignedNodeAnnouncement this_ptr_conv;
34099         this_ptr_conv.inner = untag_ptr(this_ptr);
34100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34102         this_ptr_conv.is_owned = false;
34103         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
34104         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
34105         return ret_arr;
34106 }
34107
34108 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
34109         LDKUnsignedNodeAnnouncement this_ptr_conv;
34110         this_ptr_conv.inner = untag_ptr(this_ptr);
34111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34113         this_ptr_conv.is_owned = false;
34114         LDKThreeBytes val_ref;
34115         CHECK(val->arr_len == 3);
34116         memcpy(val_ref.data, val->elems, 3); FREE(val);
34117         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
34118 }
34119
34120 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
34121         LDKUnsignedNodeAnnouncement this_ptr_conv;
34122         this_ptr_conv.inner = untag_ptr(this_ptr);
34123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34125         this_ptr_conv.is_owned = false;
34126         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34127         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
34128         return ret_arr;
34129 }
34130
34131 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
34132         LDKUnsignedNodeAnnouncement this_ptr_conv;
34133         this_ptr_conv.inner = untag_ptr(this_ptr);
34134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34136         this_ptr_conv.is_owned = false;
34137         LDKThirtyTwoBytes val_ref;
34138         CHECK(val->arr_len == 32);
34139         memcpy(val_ref.data, val->elems, 32); FREE(val);
34140         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
34141 }
34142
34143 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
34144         LDKUnsignedNodeAnnouncement this_ptr_conv;
34145         this_ptr_conv.inner = untag_ptr(this_ptr);
34146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34148         this_ptr_conv.is_owned = false;
34149         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
34150         uint64_tArray ret_arr = NULL;
34151         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34152         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34153         for (size_t m = 0; m < ret_var.datalen; m++) {
34154                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34155                 *ret_conv_12_copy = ret_var.data[m];
34156                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
34157                 ret_arr_ptr[m] = ret_conv_12_ref;
34158         }
34159         
34160         FREE(ret_var.data);
34161         return ret_arr;
34162 }
34163
34164 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
34165         LDKUnsignedNodeAnnouncement this_ptr_conv;
34166         this_ptr_conv.inner = untag_ptr(this_ptr);
34167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34169         this_ptr_conv.is_owned = false;
34170         LDKCVec_NetAddressZ val_constr;
34171         val_constr.datalen = val->arr_len;
34172         if (val_constr.datalen > 0)
34173                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
34174         else
34175                 val_constr.data = NULL;
34176         uint64_t* val_vals = val->elems;
34177         for (size_t m = 0; m < val_constr.datalen; m++) {
34178                 uint64_t val_conv_12 = val_vals[m];
34179                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
34180                 CHECK_ACCESS(val_conv_12_ptr);
34181                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
34182                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
34183                 val_constr.data[m] = val_conv_12_conv;
34184         }
34185         FREE(val);
34186         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
34187 }
34188
34189 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
34190         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
34191         uint64_t ret_ref = 0;
34192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34194         return ret_ref;
34195 }
34196 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
34197         LDKUnsignedNodeAnnouncement arg_conv;
34198         arg_conv.inner = untag_ptr(arg);
34199         arg_conv.is_owned = ptr_is_owned(arg);
34200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34201         arg_conv.is_owned = false;
34202         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
34203         return ret_conv;
34204 }
34205
34206 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
34207         LDKUnsignedNodeAnnouncement orig_conv;
34208         orig_conv.inner = untag_ptr(orig);
34209         orig_conv.is_owned = ptr_is_owned(orig);
34210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34211         orig_conv.is_owned = false;
34212         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34213         uint64_t ret_ref = 0;
34214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34216         return ret_ref;
34217 }
34218
34219 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
34220         LDKUnsignedNodeAnnouncement a_conv;
34221         a_conv.inner = untag_ptr(a);
34222         a_conv.is_owned = ptr_is_owned(a);
34223         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34224         a_conv.is_owned = false;
34225         LDKUnsignedNodeAnnouncement b_conv;
34226         b_conv.inner = untag_ptr(b);
34227         b_conv.is_owned = ptr_is_owned(b);
34228         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34229         b_conv.is_owned = false;
34230         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
34231         return ret_conv;
34232 }
34233
34234 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
34235         LDKNodeAnnouncement this_obj_conv;
34236         this_obj_conv.inner = untag_ptr(this_obj);
34237         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34239         NodeAnnouncement_free(this_obj_conv);
34240 }
34241
34242 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
34243         LDKNodeAnnouncement this_ptr_conv;
34244         this_ptr_conv.inner = untag_ptr(this_ptr);
34245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34247         this_ptr_conv.is_owned = false;
34248         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34249         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
34250         return ret_arr;
34251 }
34252
34253 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
34254         LDKNodeAnnouncement this_ptr_conv;
34255         this_ptr_conv.inner = untag_ptr(this_ptr);
34256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34258         this_ptr_conv.is_owned = false;
34259         LDKSignature val_ref;
34260         CHECK(val->arr_len == 64);
34261         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34262         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34263 }
34264
34265 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
34266         LDKNodeAnnouncement this_ptr_conv;
34267         this_ptr_conv.inner = untag_ptr(this_ptr);
34268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34270         this_ptr_conv.is_owned = false;
34271         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34272         uint64_t ret_ref = 0;
34273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34275         return ret_ref;
34276 }
34277
34278 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34279         LDKNodeAnnouncement this_ptr_conv;
34280         this_ptr_conv.inner = untag_ptr(this_ptr);
34281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34283         this_ptr_conv.is_owned = false;
34284         LDKUnsignedNodeAnnouncement val_conv;
34285         val_conv.inner = untag_ptr(val);
34286         val_conv.is_owned = ptr_is_owned(val);
34287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34288         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34289         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34290 }
34291
34292 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
34293         LDKSignature signature_arg_ref;
34294         CHECK(signature_arg->arr_len == 64);
34295         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34296         LDKUnsignedNodeAnnouncement contents_arg_conv;
34297         contents_arg_conv.inner = untag_ptr(contents_arg);
34298         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34299         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34300         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34301         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34302         uint64_t ret_ref = 0;
34303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34305         return ret_ref;
34306 }
34307
34308 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34309         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34310         uint64_t ret_ref = 0;
34311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34313         return ret_ref;
34314 }
34315 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
34316         LDKNodeAnnouncement arg_conv;
34317         arg_conv.inner = untag_ptr(arg);
34318         arg_conv.is_owned = ptr_is_owned(arg);
34319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34320         arg_conv.is_owned = false;
34321         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34322         return ret_conv;
34323 }
34324
34325 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
34326         LDKNodeAnnouncement orig_conv;
34327         orig_conv.inner = untag_ptr(orig);
34328         orig_conv.is_owned = ptr_is_owned(orig);
34329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34330         orig_conv.is_owned = false;
34331         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34332         uint64_t ret_ref = 0;
34333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34335         return ret_ref;
34336 }
34337
34338 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
34339         LDKNodeAnnouncement a_conv;
34340         a_conv.inner = untag_ptr(a);
34341         a_conv.is_owned = ptr_is_owned(a);
34342         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34343         a_conv.is_owned = false;
34344         LDKNodeAnnouncement b_conv;
34345         b_conv.inner = untag_ptr(b);
34346         b_conv.is_owned = ptr_is_owned(b);
34347         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34348         b_conv.is_owned = false;
34349         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
34350         return ret_conv;
34351 }
34352
34353 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
34354         LDKUnsignedChannelAnnouncement this_obj_conv;
34355         this_obj_conv.inner = untag_ptr(this_obj);
34356         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34358         UnsignedChannelAnnouncement_free(this_obj_conv);
34359 }
34360
34361 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
34362         LDKUnsignedChannelAnnouncement this_ptr_conv;
34363         this_ptr_conv.inner = untag_ptr(this_ptr);
34364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34366         this_ptr_conv.is_owned = false;
34367         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34368         uint64_t ret_ref = 0;
34369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34371         return ret_ref;
34372 }
34373
34374 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
34375         LDKUnsignedChannelAnnouncement this_ptr_conv;
34376         this_ptr_conv.inner = untag_ptr(this_ptr);
34377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34379         this_ptr_conv.is_owned = false;
34380         LDKChannelFeatures val_conv;
34381         val_conv.inner = untag_ptr(val);
34382         val_conv.is_owned = ptr_is_owned(val);
34383         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34384         val_conv = ChannelFeatures_clone(&val_conv);
34385         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34386 }
34387
34388 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
34389         LDKUnsignedChannelAnnouncement this_ptr_conv;
34390         this_ptr_conv.inner = untag_ptr(this_ptr);
34391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34393         this_ptr_conv.is_owned = false;
34394         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34395         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
34396         return ret_arr;
34397 }
34398
34399 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34400         LDKUnsignedChannelAnnouncement this_ptr_conv;
34401         this_ptr_conv.inner = untag_ptr(this_ptr);
34402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34404         this_ptr_conv.is_owned = false;
34405         LDKThirtyTwoBytes val_ref;
34406         CHECK(val->arr_len == 32);
34407         memcpy(val_ref.data, val->elems, 32); FREE(val);
34408         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34409 }
34410
34411 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
34412         LDKUnsignedChannelAnnouncement this_ptr_conv;
34413         this_ptr_conv.inner = untag_ptr(this_ptr);
34414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34416         this_ptr_conv.is_owned = false;
34417         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34418         return ret_conv;
34419 }
34420
34421 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34422         LDKUnsignedChannelAnnouncement this_ptr_conv;
34423         this_ptr_conv.inner = untag_ptr(this_ptr);
34424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34426         this_ptr_conv.is_owned = false;
34427         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34428 }
34429
34430 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
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 ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
34437         uint64_t ret_ref = 0;
34438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34440         return ret_ref;
34441 }
34442
34443 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
34444         LDKUnsignedChannelAnnouncement this_ptr_conv;
34445         this_ptr_conv.inner = untag_ptr(this_ptr);
34446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34448         this_ptr_conv.is_owned = false;
34449         LDKNodeId val_conv;
34450         val_conv.inner = untag_ptr(val);
34451         val_conv.is_owned = ptr_is_owned(val);
34452         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34453         val_conv = NodeId_clone(&val_conv);
34454         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
34455 }
34456
34457 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
34458         LDKUnsignedChannelAnnouncement this_ptr_conv;
34459         this_ptr_conv.inner = untag_ptr(this_ptr);
34460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34462         this_ptr_conv.is_owned = false;
34463         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
34464         uint64_t ret_ref = 0;
34465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34467         return ret_ref;
34468 }
34469
34470 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
34471         LDKUnsignedChannelAnnouncement this_ptr_conv;
34472         this_ptr_conv.inner = untag_ptr(this_ptr);
34473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34475         this_ptr_conv.is_owned = false;
34476         LDKNodeId val_conv;
34477         val_conv.inner = untag_ptr(val);
34478         val_conv.is_owned = ptr_is_owned(val);
34479         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34480         val_conv = NodeId_clone(&val_conv);
34481         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
34482 }
34483
34484 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
34485         LDKUnsignedChannelAnnouncement this_ptr_conv;
34486         this_ptr_conv.inner = untag_ptr(this_ptr);
34487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34489         this_ptr_conv.is_owned = false;
34490         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
34491         uint64_t ret_ref = 0;
34492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34494         return ret_ref;
34495 }
34496
34497 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
34498         LDKUnsignedChannelAnnouncement 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         LDKNodeId val_conv;
34504         val_conv.inner = untag_ptr(val);
34505         val_conv.is_owned = ptr_is_owned(val);
34506         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34507         val_conv = NodeId_clone(&val_conv);
34508         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
34509 }
34510
34511 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
34512         LDKUnsignedChannelAnnouncement this_ptr_conv;
34513         this_ptr_conv.inner = untag_ptr(this_ptr);
34514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34516         this_ptr_conv.is_owned = false;
34517         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
34518         uint64_t ret_ref = 0;
34519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34521         return ret_ref;
34522 }
34523
34524 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
34525         LDKUnsignedChannelAnnouncement this_ptr_conv;
34526         this_ptr_conv.inner = untag_ptr(this_ptr);
34527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34529         this_ptr_conv.is_owned = false;
34530         LDKNodeId val_conv;
34531         val_conv.inner = untag_ptr(val);
34532         val_conv.is_owned = ptr_is_owned(val);
34533         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34534         val_conv = NodeId_clone(&val_conv);
34535         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
34536 }
34537
34538 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34539         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34540         uint64_t ret_ref = 0;
34541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34543         return ret_ref;
34544 }
34545 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
34546         LDKUnsignedChannelAnnouncement arg_conv;
34547         arg_conv.inner = untag_ptr(arg);
34548         arg_conv.is_owned = ptr_is_owned(arg);
34549         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34550         arg_conv.is_owned = false;
34551         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34552         return ret_conv;
34553 }
34554
34555 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
34556         LDKUnsignedChannelAnnouncement orig_conv;
34557         orig_conv.inner = untag_ptr(orig);
34558         orig_conv.is_owned = ptr_is_owned(orig);
34559         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34560         orig_conv.is_owned = false;
34561         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34562         uint64_t ret_ref = 0;
34563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34565         return ret_ref;
34566 }
34567
34568 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34569         LDKUnsignedChannelAnnouncement a_conv;
34570         a_conv.inner = untag_ptr(a);
34571         a_conv.is_owned = ptr_is_owned(a);
34572         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34573         a_conv.is_owned = false;
34574         LDKUnsignedChannelAnnouncement b_conv;
34575         b_conv.inner = untag_ptr(b);
34576         b_conv.is_owned = ptr_is_owned(b);
34577         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34578         b_conv.is_owned = false;
34579         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
34580         return ret_conv;
34581 }
34582
34583 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
34584         LDKChannelAnnouncement this_obj_conv;
34585         this_obj_conv.inner = untag_ptr(this_obj);
34586         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34588         ChannelAnnouncement_free(this_obj_conv);
34589 }
34590
34591 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
34592         LDKChannelAnnouncement this_ptr_conv;
34593         this_ptr_conv.inner = untag_ptr(this_ptr);
34594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34596         this_ptr_conv.is_owned = false;
34597         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34598         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
34599         return ret_arr;
34600 }
34601
34602 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray 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         LDKSignature val_ref;
34609         CHECK(val->arr_len == 64);
34610         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34611         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34612 }
34613
34614 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
34615         LDKChannelAnnouncement this_ptr_conv;
34616         this_ptr_conv.inner = untag_ptr(this_ptr);
34617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34619         this_ptr_conv.is_owned = false;
34620         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34621         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
34622         return ret_arr;
34623 }
34624
34625 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
34626         LDKChannelAnnouncement this_ptr_conv;
34627         this_ptr_conv.inner = untag_ptr(this_ptr);
34628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34630         this_ptr_conv.is_owned = false;
34631         LDKSignature val_ref;
34632         CHECK(val->arr_len == 64);
34633         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34634         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34635 }
34636
34637 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
34638         LDKChannelAnnouncement this_ptr_conv;
34639         this_ptr_conv.inner = untag_ptr(this_ptr);
34640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34642         this_ptr_conv.is_owned = false;
34643         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34644         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
34645         return ret_arr;
34646 }
34647
34648 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
34649         LDKChannelAnnouncement this_ptr_conv;
34650         this_ptr_conv.inner = untag_ptr(this_ptr);
34651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34653         this_ptr_conv.is_owned = false;
34654         LDKSignature val_ref;
34655         CHECK(val->arr_len == 64);
34656         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34657         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34658 }
34659
34660 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
34661         LDKChannelAnnouncement this_ptr_conv;
34662         this_ptr_conv.inner = untag_ptr(this_ptr);
34663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34665         this_ptr_conv.is_owned = false;
34666         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34667         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
34668         return ret_arr;
34669 }
34670
34671 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
34672         LDKChannelAnnouncement this_ptr_conv;
34673         this_ptr_conv.inner = untag_ptr(this_ptr);
34674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34676         this_ptr_conv.is_owned = false;
34677         LDKSignature val_ref;
34678         CHECK(val->arr_len == 64);
34679         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34680         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34681 }
34682
34683 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
34684         LDKChannelAnnouncement this_ptr_conv;
34685         this_ptr_conv.inner = untag_ptr(this_ptr);
34686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34688         this_ptr_conv.is_owned = false;
34689         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34690         uint64_t ret_ref = 0;
34691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34693         return ret_ref;
34694 }
34695
34696 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34697         LDKChannelAnnouncement this_ptr_conv;
34698         this_ptr_conv.inner = untag_ptr(this_ptr);
34699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34701         this_ptr_conv.is_owned = false;
34702         LDKUnsignedChannelAnnouncement val_conv;
34703         val_conv.inner = untag_ptr(val);
34704         val_conv.is_owned = ptr_is_owned(val);
34705         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34706         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34707         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34708 }
34709
34710 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) {
34711         LDKSignature node_signature_1_arg_ref;
34712         CHECK(node_signature_1_arg->arr_len == 64);
34713         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
34714         LDKSignature node_signature_2_arg_ref;
34715         CHECK(node_signature_2_arg->arr_len == 64);
34716         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
34717         LDKSignature bitcoin_signature_1_arg_ref;
34718         CHECK(bitcoin_signature_1_arg->arr_len == 64);
34719         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
34720         LDKSignature bitcoin_signature_2_arg_ref;
34721         CHECK(bitcoin_signature_2_arg->arr_len == 64);
34722         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
34723         LDKUnsignedChannelAnnouncement contents_arg_conv;
34724         contents_arg_conv.inner = untag_ptr(contents_arg);
34725         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34726         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34727         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34728         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);
34729         uint64_t ret_ref = 0;
34730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34732         return ret_ref;
34733 }
34734
34735 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34736         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34737         uint64_t ret_ref = 0;
34738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34740         return ret_ref;
34741 }
34742 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
34743         LDKChannelAnnouncement arg_conv;
34744         arg_conv.inner = untag_ptr(arg);
34745         arg_conv.is_owned = ptr_is_owned(arg);
34746         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34747         arg_conv.is_owned = false;
34748         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34749         return ret_conv;
34750 }
34751
34752 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
34753         LDKChannelAnnouncement orig_conv;
34754         orig_conv.inner = untag_ptr(orig);
34755         orig_conv.is_owned = ptr_is_owned(orig);
34756         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34757         orig_conv.is_owned = false;
34758         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34759         uint64_t ret_ref = 0;
34760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34762         return ret_ref;
34763 }
34764
34765 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34766         LDKChannelAnnouncement a_conv;
34767         a_conv.inner = untag_ptr(a);
34768         a_conv.is_owned = ptr_is_owned(a);
34769         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34770         a_conv.is_owned = false;
34771         LDKChannelAnnouncement b_conv;
34772         b_conv.inner = untag_ptr(b);
34773         b_conv.is_owned = ptr_is_owned(b);
34774         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34775         b_conv.is_owned = false;
34776         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
34777         return ret_conv;
34778 }
34779
34780 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
34781         LDKUnsignedChannelUpdate this_obj_conv;
34782         this_obj_conv.inner = untag_ptr(this_obj);
34783         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34785         UnsignedChannelUpdate_free(this_obj_conv);
34786 }
34787
34788 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
34789         LDKUnsignedChannelUpdate this_ptr_conv;
34790         this_ptr_conv.inner = untag_ptr(this_ptr);
34791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34793         this_ptr_conv.is_owned = false;
34794         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34795         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
34796         return ret_arr;
34797 }
34798
34799 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34800         LDKUnsignedChannelUpdate this_ptr_conv;
34801         this_ptr_conv.inner = untag_ptr(this_ptr);
34802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34804         this_ptr_conv.is_owned = false;
34805         LDKThirtyTwoBytes val_ref;
34806         CHECK(val->arr_len == 32);
34807         memcpy(val_ref.data, val->elems, 32); FREE(val);
34808         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34809 }
34810
34811 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
34812         LDKUnsignedChannelUpdate this_ptr_conv;
34813         this_ptr_conv.inner = untag_ptr(this_ptr);
34814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34816         this_ptr_conv.is_owned = false;
34817         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34818         return ret_conv;
34819 }
34820
34821 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34822         LDKUnsignedChannelUpdate this_ptr_conv;
34823         this_ptr_conv.inner = untag_ptr(this_ptr);
34824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34826         this_ptr_conv.is_owned = false;
34827         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34828 }
34829
34830 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
34831         LDKUnsignedChannelUpdate this_ptr_conv;
34832         this_ptr_conv.inner = untag_ptr(this_ptr);
34833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34835         this_ptr_conv.is_owned = false;
34836         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34837         return ret_conv;
34838 }
34839
34840 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
34841         LDKUnsignedChannelUpdate this_ptr_conv;
34842         this_ptr_conv.inner = untag_ptr(this_ptr);
34843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34845         this_ptr_conv.is_owned = false;
34846         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34847 }
34848
34849 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
34850         LDKUnsignedChannelUpdate this_ptr_conv;
34851         this_ptr_conv.inner = untag_ptr(this_ptr);
34852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34854         this_ptr_conv.is_owned = false;
34855         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34856         return ret_conv;
34857 }
34858
34859 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
34860         LDKUnsignedChannelUpdate this_ptr_conv;
34861         this_ptr_conv.inner = untag_ptr(this_ptr);
34862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34864         this_ptr_conv.is_owned = false;
34865         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34866 }
34867
34868 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
34869         LDKUnsignedChannelUpdate this_ptr_conv;
34870         this_ptr_conv.inner = untag_ptr(this_ptr);
34871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34873         this_ptr_conv.is_owned = false;
34874         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34875         return ret_conv;
34876 }
34877
34878 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
34879         LDKUnsignedChannelUpdate this_ptr_conv;
34880         this_ptr_conv.inner = untag_ptr(this_ptr);
34881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34883         this_ptr_conv.is_owned = false;
34884         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34885 }
34886
34887 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
34888         LDKUnsignedChannelUpdate this_ptr_conv;
34889         this_ptr_conv.inner = untag_ptr(this_ptr);
34890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34892         this_ptr_conv.is_owned = false;
34893         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34894         return ret_conv;
34895 }
34896
34897 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34898         LDKUnsignedChannelUpdate this_ptr_conv;
34899         this_ptr_conv.inner = untag_ptr(this_ptr);
34900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34902         this_ptr_conv.is_owned = false;
34903         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34904 }
34905
34906 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
34907         LDKUnsignedChannelUpdate this_ptr_conv;
34908         this_ptr_conv.inner = untag_ptr(this_ptr);
34909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34911         this_ptr_conv.is_owned = false;
34912         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34913         return ret_conv;
34914 }
34915
34916 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
34917         LDKUnsignedChannelUpdate this_ptr_conv;
34918         this_ptr_conv.inner = untag_ptr(this_ptr);
34919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34921         this_ptr_conv.is_owned = false;
34922         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34923 }
34924
34925 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
34926         LDKUnsignedChannelUpdate this_ptr_conv;
34927         this_ptr_conv.inner = untag_ptr(this_ptr);
34928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34930         this_ptr_conv.is_owned = false;
34931         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34932         return ret_conv;
34933 }
34934
34935 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
34936         LDKUnsignedChannelUpdate this_ptr_conv;
34937         this_ptr_conv.inner = untag_ptr(this_ptr);
34938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34940         this_ptr_conv.is_owned = false;
34941         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34942 }
34943
34944 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
34945         LDKUnsignedChannelUpdate this_ptr_conv;
34946         this_ptr_conv.inner = untag_ptr(this_ptr);
34947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34949         this_ptr_conv.is_owned = false;
34950         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34951         return ret_conv;
34952 }
34953
34954 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
34955         LDKUnsignedChannelUpdate this_ptr_conv;
34956         this_ptr_conv.inner = untag_ptr(this_ptr);
34957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34959         this_ptr_conv.is_owned = false;
34960         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34961 }
34962
34963 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
34964         LDKUnsignedChannelUpdate 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         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34970         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34971         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34972         CVec_u8Z_free(ret_var);
34973         return ret_arr;
34974 }
34975
34976 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
34977         LDKUnsignedChannelUpdate this_ptr_conv;
34978         this_ptr_conv.inner = untag_ptr(this_ptr);
34979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34981         this_ptr_conv.is_owned = false;
34982         LDKCVec_u8Z val_ref;
34983         val_ref.datalen = val->arr_len;
34984         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34985         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34986         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34987 }
34988
34989 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) {
34990         LDKThirtyTwoBytes chain_hash_arg_ref;
34991         CHECK(chain_hash_arg->arr_len == 32);
34992         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34993         LDKCVec_u8Z excess_data_arg_ref;
34994         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
34995         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34996         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
34997         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);
34998         uint64_t ret_ref = 0;
34999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35001         return ret_ref;
35002 }
35003
35004 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
35005         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
35006         uint64_t ret_ref = 0;
35007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35009         return ret_ref;
35010 }
35011 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
35012         LDKUnsignedChannelUpdate arg_conv;
35013         arg_conv.inner = untag_ptr(arg);
35014         arg_conv.is_owned = ptr_is_owned(arg);
35015         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35016         arg_conv.is_owned = false;
35017         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
35018         return ret_conv;
35019 }
35020
35021 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
35022         LDKUnsignedChannelUpdate orig_conv;
35023         orig_conv.inner = untag_ptr(orig);
35024         orig_conv.is_owned = ptr_is_owned(orig);
35025         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35026         orig_conv.is_owned = false;
35027         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
35028         uint64_t ret_ref = 0;
35029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35031         return ret_ref;
35032 }
35033
35034 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
35035         LDKUnsignedChannelUpdate a_conv;
35036         a_conv.inner = untag_ptr(a);
35037         a_conv.is_owned = ptr_is_owned(a);
35038         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35039         a_conv.is_owned = false;
35040         LDKUnsignedChannelUpdate b_conv;
35041         b_conv.inner = untag_ptr(b);
35042         b_conv.is_owned = ptr_is_owned(b);
35043         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35044         b_conv.is_owned = false;
35045         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
35046         return ret_conv;
35047 }
35048
35049 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
35050         LDKChannelUpdate this_obj_conv;
35051         this_obj_conv.inner = untag_ptr(this_obj);
35052         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35054         ChannelUpdate_free(this_obj_conv);
35055 }
35056
35057 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
35058         LDKChannelUpdate this_ptr_conv;
35059         this_ptr_conv.inner = untag_ptr(this_ptr);
35060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35062         this_ptr_conv.is_owned = false;
35063         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35064         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
35065         return ret_arr;
35066 }
35067
35068 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
35069         LDKChannelUpdate this_ptr_conv;
35070         this_ptr_conv.inner = untag_ptr(this_ptr);
35071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35073         this_ptr_conv.is_owned = false;
35074         LDKSignature val_ref;
35075         CHECK(val->arr_len == 64);
35076         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
35077         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
35078 }
35079
35080 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
35081         LDKChannelUpdate this_ptr_conv;
35082         this_ptr_conv.inner = untag_ptr(this_ptr);
35083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35085         this_ptr_conv.is_owned = false;
35086         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
35087         uint64_t ret_ref = 0;
35088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35090         return ret_ref;
35091 }
35092
35093 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
35094         LDKChannelUpdate 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         LDKUnsignedChannelUpdate val_conv;
35100         val_conv.inner = untag_ptr(val);
35101         val_conv.is_owned = ptr_is_owned(val);
35102         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35103         val_conv = UnsignedChannelUpdate_clone(&val_conv);
35104         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
35105 }
35106
35107 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
35108         LDKSignature signature_arg_ref;
35109         CHECK(signature_arg->arr_len == 64);
35110         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
35111         LDKUnsignedChannelUpdate contents_arg_conv;
35112         contents_arg_conv.inner = untag_ptr(contents_arg);
35113         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
35114         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35115         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
35116         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
35117         uint64_t ret_ref = 0;
35118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35120         return ret_ref;
35121 }
35122
35123 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
35124         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
35125         uint64_t ret_ref = 0;
35126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35128         return ret_ref;
35129 }
35130 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
35131         LDKChannelUpdate arg_conv;
35132         arg_conv.inner = untag_ptr(arg);
35133         arg_conv.is_owned = ptr_is_owned(arg);
35134         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35135         arg_conv.is_owned = false;
35136         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
35137         return ret_conv;
35138 }
35139
35140 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
35141         LDKChannelUpdate orig_conv;
35142         orig_conv.inner = untag_ptr(orig);
35143         orig_conv.is_owned = ptr_is_owned(orig);
35144         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35145         orig_conv.is_owned = false;
35146         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
35147         uint64_t ret_ref = 0;
35148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35150         return ret_ref;
35151 }
35152
35153 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
35154         LDKChannelUpdate a_conv;
35155         a_conv.inner = untag_ptr(a);
35156         a_conv.is_owned = ptr_is_owned(a);
35157         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35158         a_conv.is_owned = false;
35159         LDKChannelUpdate b_conv;
35160         b_conv.inner = untag_ptr(b);
35161         b_conv.is_owned = ptr_is_owned(b);
35162         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35163         b_conv.is_owned = false;
35164         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
35165         return ret_conv;
35166 }
35167
35168 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
35169         LDKQueryChannelRange this_obj_conv;
35170         this_obj_conv.inner = untag_ptr(this_obj);
35171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35173         QueryChannelRange_free(this_obj_conv);
35174 }
35175
35176 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
35177         LDKQueryChannelRange this_ptr_conv;
35178         this_ptr_conv.inner = untag_ptr(this_ptr);
35179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35181         this_ptr_conv.is_owned = false;
35182         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35183         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
35184         return ret_arr;
35185 }
35186
35187 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35188         LDKQueryChannelRange this_ptr_conv;
35189         this_ptr_conv.inner = untag_ptr(this_ptr);
35190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35192         this_ptr_conv.is_owned = false;
35193         LDKThirtyTwoBytes val_ref;
35194         CHECK(val->arr_len == 32);
35195         memcpy(val_ref.data, val->elems, 32); FREE(val);
35196         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35197 }
35198
35199 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
35200         LDKQueryChannelRange this_ptr_conv;
35201         this_ptr_conv.inner = untag_ptr(this_ptr);
35202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35204         this_ptr_conv.is_owned = false;
35205         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
35206         return ret_conv;
35207 }
35208
35209 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35210         LDKQueryChannelRange this_ptr_conv;
35211         this_ptr_conv.inner = untag_ptr(this_ptr);
35212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35214         this_ptr_conv.is_owned = false;
35215         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
35216 }
35217
35218 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35219         LDKQueryChannelRange 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         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
35225         return ret_conv;
35226 }
35227
35228 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35229         LDKQueryChannelRange this_ptr_conv;
35230         this_ptr_conv.inner = untag_ptr(this_ptr);
35231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35233         this_ptr_conv.is_owned = false;
35234         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35235 }
35236
35237 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) {
35238         LDKThirtyTwoBytes chain_hash_arg_ref;
35239         CHECK(chain_hash_arg->arr_len == 32);
35240         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35241         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
35242         uint64_t ret_ref = 0;
35243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35245         return ret_ref;
35246 }
35247
35248 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
35249         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
35250         uint64_t ret_ref = 0;
35251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35253         return ret_ref;
35254 }
35255 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
35256         LDKQueryChannelRange arg_conv;
35257         arg_conv.inner = untag_ptr(arg);
35258         arg_conv.is_owned = ptr_is_owned(arg);
35259         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35260         arg_conv.is_owned = false;
35261         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
35262         return ret_conv;
35263 }
35264
35265 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
35266         LDKQueryChannelRange orig_conv;
35267         orig_conv.inner = untag_ptr(orig);
35268         orig_conv.is_owned = ptr_is_owned(orig);
35269         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35270         orig_conv.is_owned = false;
35271         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
35272         uint64_t ret_ref = 0;
35273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35275         return ret_ref;
35276 }
35277
35278 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
35279         LDKQueryChannelRange a_conv;
35280         a_conv.inner = untag_ptr(a);
35281         a_conv.is_owned = ptr_is_owned(a);
35282         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35283         a_conv.is_owned = false;
35284         LDKQueryChannelRange b_conv;
35285         b_conv.inner = untag_ptr(b);
35286         b_conv.is_owned = ptr_is_owned(b);
35287         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35288         b_conv.is_owned = false;
35289         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
35290         return ret_conv;
35291 }
35292
35293 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
35294         LDKReplyChannelRange this_obj_conv;
35295         this_obj_conv.inner = untag_ptr(this_obj);
35296         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35298         ReplyChannelRange_free(this_obj_conv);
35299 }
35300
35301 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
35302         LDKReplyChannelRange this_ptr_conv;
35303         this_ptr_conv.inner = untag_ptr(this_ptr);
35304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35306         this_ptr_conv.is_owned = false;
35307         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35308         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
35309         return ret_arr;
35310 }
35311
35312 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35313         LDKReplyChannelRange this_ptr_conv;
35314         this_ptr_conv.inner = untag_ptr(this_ptr);
35315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35317         this_ptr_conv.is_owned = false;
35318         LDKThirtyTwoBytes val_ref;
35319         CHECK(val->arr_len == 32);
35320         memcpy(val_ref.data, val->elems, 32); FREE(val);
35321         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35322 }
35323
35324 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
35325         LDKReplyChannelRange this_ptr_conv;
35326         this_ptr_conv.inner = untag_ptr(this_ptr);
35327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35329         this_ptr_conv.is_owned = false;
35330         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35331         return ret_conv;
35332 }
35333
35334 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35335         LDKReplyChannelRange this_ptr_conv;
35336         this_ptr_conv.inner = untag_ptr(this_ptr);
35337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35339         this_ptr_conv.is_owned = false;
35340         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35341 }
35342
35343 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35344         LDKReplyChannelRange this_ptr_conv;
35345         this_ptr_conv.inner = untag_ptr(this_ptr);
35346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35348         this_ptr_conv.is_owned = false;
35349         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35350         return ret_conv;
35351 }
35352
35353 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35354         LDKReplyChannelRange this_ptr_conv;
35355         this_ptr_conv.inner = untag_ptr(this_ptr);
35356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35358         this_ptr_conv.is_owned = false;
35359         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35360 }
35361
35362 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
35363         LDKReplyChannelRange this_ptr_conv;
35364         this_ptr_conv.inner = untag_ptr(this_ptr);
35365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35367         this_ptr_conv.is_owned = false;
35368         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35369         return ret_conv;
35370 }
35371
35372 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
35373         LDKReplyChannelRange this_ptr_conv;
35374         this_ptr_conv.inner = untag_ptr(this_ptr);
35375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35377         this_ptr_conv.is_owned = false;
35378         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35379 }
35380
35381 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
35382         LDKReplyChannelRange this_ptr_conv;
35383         this_ptr_conv.inner = untag_ptr(this_ptr);
35384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35386         this_ptr_conv.is_owned = false;
35387         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
35388         int64_tArray ret_arr = NULL;
35389         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35390         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35391         for (size_t i = 0; i < ret_var.datalen; i++) {
35392                 int64_t ret_conv_8_conv = ret_var.data[i];
35393                 ret_arr_ptr[i] = ret_conv_8_conv;
35394         }
35395         
35396         FREE(ret_var.data);
35397         return ret_arr;
35398 }
35399
35400 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35401         LDKReplyChannelRange this_ptr_conv;
35402         this_ptr_conv.inner = untag_ptr(this_ptr);
35403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35405         this_ptr_conv.is_owned = false;
35406         LDKCVec_u64Z val_constr;
35407         val_constr.datalen = val->arr_len;
35408         if (val_constr.datalen > 0)
35409                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35410         else
35411                 val_constr.data = NULL;
35412         int64_t* val_vals = val->elems;
35413         for (size_t i = 0; i < val_constr.datalen; i++) {
35414                 int64_t val_conv_8 = val_vals[i];
35415                 val_constr.data[i] = val_conv_8;
35416         }
35417         FREE(val);
35418         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35419 }
35420
35421 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) {
35422         LDKThirtyTwoBytes chain_hash_arg_ref;
35423         CHECK(chain_hash_arg->arr_len == 32);
35424         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35425         LDKCVec_u64Z short_channel_ids_arg_constr;
35426         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35427         if (short_channel_ids_arg_constr.datalen > 0)
35428                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35429         else
35430                 short_channel_ids_arg_constr.data = NULL;
35431         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35432         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35433                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35434                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35435         }
35436         FREE(short_channel_ids_arg);
35437         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35438         uint64_t ret_ref = 0;
35439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35441         return ret_ref;
35442 }
35443
35444 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35445         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35446         uint64_t ret_ref = 0;
35447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35449         return ret_ref;
35450 }
35451 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
35452         LDKReplyChannelRange arg_conv;
35453         arg_conv.inner = untag_ptr(arg);
35454         arg_conv.is_owned = ptr_is_owned(arg);
35455         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35456         arg_conv.is_owned = false;
35457         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35458         return ret_conv;
35459 }
35460
35461 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
35462         LDKReplyChannelRange orig_conv;
35463         orig_conv.inner = untag_ptr(orig);
35464         orig_conv.is_owned = ptr_is_owned(orig);
35465         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35466         orig_conv.is_owned = false;
35467         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35468         uint64_t ret_ref = 0;
35469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35471         return ret_ref;
35472 }
35473
35474 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
35475         LDKReplyChannelRange a_conv;
35476         a_conv.inner = untag_ptr(a);
35477         a_conv.is_owned = ptr_is_owned(a);
35478         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35479         a_conv.is_owned = false;
35480         LDKReplyChannelRange b_conv;
35481         b_conv.inner = untag_ptr(b);
35482         b_conv.is_owned = ptr_is_owned(b);
35483         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35484         b_conv.is_owned = false;
35485         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
35486         return ret_conv;
35487 }
35488
35489 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
35490         LDKQueryShortChannelIds this_obj_conv;
35491         this_obj_conv.inner = untag_ptr(this_obj);
35492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35494         QueryShortChannelIds_free(this_obj_conv);
35495 }
35496
35497 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
35498         LDKQueryShortChannelIds this_ptr_conv;
35499         this_ptr_conv.inner = untag_ptr(this_ptr);
35500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35502         this_ptr_conv.is_owned = false;
35503         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35504         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
35505         return ret_arr;
35506 }
35507
35508 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35509         LDKQueryShortChannelIds this_ptr_conv;
35510         this_ptr_conv.inner = untag_ptr(this_ptr);
35511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35513         this_ptr_conv.is_owned = false;
35514         LDKThirtyTwoBytes val_ref;
35515         CHECK(val->arr_len == 32);
35516         memcpy(val_ref.data, val->elems, 32); FREE(val);
35517         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35518 }
35519
35520 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
35521         LDKQueryShortChannelIds this_ptr_conv;
35522         this_ptr_conv.inner = untag_ptr(this_ptr);
35523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35525         this_ptr_conv.is_owned = false;
35526         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
35527         int64_tArray ret_arr = NULL;
35528         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35529         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35530         for (size_t i = 0; i < ret_var.datalen; i++) {
35531                 int64_t ret_conv_8_conv = ret_var.data[i];
35532                 ret_arr_ptr[i] = ret_conv_8_conv;
35533         }
35534         
35535         FREE(ret_var.data);
35536         return ret_arr;
35537 }
35538
35539 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35540         LDKQueryShortChannelIds this_ptr_conv;
35541         this_ptr_conv.inner = untag_ptr(this_ptr);
35542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35544         this_ptr_conv.is_owned = false;
35545         LDKCVec_u64Z val_constr;
35546         val_constr.datalen = val->arr_len;
35547         if (val_constr.datalen > 0)
35548                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35549         else
35550                 val_constr.data = NULL;
35551         int64_t* val_vals = val->elems;
35552         for (size_t i = 0; i < val_constr.datalen; i++) {
35553                 int64_t val_conv_8 = val_vals[i];
35554                 val_constr.data[i] = val_conv_8;
35555         }
35556         FREE(val);
35557         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35558 }
35559
35560 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
35561         LDKThirtyTwoBytes chain_hash_arg_ref;
35562         CHECK(chain_hash_arg->arr_len == 32);
35563         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35564         LDKCVec_u64Z short_channel_ids_arg_constr;
35565         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35566         if (short_channel_ids_arg_constr.datalen > 0)
35567                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35568         else
35569                 short_channel_ids_arg_constr.data = NULL;
35570         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35571         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35572                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35573                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35574         }
35575         FREE(short_channel_ids_arg);
35576         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35577         uint64_t ret_ref = 0;
35578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35580         return ret_ref;
35581 }
35582
35583 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35584         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35585         uint64_t ret_ref = 0;
35586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35588         return ret_ref;
35589 }
35590 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
35591         LDKQueryShortChannelIds arg_conv;
35592         arg_conv.inner = untag_ptr(arg);
35593         arg_conv.is_owned = ptr_is_owned(arg);
35594         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35595         arg_conv.is_owned = false;
35596         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35597         return ret_conv;
35598 }
35599
35600 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
35601         LDKQueryShortChannelIds orig_conv;
35602         orig_conv.inner = untag_ptr(orig);
35603         orig_conv.is_owned = ptr_is_owned(orig);
35604         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35605         orig_conv.is_owned = false;
35606         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35607         uint64_t ret_ref = 0;
35608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35610         return ret_ref;
35611 }
35612
35613 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
35614         LDKQueryShortChannelIds a_conv;
35615         a_conv.inner = untag_ptr(a);
35616         a_conv.is_owned = ptr_is_owned(a);
35617         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35618         a_conv.is_owned = false;
35619         LDKQueryShortChannelIds b_conv;
35620         b_conv.inner = untag_ptr(b);
35621         b_conv.is_owned = ptr_is_owned(b);
35622         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35623         b_conv.is_owned = false;
35624         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
35625         return ret_conv;
35626 }
35627
35628 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
35629         LDKReplyShortChannelIdsEnd this_obj_conv;
35630         this_obj_conv.inner = untag_ptr(this_obj);
35631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35633         ReplyShortChannelIdsEnd_free(this_obj_conv);
35634 }
35635
35636 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
35637         LDKReplyShortChannelIdsEnd this_ptr_conv;
35638         this_ptr_conv.inner = untag_ptr(this_ptr);
35639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35641         this_ptr_conv.is_owned = false;
35642         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35643         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
35644         return ret_arr;
35645 }
35646
35647 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35648         LDKReplyShortChannelIdsEnd this_ptr_conv;
35649         this_ptr_conv.inner = untag_ptr(this_ptr);
35650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35652         this_ptr_conv.is_owned = false;
35653         LDKThirtyTwoBytes val_ref;
35654         CHECK(val->arr_len == 32);
35655         memcpy(val_ref.data, val->elems, 32); FREE(val);
35656         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35657 }
35658
35659 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
35660         LDKReplyShortChannelIdsEnd 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         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35666         return ret_conv;
35667 }
35668
35669 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
35670         LDKReplyShortChannelIdsEnd this_ptr_conv;
35671         this_ptr_conv.inner = untag_ptr(this_ptr);
35672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35674         this_ptr_conv.is_owned = false;
35675         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35676 }
35677
35678 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
35679         LDKThirtyTwoBytes chain_hash_arg_ref;
35680         CHECK(chain_hash_arg->arr_len == 32);
35681         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35682         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35683         uint64_t ret_ref = 0;
35684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35686         return ret_ref;
35687 }
35688
35689 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35690         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35691         uint64_t ret_ref = 0;
35692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35694         return ret_ref;
35695 }
35696 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
35697         LDKReplyShortChannelIdsEnd arg_conv;
35698         arg_conv.inner = untag_ptr(arg);
35699         arg_conv.is_owned = ptr_is_owned(arg);
35700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35701         arg_conv.is_owned = false;
35702         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35703         return ret_conv;
35704 }
35705
35706 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
35707         LDKReplyShortChannelIdsEnd orig_conv;
35708         orig_conv.inner = untag_ptr(orig);
35709         orig_conv.is_owned = ptr_is_owned(orig);
35710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35711         orig_conv.is_owned = false;
35712         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35713         uint64_t ret_ref = 0;
35714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35716         return ret_ref;
35717 }
35718
35719 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
35720         LDKReplyShortChannelIdsEnd a_conv;
35721         a_conv.inner = untag_ptr(a);
35722         a_conv.is_owned = ptr_is_owned(a);
35723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35724         a_conv.is_owned = false;
35725         LDKReplyShortChannelIdsEnd b_conv;
35726         b_conv.inner = untag_ptr(b);
35727         b_conv.is_owned = ptr_is_owned(b);
35728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35729         b_conv.is_owned = false;
35730         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
35731         return ret_conv;
35732 }
35733
35734 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
35735         LDKGossipTimestampFilter this_obj_conv;
35736         this_obj_conv.inner = untag_ptr(this_obj);
35737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35739         GossipTimestampFilter_free(this_obj_conv);
35740 }
35741
35742 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
35743         LDKGossipTimestampFilter this_ptr_conv;
35744         this_ptr_conv.inner = untag_ptr(this_ptr);
35745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35747         this_ptr_conv.is_owned = false;
35748         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35749         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
35750         return ret_arr;
35751 }
35752
35753 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35754         LDKGossipTimestampFilter this_ptr_conv;
35755         this_ptr_conv.inner = untag_ptr(this_ptr);
35756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35758         this_ptr_conv.is_owned = false;
35759         LDKThirtyTwoBytes val_ref;
35760         CHECK(val->arr_len == 32);
35761         memcpy(val_ref.data, val->elems, 32); FREE(val);
35762         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35763 }
35764
35765 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
35766         LDKGossipTimestampFilter this_ptr_conv;
35767         this_ptr_conv.inner = untag_ptr(this_ptr);
35768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35770         this_ptr_conv.is_owned = false;
35771         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35772         return ret_conv;
35773 }
35774
35775 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
35776         LDKGossipTimestampFilter this_ptr_conv;
35777         this_ptr_conv.inner = untag_ptr(this_ptr);
35778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35780         this_ptr_conv.is_owned = false;
35781         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35782 }
35783
35784 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
35785         LDKGossipTimestampFilter this_ptr_conv;
35786         this_ptr_conv.inner = untag_ptr(this_ptr);
35787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35789         this_ptr_conv.is_owned = false;
35790         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35791         return ret_conv;
35792 }
35793
35794 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
35795         LDKGossipTimestampFilter this_ptr_conv;
35796         this_ptr_conv.inner = untag_ptr(this_ptr);
35797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35799         this_ptr_conv.is_owned = false;
35800         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35801 }
35802
35803 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) {
35804         LDKThirtyTwoBytes chain_hash_arg_ref;
35805         CHECK(chain_hash_arg->arr_len == 32);
35806         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35807         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35808         uint64_t ret_ref = 0;
35809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35811         return ret_ref;
35812 }
35813
35814 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35815         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35816         uint64_t ret_ref = 0;
35817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35819         return ret_ref;
35820 }
35821 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
35822         LDKGossipTimestampFilter arg_conv;
35823         arg_conv.inner = untag_ptr(arg);
35824         arg_conv.is_owned = ptr_is_owned(arg);
35825         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35826         arg_conv.is_owned = false;
35827         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35828         return ret_conv;
35829 }
35830
35831 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
35832         LDKGossipTimestampFilter orig_conv;
35833         orig_conv.inner = untag_ptr(orig);
35834         orig_conv.is_owned = ptr_is_owned(orig);
35835         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35836         orig_conv.is_owned = false;
35837         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35838         uint64_t ret_ref = 0;
35839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35841         return ret_ref;
35842 }
35843
35844 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
35845         LDKGossipTimestampFilter a_conv;
35846         a_conv.inner = untag_ptr(a);
35847         a_conv.is_owned = ptr_is_owned(a);
35848         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35849         a_conv.is_owned = false;
35850         LDKGossipTimestampFilter b_conv;
35851         b_conv.inner = untag_ptr(b);
35852         b_conv.is_owned = ptr_is_owned(b);
35853         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35854         b_conv.is_owned = false;
35855         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
35856         return ret_conv;
35857 }
35858
35859 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
35860         if (!ptr_is_owned(this_ptr)) return;
35861         void* this_ptr_ptr = untag_ptr(this_ptr);
35862         CHECK_ACCESS(this_ptr_ptr);
35863         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35864         FREE(untag_ptr(this_ptr));
35865         ErrorAction_free(this_ptr_conv);
35866 }
35867
35868 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35869         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35870         *ret_copy = ErrorAction_clone(arg);
35871         uint64_t ret_ref = tag_ptr(ret_copy, true);
35872         return ret_ref;
35873 }
35874 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
35875         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35876         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35877         return ret_conv;
35878 }
35879
35880 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
35881         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35882         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35883         *ret_copy = ErrorAction_clone(orig_conv);
35884         uint64_t ret_ref = tag_ptr(ret_copy, true);
35885         return ret_ref;
35886 }
35887
35888 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
35889         LDKErrorMessage msg_conv;
35890         msg_conv.inner = untag_ptr(msg);
35891         msg_conv.is_owned = ptr_is_owned(msg);
35892         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35893         msg_conv = ErrorMessage_clone(&msg_conv);
35894         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35895         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35896         uint64_t ret_ref = tag_ptr(ret_copy, true);
35897         return ret_ref;
35898 }
35899
35900 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
35901         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35902         *ret_copy = ErrorAction_ignore_error();
35903         uint64_t ret_ref = tag_ptr(ret_copy, true);
35904         return ret_ref;
35905 }
35906
35907 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
35908         LDKLevel a_conv = LDKLevel_from_js(a);
35909         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35910         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35911         uint64_t ret_ref = tag_ptr(ret_copy, true);
35912         return ret_ref;
35913 }
35914
35915 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
35916         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35917         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35918         uint64_t ret_ref = tag_ptr(ret_copy, true);
35919         return ret_ref;
35920 }
35921
35922 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
35923         LDKErrorMessage msg_conv;
35924         msg_conv.inner = untag_ptr(msg);
35925         msg_conv.is_owned = ptr_is_owned(msg);
35926         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35927         msg_conv = ErrorMessage_clone(&msg_conv);
35928         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35929         *ret_copy = ErrorAction_send_error_message(msg_conv);
35930         uint64_t ret_ref = tag_ptr(ret_copy, true);
35931         return ret_ref;
35932 }
35933
35934 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
35935         LDKWarningMessage msg_conv;
35936         msg_conv.inner = untag_ptr(msg);
35937         msg_conv.is_owned = ptr_is_owned(msg);
35938         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35939         msg_conv = WarningMessage_clone(&msg_conv);
35940         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
35941         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35942         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35943         uint64_t ret_ref = tag_ptr(ret_copy, true);
35944         return ret_ref;
35945 }
35946
35947 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
35948         LDKLightningError this_obj_conv;
35949         this_obj_conv.inner = untag_ptr(this_obj);
35950         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35952         LightningError_free(this_obj_conv);
35953 }
35954
35955 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
35956         LDKLightningError this_ptr_conv;
35957         this_ptr_conv.inner = untag_ptr(this_ptr);
35958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35960         this_ptr_conv.is_owned = false;
35961         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35962         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35963         Str_free(ret_str);
35964         return ret_conv;
35965 }
35966
35967 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
35968         LDKLightningError this_ptr_conv;
35969         this_ptr_conv.inner = untag_ptr(this_ptr);
35970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35972         this_ptr_conv.is_owned = false;
35973         LDKStr val_conv = str_ref_to_owned_c(val);
35974         LightningError_set_err(&this_ptr_conv, val_conv);
35975 }
35976
35977 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
35978         LDKLightningError this_ptr_conv;
35979         this_ptr_conv.inner = untag_ptr(this_ptr);
35980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35982         this_ptr_conv.is_owned = false;
35983         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35984         *ret_copy = LightningError_get_action(&this_ptr_conv);
35985         uint64_t ret_ref = tag_ptr(ret_copy, true);
35986         return ret_ref;
35987 }
35988
35989 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
35990         LDKLightningError this_ptr_conv;
35991         this_ptr_conv.inner = untag_ptr(this_ptr);
35992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35994         this_ptr_conv.is_owned = false;
35995         void* val_ptr = untag_ptr(val);
35996         CHECK_ACCESS(val_ptr);
35997         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35998         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35999         LightningError_set_action(&this_ptr_conv, val_conv);
36000 }
36001
36002 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
36003         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
36004         void* action_arg_ptr = untag_ptr(action_arg);
36005         CHECK_ACCESS(action_arg_ptr);
36006         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
36007         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
36008         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
36009         uint64_t ret_ref = 0;
36010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36012         return ret_ref;
36013 }
36014
36015 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
36016         LDKLightningError ret_var = LightningError_clone(arg);
36017         uint64_t ret_ref = 0;
36018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36020         return ret_ref;
36021 }
36022 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
36023         LDKLightningError arg_conv;
36024         arg_conv.inner = untag_ptr(arg);
36025         arg_conv.is_owned = ptr_is_owned(arg);
36026         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36027         arg_conv.is_owned = false;
36028         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
36029         return ret_conv;
36030 }
36031
36032 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
36033         LDKLightningError orig_conv;
36034         orig_conv.inner = untag_ptr(orig);
36035         orig_conv.is_owned = ptr_is_owned(orig);
36036         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36037         orig_conv.is_owned = false;
36038         LDKLightningError ret_var = LightningError_clone(&orig_conv);
36039         uint64_t ret_ref = 0;
36040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36042         return ret_ref;
36043 }
36044
36045 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
36046         LDKCommitmentUpdate this_obj_conv;
36047         this_obj_conv.inner = untag_ptr(this_obj);
36048         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36050         CommitmentUpdate_free(this_obj_conv);
36051 }
36052
36053 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
36054         LDKCommitmentUpdate this_ptr_conv;
36055         this_ptr_conv.inner = untag_ptr(this_ptr);
36056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36058         this_ptr_conv.is_owned = false;
36059         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
36060         uint64_tArray ret_arr = NULL;
36061         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36062         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36063         for (size_t p = 0; p < ret_var.datalen; p++) {
36064                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
36065                 uint64_t ret_conv_15_ref = 0;
36066                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
36067                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
36068                 ret_arr_ptr[p] = ret_conv_15_ref;
36069         }
36070         
36071         FREE(ret_var.data);
36072         return ret_arr;
36073 }
36074
36075 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
36076         LDKCommitmentUpdate this_ptr_conv;
36077         this_ptr_conv.inner = untag_ptr(this_ptr);
36078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36080         this_ptr_conv.is_owned = false;
36081         LDKCVec_UpdateAddHTLCZ val_constr;
36082         val_constr.datalen = val->arr_len;
36083         if (val_constr.datalen > 0)
36084                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36085         else
36086                 val_constr.data = NULL;
36087         uint64_t* val_vals = val->elems;
36088         for (size_t p = 0; p < val_constr.datalen; p++) {
36089                 uint64_t val_conv_15 = val_vals[p];
36090                 LDKUpdateAddHTLC val_conv_15_conv;
36091                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
36092                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
36093                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
36094                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
36095                 val_constr.data[p] = val_conv_15_conv;
36096         }
36097         FREE(val);
36098         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
36099 }
36100
36101 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
36102         LDKCommitmentUpdate this_ptr_conv;
36103         this_ptr_conv.inner = untag_ptr(this_ptr);
36104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36106         this_ptr_conv.is_owned = false;
36107         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
36108         uint64_tArray ret_arr = NULL;
36109         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36110         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36111         for (size_t t = 0; t < ret_var.datalen; t++) {
36112                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
36113                 uint64_t ret_conv_19_ref = 0;
36114                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
36115                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
36116                 ret_arr_ptr[t] = ret_conv_19_ref;
36117         }
36118         
36119         FREE(ret_var.data);
36120         return ret_arr;
36121 }
36122
36123 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
36124         LDKCommitmentUpdate this_ptr_conv;
36125         this_ptr_conv.inner = untag_ptr(this_ptr);
36126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36128         this_ptr_conv.is_owned = false;
36129         LDKCVec_UpdateFulfillHTLCZ val_constr;
36130         val_constr.datalen = val->arr_len;
36131         if (val_constr.datalen > 0)
36132                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36133         else
36134                 val_constr.data = NULL;
36135         uint64_t* val_vals = val->elems;
36136         for (size_t t = 0; t < val_constr.datalen; t++) {
36137                 uint64_t val_conv_19 = val_vals[t];
36138                 LDKUpdateFulfillHTLC val_conv_19_conv;
36139                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
36140                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
36141                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
36142                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
36143                 val_constr.data[t] = val_conv_19_conv;
36144         }
36145         FREE(val);
36146         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
36147 }
36148
36149 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
36150         LDKCommitmentUpdate this_ptr_conv;
36151         this_ptr_conv.inner = untag_ptr(this_ptr);
36152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36154         this_ptr_conv.is_owned = false;
36155         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
36156         uint64_tArray ret_arr = NULL;
36157         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36158         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36159         for (size_t q = 0; q < ret_var.datalen; q++) {
36160                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
36161                 uint64_t ret_conv_16_ref = 0;
36162                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
36163                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
36164                 ret_arr_ptr[q] = ret_conv_16_ref;
36165         }
36166         
36167         FREE(ret_var.data);
36168         return ret_arr;
36169 }
36170
36171 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
36172         LDKCommitmentUpdate this_ptr_conv;
36173         this_ptr_conv.inner = untag_ptr(this_ptr);
36174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36176         this_ptr_conv.is_owned = false;
36177         LDKCVec_UpdateFailHTLCZ val_constr;
36178         val_constr.datalen = val->arr_len;
36179         if (val_constr.datalen > 0)
36180                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36181         else
36182                 val_constr.data = NULL;
36183         uint64_t* val_vals = val->elems;
36184         for (size_t q = 0; q < val_constr.datalen; q++) {
36185                 uint64_t val_conv_16 = val_vals[q];
36186                 LDKUpdateFailHTLC val_conv_16_conv;
36187                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
36188                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
36189                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
36190                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
36191                 val_constr.data[q] = val_conv_16_conv;
36192         }
36193         FREE(val);
36194         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
36195 }
36196
36197 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
36198         LDKCommitmentUpdate this_ptr_conv;
36199         this_ptr_conv.inner = untag_ptr(this_ptr);
36200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36202         this_ptr_conv.is_owned = false;
36203         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
36204         uint64_tArray ret_arr = NULL;
36205         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36206         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36207         for (size_t z = 0; z < ret_var.datalen; z++) {
36208                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
36209                 uint64_t ret_conv_25_ref = 0;
36210                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
36211                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
36212                 ret_arr_ptr[z] = ret_conv_25_ref;
36213         }
36214         
36215         FREE(ret_var.data);
36216         return ret_arr;
36217 }
36218
36219 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) {
36220         LDKCommitmentUpdate this_ptr_conv;
36221         this_ptr_conv.inner = untag_ptr(this_ptr);
36222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36224         this_ptr_conv.is_owned = false;
36225         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
36226         val_constr.datalen = val->arr_len;
36227         if (val_constr.datalen > 0)
36228                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36229         else
36230                 val_constr.data = NULL;
36231         uint64_t* val_vals = val->elems;
36232         for (size_t z = 0; z < val_constr.datalen; z++) {
36233                 uint64_t val_conv_25 = val_vals[z];
36234                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
36235                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
36236                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
36237                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
36238                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
36239                 val_constr.data[z] = val_conv_25_conv;
36240         }
36241         FREE(val);
36242         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
36243 }
36244
36245 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
36246         LDKCommitmentUpdate this_ptr_conv;
36247         this_ptr_conv.inner = untag_ptr(this_ptr);
36248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36250         this_ptr_conv.is_owned = false;
36251         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
36252         uint64_t ret_ref = 0;
36253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36255         return ret_ref;
36256 }
36257
36258 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
36259         LDKCommitmentUpdate this_ptr_conv;
36260         this_ptr_conv.inner = untag_ptr(this_ptr);
36261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36263         this_ptr_conv.is_owned = false;
36264         LDKUpdateFee val_conv;
36265         val_conv.inner = untag_ptr(val);
36266         val_conv.is_owned = ptr_is_owned(val);
36267         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36268         val_conv = UpdateFee_clone(&val_conv);
36269         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
36270 }
36271
36272 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
36273         LDKCommitmentUpdate this_ptr_conv;
36274         this_ptr_conv.inner = untag_ptr(this_ptr);
36275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36277         this_ptr_conv.is_owned = false;
36278         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
36279         uint64_t ret_ref = 0;
36280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36282         return ret_ref;
36283 }
36284
36285 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
36286         LDKCommitmentUpdate this_ptr_conv;
36287         this_ptr_conv.inner = untag_ptr(this_ptr);
36288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36290         this_ptr_conv.is_owned = false;
36291         LDKCommitmentSigned val_conv;
36292         val_conv.inner = untag_ptr(val);
36293         val_conv.is_owned = ptr_is_owned(val);
36294         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36295         val_conv = CommitmentSigned_clone(&val_conv);
36296         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
36297 }
36298
36299 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) {
36300         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
36301         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
36302         if (update_add_htlcs_arg_constr.datalen > 0)
36303                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36304         else
36305                 update_add_htlcs_arg_constr.data = NULL;
36306         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
36307         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
36308                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
36309                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
36310                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
36311                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
36312                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
36313                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
36314                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
36315         }
36316         FREE(update_add_htlcs_arg);
36317         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
36318         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
36319         if (update_fulfill_htlcs_arg_constr.datalen > 0)
36320                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36321         else
36322                 update_fulfill_htlcs_arg_constr.data = NULL;
36323         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
36324         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
36325                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
36326                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
36327                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
36328                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
36329                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
36330                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
36331                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
36332         }
36333         FREE(update_fulfill_htlcs_arg);
36334         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
36335         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
36336         if (update_fail_htlcs_arg_constr.datalen > 0)
36337                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36338         else
36339                 update_fail_htlcs_arg_constr.data = NULL;
36340         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
36341         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
36342                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
36343                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
36344                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
36345                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
36346                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
36347                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
36348                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
36349         }
36350         FREE(update_fail_htlcs_arg);
36351         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
36352         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
36353         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
36354                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36355         else
36356                 update_fail_malformed_htlcs_arg_constr.data = NULL;
36357         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
36358         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
36359                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
36360                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
36361                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
36362                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
36363                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
36364                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
36365                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
36366         }
36367         FREE(update_fail_malformed_htlcs_arg);
36368         LDKUpdateFee update_fee_arg_conv;
36369         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
36370         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
36371         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
36372         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
36373         LDKCommitmentSigned commitment_signed_arg_conv;
36374         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
36375         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
36376         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
36377         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
36378         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);
36379         uint64_t ret_ref = 0;
36380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36382         return ret_ref;
36383 }
36384
36385 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36386         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36387         uint64_t ret_ref = 0;
36388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36390         return ret_ref;
36391 }
36392 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
36393         LDKCommitmentUpdate arg_conv;
36394         arg_conv.inner = untag_ptr(arg);
36395         arg_conv.is_owned = ptr_is_owned(arg);
36396         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36397         arg_conv.is_owned = false;
36398         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36399         return ret_conv;
36400 }
36401
36402 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
36403         LDKCommitmentUpdate orig_conv;
36404         orig_conv.inner = untag_ptr(orig);
36405         orig_conv.is_owned = ptr_is_owned(orig);
36406         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36407         orig_conv.is_owned = false;
36408         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36409         uint64_t ret_ref = 0;
36410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36412         return ret_ref;
36413 }
36414
36415 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
36416         LDKCommitmentUpdate a_conv;
36417         a_conv.inner = untag_ptr(a);
36418         a_conv.is_owned = ptr_is_owned(a);
36419         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36420         a_conv.is_owned = false;
36421         LDKCommitmentUpdate b_conv;
36422         b_conv.inner = untag_ptr(b);
36423         b_conv.is_owned = ptr_is_owned(b);
36424         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36425         b_conv.is_owned = false;
36426         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
36427         return ret_conv;
36428 }
36429
36430 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
36431         if (!ptr_is_owned(this_ptr)) return;
36432         void* this_ptr_ptr = untag_ptr(this_ptr);
36433         CHECK_ACCESS(this_ptr_ptr);
36434         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36435         FREE(untag_ptr(this_ptr));
36436         ChannelMessageHandler_free(this_ptr_conv);
36437 }
36438
36439 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
36440         if (!ptr_is_owned(this_ptr)) return;
36441         void* this_ptr_ptr = untag_ptr(this_ptr);
36442         CHECK_ACCESS(this_ptr_ptr);
36443         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36444         FREE(untag_ptr(this_ptr));
36445         RoutingMessageHandler_free(this_ptr_conv);
36446 }
36447
36448 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
36449         if (!ptr_is_owned(this_ptr)) return;
36450         void* this_ptr_ptr = untag_ptr(this_ptr);
36451         CHECK_ACCESS(this_ptr_ptr);
36452         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
36453         FREE(untag_ptr(this_ptr));
36454         OnionMessageHandler_free(this_ptr_conv);
36455 }
36456
36457 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
36458         LDKAcceptChannel obj_conv;
36459         obj_conv.inner = untag_ptr(obj);
36460         obj_conv.is_owned = ptr_is_owned(obj);
36461         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36462         obj_conv.is_owned = false;
36463         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36464         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36465         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36466         CVec_u8Z_free(ret_var);
36467         return ret_arr;
36468 }
36469
36470 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
36471         LDKu8slice ser_ref;
36472         ser_ref.datalen = ser->arr_len;
36473         ser_ref.data = ser->elems;
36474         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36475         *ret_conv = AcceptChannel_read(ser_ref);
36476         FREE(ser);
36477         return tag_ptr(ret_conv, true);
36478 }
36479
36480 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
36481         LDKAnnouncementSignatures obj_conv;
36482         obj_conv.inner = untag_ptr(obj);
36483         obj_conv.is_owned = ptr_is_owned(obj);
36484         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36485         obj_conv.is_owned = false;
36486         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36487         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36488         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36489         CVec_u8Z_free(ret_var);
36490         return ret_arr;
36491 }
36492
36493 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
36494         LDKu8slice ser_ref;
36495         ser_ref.datalen = ser->arr_len;
36496         ser_ref.data = ser->elems;
36497         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36498         *ret_conv = AnnouncementSignatures_read(ser_ref);
36499         FREE(ser);
36500         return tag_ptr(ret_conv, true);
36501 }
36502
36503 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
36504         LDKChannelReestablish obj_conv;
36505         obj_conv.inner = untag_ptr(obj);
36506         obj_conv.is_owned = ptr_is_owned(obj);
36507         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36508         obj_conv.is_owned = false;
36509         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36510         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36511         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36512         CVec_u8Z_free(ret_var);
36513         return ret_arr;
36514 }
36515
36516 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
36517         LDKu8slice ser_ref;
36518         ser_ref.datalen = ser->arr_len;
36519         ser_ref.data = ser->elems;
36520         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36521         *ret_conv = ChannelReestablish_read(ser_ref);
36522         FREE(ser);
36523         return tag_ptr(ret_conv, true);
36524 }
36525
36526 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
36527         LDKClosingSigned obj_conv;
36528         obj_conv.inner = untag_ptr(obj);
36529         obj_conv.is_owned = ptr_is_owned(obj);
36530         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36531         obj_conv.is_owned = false;
36532         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36533         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36534         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36535         CVec_u8Z_free(ret_var);
36536         return ret_arr;
36537 }
36538
36539 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
36540         LDKu8slice ser_ref;
36541         ser_ref.datalen = ser->arr_len;
36542         ser_ref.data = ser->elems;
36543         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36544         *ret_conv = ClosingSigned_read(ser_ref);
36545         FREE(ser);
36546         return tag_ptr(ret_conv, true);
36547 }
36548
36549 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
36550         LDKClosingSignedFeeRange obj_conv;
36551         obj_conv.inner = untag_ptr(obj);
36552         obj_conv.is_owned = ptr_is_owned(obj);
36553         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36554         obj_conv.is_owned = false;
36555         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36556         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36557         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36558         CVec_u8Z_free(ret_var);
36559         return ret_arr;
36560 }
36561
36562 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
36563         LDKu8slice ser_ref;
36564         ser_ref.datalen = ser->arr_len;
36565         ser_ref.data = ser->elems;
36566         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36567         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36568         FREE(ser);
36569         return tag_ptr(ret_conv, true);
36570 }
36571
36572 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
36573         LDKCommitmentSigned obj_conv;
36574         obj_conv.inner = untag_ptr(obj);
36575         obj_conv.is_owned = ptr_is_owned(obj);
36576         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36577         obj_conv.is_owned = false;
36578         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36579         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36580         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36581         CVec_u8Z_free(ret_var);
36582         return ret_arr;
36583 }
36584
36585 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
36586         LDKu8slice ser_ref;
36587         ser_ref.datalen = ser->arr_len;
36588         ser_ref.data = ser->elems;
36589         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36590         *ret_conv = CommitmentSigned_read(ser_ref);
36591         FREE(ser);
36592         return tag_ptr(ret_conv, true);
36593 }
36594
36595 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
36596         LDKFundingCreated obj_conv;
36597         obj_conv.inner = untag_ptr(obj);
36598         obj_conv.is_owned = ptr_is_owned(obj);
36599         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36600         obj_conv.is_owned = false;
36601         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36602         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36603         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36604         CVec_u8Z_free(ret_var);
36605         return ret_arr;
36606 }
36607
36608 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
36609         LDKu8slice ser_ref;
36610         ser_ref.datalen = ser->arr_len;
36611         ser_ref.data = ser->elems;
36612         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36613         *ret_conv = FundingCreated_read(ser_ref);
36614         FREE(ser);
36615         return tag_ptr(ret_conv, true);
36616 }
36617
36618 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
36619         LDKFundingSigned obj_conv;
36620         obj_conv.inner = untag_ptr(obj);
36621         obj_conv.is_owned = ptr_is_owned(obj);
36622         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36623         obj_conv.is_owned = false;
36624         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36625         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36626         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36627         CVec_u8Z_free(ret_var);
36628         return ret_arr;
36629 }
36630
36631 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
36632         LDKu8slice ser_ref;
36633         ser_ref.datalen = ser->arr_len;
36634         ser_ref.data = ser->elems;
36635         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36636         *ret_conv = FundingSigned_read(ser_ref);
36637         FREE(ser);
36638         return tag_ptr(ret_conv, true);
36639 }
36640
36641 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
36642         LDKChannelReady obj_conv;
36643         obj_conv.inner = untag_ptr(obj);
36644         obj_conv.is_owned = ptr_is_owned(obj);
36645         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36646         obj_conv.is_owned = false;
36647         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36648         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36649         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36650         CVec_u8Z_free(ret_var);
36651         return ret_arr;
36652 }
36653
36654 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
36655         LDKu8slice ser_ref;
36656         ser_ref.datalen = ser->arr_len;
36657         ser_ref.data = ser->elems;
36658         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36659         *ret_conv = ChannelReady_read(ser_ref);
36660         FREE(ser);
36661         return tag_ptr(ret_conv, true);
36662 }
36663
36664 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
36665         LDKInit obj_conv;
36666         obj_conv.inner = untag_ptr(obj);
36667         obj_conv.is_owned = ptr_is_owned(obj);
36668         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36669         obj_conv.is_owned = false;
36670         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36671         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36672         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36673         CVec_u8Z_free(ret_var);
36674         return ret_arr;
36675 }
36676
36677 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
36678         LDKu8slice ser_ref;
36679         ser_ref.datalen = ser->arr_len;
36680         ser_ref.data = ser->elems;
36681         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36682         *ret_conv = Init_read(ser_ref);
36683         FREE(ser);
36684         return tag_ptr(ret_conv, true);
36685 }
36686
36687 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
36688         LDKOpenChannel obj_conv;
36689         obj_conv.inner = untag_ptr(obj);
36690         obj_conv.is_owned = ptr_is_owned(obj);
36691         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36692         obj_conv.is_owned = false;
36693         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36694         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36695         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36696         CVec_u8Z_free(ret_var);
36697         return ret_arr;
36698 }
36699
36700 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
36701         LDKu8slice ser_ref;
36702         ser_ref.datalen = ser->arr_len;
36703         ser_ref.data = ser->elems;
36704         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36705         *ret_conv = OpenChannel_read(ser_ref);
36706         FREE(ser);
36707         return tag_ptr(ret_conv, true);
36708 }
36709
36710 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
36711         LDKRevokeAndACK obj_conv;
36712         obj_conv.inner = untag_ptr(obj);
36713         obj_conv.is_owned = ptr_is_owned(obj);
36714         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36715         obj_conv.is_owned = false;
36716         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36717         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36718         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36719         CVec_u8Z_free(ret_var);
36720         return ret_arr;
36721 }
36722
36723 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
36724         LDKu8slice ser_ref;
36725         ser_ref.datalen = ser->arr_len;
36726         ser_ref.data = ser->elems;
36727         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36728         *ret_conv = RevokeAndACK_read(ser_ref);
36729         FREE(ser);
36730         return tag_ptr(ret_conv, true);
36731 }
36732
36733 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
36734         LDKShutdown obj_conv;
36735         obj_conv.inner = untag_ptr(obj);
36736         obj_conv.is_owned = ptr_is_owned(obj);
36737         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36738         obj_conv.is_owned = false;
36739         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36740         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36741         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36742         CVec_u8Z_free(ret_var);
36743         return ret_arr;
36744 }
36745
36746 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
36747         LDKu8slice ser_ref;
36748         ser_ref.datalen = ser->arr_len;
36749         ser_ref.data = ser->elems;
36750         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36751         *ret_conv = Shutdown_read(ser_ref);
36752         FREE(ser);
36753         return tag_ptr(ret_conv, true);
36754 }
36755
36756 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
36757         LDKUpdateFailHTLC obj_conv;
36758         obj_conv.inner = untag_ptr(obj);
36759         obj_conv.is_owned = ptr_is_owned(obj);
36760         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36761         obj_conv.is_owned = false;
36762         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36763         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36764         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36765         CVec_u8Z_free(ret_var);
36766         return ret_arr;
36767 }
36768
36769 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
36770         LDKu8slice ser_ref;
36771         ser_ref.datalen = ser->arr_len;
36772         ser_ref.data = ser->elems;
36773         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36774         *ret_conv = UpdateFailHTLC_read(ser_ref);
36775         FREE(ser);
36776         return tag_ptr(ret_conv, true);
36777 }
36778
36779 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
36780         LDKUpdateFailMalformedHTLC obj_conv;
36781         obj_conv.inner = untag_ptr(obj);
36782         obj_conv.is_owned = ptr_is_owned(obj);
36783         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36784         obj_conv.is_owned = false;
36785         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36786         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36787         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36788         CVec_u8Z_free(ret_var);
36789         return ret_arr;
36790 }
36791
36792 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
36793         LDKu8slice ser_ref;
36794         ser_ref.datalen = ser->arr_len;
36795         ser_ref.data = ser->elems;
36796         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36797         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36798         FREE(ser);
36799         return tag_ptr(ret_conv, true);
36800 }
36801
36802 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
36803         LDKUpdateFee obj_conv;
36804         obj_conv.inner = untag_ptr(obj);
36805         obj_conv.is_owned = ptr_is_owned(obj);
36806         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36807         obj_conv.is_owned = false;
36808         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36809         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36810         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36811         CVec_u8Z_free(ret_var);
36812         return ret_arr;
36813 }
36814
36815 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
36816         LDKu8slice ser_ref;
36817         ser_ref.datalen = ser->arr_len;
36818         ser_ref.data = ser->elems;
36819         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36820         *ret_conv = UpdateFee_read(ser_ref);
36821         FREE(ser);
36822         return tag_ptr(ret_conv, true);
36823 }
36824
36825 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
36826         LDKUpdateFulfillHTLC obj_conv;
36827         obj_conv.inner = untag_ptr(obj);
36828         obj_conv.is_owned = ptr_is_owned(obj);
36829         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36830         obj_conv.is_owned = false;
36831         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36834         CVec_u8Z_free(ret_var);
36835         return ret_arr;
36836 }
36837
36838 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
36839         LDKu8slice ser_ref;
36840         ser_ref.datalen = ser->arr_len;
36841         ser_ref.data = ser->elems;
36842         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36843         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36844         FREE(ser);
36845         return tag_ptr(ret_conv, true);
36846 }
36847
36848 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
36849         LDKUpdateAddHTLC obj_conv;
36850         obj_conv.inner = untag_ptr(obj);
36851         obj_conv.is_owned = ptr_is_owned(obj);
36852         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36853         obj_conv.is_owned = false;
36854         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36855         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36856         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36857         CVec_u8Z_free(ret_var);
36858         return ret_arr;
36859 }
36860
36861 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
36862         LDKu8slice ser_ref;
36863         ser_ref.datalen = ser->arr_len;
36864         ser_ref.data = ser->elems;
36865         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36866         *ret_conv = UpdateAddHTLC_read(ser_ref);
36867         FREE(ser);
36868         return tag_ptr(ret_conv, true);
36869 }
36870
36871 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
36872         LDKu8slice ser_ref;
36873         ser_ref.datalen = ser->arr_len;
36874         ser_ref.data = ser->elems;
36875         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
36876         *ret_conv = OnionMessage_read(ser_ref);
36877         FREE(ser);
36878         return tag_ptr(ret_conv, true);
36879 }
36880
36881 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
36882         LDKOnionMessage obj_conv;
36883         obj_conv.inner = untag_ptr(obj);
36884         obj_conv.is_owned = ptr_is_owned(obj);
36885         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36886         obj_conv.is_owned = false;
36887         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
36888         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36889         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36890         CVec_u8Z_free(ret_var);
36891         return ret_arr;
36892 }
36893
36894 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
36895         LDKPing obj_conv;
36896         obj_conv.inner = untag_ptr(obj);
36897         obj_conv.is_owned = ptr_is_owned(obj);
36898         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36899         obj_conv.is_owned = false;
36900         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36901         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36902         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36903         CVec_u8Z_free(ret_var);
36904         return ret_arr;
36905 }
36906
36907 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
36908         LDKu8slice ser_ref;
36909         ser_ref.datalen = ser->arr_len;
36910         ser_ref.data = ser->elems;
36911         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36912         *ret_conv = Ping_read(ser_ref);
36913         FREE(ser);
36914         return tag_ptr(ret_conv, true);
36915 }
36916
36917 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
36918         LDKPong obj_conv;
36919         obj_conv.inner = untag_ptr(obj);
36920         obj_conv.is_owned = ptr_is_owned(obj);
36921         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36922         obj_conv.is_owned = false;
36923         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36924         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36925         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36926         CVec_u8Z_free(ret_var);
36927         return ret_arr;
36928 }
36929
36930 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
36931         LDKu8slice ser_ref;
36932         ser_ref.datalen = ser->arr_len;
36933         ser_ref.data = ser->elems;
36934         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36935         *ret_conv = Pong_read(ser_ref);
36936         FREE(ser);
36937         return tag_ptr(ret_conv, true);
36938 }
36939
36940 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
36941         LDKUnsignedChannelAnnouncement obj_conv;
36942         obj_conv.inner = untag_ptr(obj);
36943         obj_conv.is_owned = ptr_is_owned(obj);
36944         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36945         obj_conv.is_owned = false;
36946         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36947         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36948         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36949         CVec_u8Z_free(ret_var);
36950         return ret_arr;
36951 }
36952
36953 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
36954         LDKu8slice ser_ref;
36955         ser_ref.datalen = ser->arr_len;
36956         ser_ref.data = ser->elems;
36957         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36958         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36959         FREE(ser);
36960         return tag_ptr(ret_conv, true);
36961 }
36962
36963 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
36964         LDKChannelAnnouncement obj_conv;
36965         obj_conv.inner = untag_ptr(obj);
36966         obj_conv.is_owned = ptr_is_owned(obj);
36967         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36968         obj_conv.is_owned = false;
36969         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36970         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36971         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36972         CVec_u8Z_free(ret_var);
36973         return ret_arr;
36974 }
36975
36976 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
36977         LDKu8slice ser_ref;
36978         ser_ref.datalen = ser->arr_len;
36979         ser_ref.data = ser->elems;
36980         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36981         *ret_conv = ChannelAnnouncement_read(ser_ref);
36982         FREE(ser);
36983         return tag_ptr(ret_conv, true);
36984 }
36985
36986 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
36987         LDKUnsignedChannelUpdate obj_conv;
36988         obj_conv.inner = untag_ptr(obj);
36989         obj_conv.is_owned = ptr_is_owned(obj);
36990         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36991         obj_conv.is_owned = false;
36992         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36995         CVec_u8Z_free(ret_var);
36996         return ret_arr;
36997 }
36998
36999 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
37000         LDKu8slice ser_ref;
37001         ser_ref.datalen = ser->arr_len;
37002         ser_ref.data = ser->elems;
37003         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
37004         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
37005         FREE(ser);
37006         return tag_ptr(ret_conv, true);
37007 }
37008
37009 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
37010         LDKChannelUpdate obj_conv;
37011         obj_conv.inner = untag_ptr(obj);
37012         obj_conv.is_owned = ptr_is_owned(obj);
37013         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37014         obj_conv.is_owned = false;
37015         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
37016         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37017         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37018         CVec_u8Z_free(ret_var);
37019         return ret_arr;
37020 }
37021
37022 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
37023         LDKu8slice ser_ref;
37024         ser_ref.datalen = ser->arr_len;
37025         ser_ref.data = ser->elems;
37026         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
37027         *ret_conv = ChannelUpdate_read(ser_ref);
37028         FREE(ser);
37029         return tag_ptr(ret_conv, true);
37030 }
37031
37032 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
37033         LDKErrorMessage obj_conv;
37034         obj_conv.inner = untag_ptr(obj);
37035         obj_conv.is_owned = ptr_is_owned(obj);
37036         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37037         obj_conv.is_owned = false;
37038         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
37039         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37040         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37041         CVec_u8Z_free(ret_var);
37042         return ret_arr;
37043 }
37044
37045 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
37046         LDKu8slice ser_ref;
37047         ser_ref.datalen = ser->arr_len;
37048         ser_ref.data = ser->elems;
37049         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
37050         *ret_conv = ErrorMessage_read(ser_ref);
37051         FREE(ser);
37052         return tag_ptr(ret_conv, true);
37053 }
37054
37055 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
37056         LDKWarningMessage obj_conv;
37057         obj_conv.inner = untag_ptr(obj);
37058         obj_conv.is_owned = ptr_is_owned(obj);
37059         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37060         obj_conv.is_owned = false;
37061         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
37062         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37063         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37064         CVec_u8Z_free(ret_var);
37065         return ret_arr;
37066 }
37067
37068 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
37069         LDKu8slice ser_ref;
37070         ser_ref.datalen = ser->arr_len;
37071         ser_ref.data = ser->elems;
37072         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
37073         *ret_conv = WarningMessage_read(ser_ref);
37074         FREE(ser);
37075         return tag_ptr(ret_conv, true);
37076 }
37077
37078 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
37079         LDKUnsignedNodeAnnouncement obj_conv;
37080         obj_conv.inner = untag_ptr(obj);
37081         obj_conv.is_owned = ptr_is_owned(obj);
37082         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37083         obj_conv.is_owned = false;
37084         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
37085         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37086         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37087         CVec_u8Z_free(ret_var);
37088         return ret_arr;
37089 }
37090
37091 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
37092         LDKu8slice ser_ref;
37093         ser_ref.datalen = ser->arr_len;
37094         ser_ref.data = ser->elems;
37095         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
37096         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
37097         FREE(ser);
37098         return tag_ptr(ret_conv, true);
37099 }
37100
37101 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
37102         LDKNodeAnnouncement obj_conv;
37103         obj_conv.inner = untag_ptr(obj);
37104         obj_conv.is_owned = ptr_is_owned(obj);
37105         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37106         obj_conv.is_owned = false;
37107         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
37108         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37109         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37110         CVec_u8Z_free(ret_var);
37111         return ret_arr;
37112 }
37113
37114 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
37115         LDKu8slice ser_ref;
37116         ser_ref.datalen = ser->arr_len;
37117         ser_ref.data = ser->elems;
37118         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
37119         *ret_conv = NodeAnnouncement_read(ser_ref);
37120         FREE(ser);
37121         return tag_ptr(ret_conv, true);
37122 }
37123
37124 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
37125         LDKu8slice ser_ref;
37126         ser_ref.datalen = ser->arr_len;
37127         ser_ref.data = ser->elems;
37128         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
37129         *ret_conv = QueryShortChannelIds_read(ser_ref);
37130         FREE(ser);
37131         return tag_ptr(ret_conv, true);
37132 }
37133
37134 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
37135         LDKQueryShortChannelIds obj_conv;
37136         obj_conv.inner = untag_ptr(obj);
37137         obj_conv.is_owned = ptr_is_owned(obj);
37138         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37139         obj_conv.is_owned = false;
37140         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
37141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37143         CVec_u8Z_free(ret_var);
37144         return ret_arr;
37145 }
37146
37147 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
37148         LDKReplyShortChannelIdsEnd obj_conv;
37149         obj_conv.inner = untag_ptr(obj);
37150         obj_conv.is_owned = ptr_is_owned(obj);
37151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37152         obj_conv.is_owned = false;
37153         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
37154         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37155         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37156         CVec_u8Z_free(ret_var);
37157         return ret_arr;
37158 }
37159
37160 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
37161         LDKu8slice ser_ref;
37162         ser_ref.datalen = ser->arr_len;
37163         ser_ref.data = ser->elems;
37164         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
37165         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
37166         FREE(ser);
37167         return tag_ptr(ret_conv, true);
37168 }
37169
37170 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
37171         LDKQueryChannelRange this_arg_conv;
37172         this_arg_conv.inner = untag_ptr(this_arg);
37173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37175         this_arg_conv.is_owned = false;
37176         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
37177         return ret_conv;
37178 }
37179
37180 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
37181         LDKQueryChannelRange obj_conv;
37182         obj_conv.inner = untag_ptr(obj);
37183         obj_conv.is_owned = ptr_is_owned(obj);
37184         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37185         obj_conv.is_owned = false;
37186         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
37187         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37188         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37189         CVec_u8Z_free(ret_var);
37190         return ret_arr;
37191 }
37192
37193 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
37194         LDKu8slice ser_ref;
37195         ser_ref.datalen = ser->arr_len;
37196         ser_ref.data = ser->elems;
37197         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
37198         *ret_conv = QueryChannelRange_read(ser_ref);
37199         FREE(ser);
37200         return tag_ptr(ret_conv, true);
37201 }
37202
37203 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
37204         LDKu8slice ser_ref;
37205         ser_ref.datalen = ser->arr_len;
37206         ser_ref.data = ser->elems;
37207         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
37208         *ret_conv = ReplyChannelRange_read(ser_ref);
37209         FREE(ser);
37210         return tag_ptr(ret_conv, true);
37211 }
37212
37213 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
37214         LDKReplyChannelRange obj_conv;
37215         obj_conv.inner = untag_ptr(obj);
37216         obj_conv.is_owned = ptr_is_owned(obj);
37217         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37218         obj_conv.is_owned = false;
37219         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
37220         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37221         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37222         CVec_u8Z_free(ret_var);
37223         return ret_arr;
37224 }
37225
37226 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
37227         LDKGossipTimestampFilter obj_conv;
37228         obj_conv.inner = untag_ptr(obj);
37229         obj_conv.is_owned = ptr_is_owned(obj);
37230         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37231         obj_conv.is_owned = false;
37232         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
37233         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37234         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37235         CVec_u8Z_free(ret_var);
37236         return ret_arr;
37237 }
37238
37239 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
37240         LDKu8slice ser_ref;
37241         ser_ref.datalen = ser->arr_len;
37242         ser_ref.data = ser->elems;
37243         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
37244         *ret_conv = GossipTimestampFilter_read(ser_ref);
37245         FREE(ser);
37246         return tag_ptr(ret_conv, true);
37247 }
37248
37249 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
37250         if (!ptr_is_owned(this_ptr)) return;
37251         void* this_ptr_ptr = untag_ptr(this_ptr);
37252         CHECK_ACCESS(this_ptr_ptr);
37253         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
37254         FREE(untag_ptr(this_ptr));
37255         CustomMessageHandler_free(this_ptr_conv);
37256 }
37257
37258 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
37259         LDKIgnoringMessageHandler this_obj_conv;
37260         this_obj_conv.inner = untag_ptr(this_obj);
37261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37263         IgnoringMessageHandler_free(this_obj_conv);
37264 }
37265
37266 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
37267         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
37268         uint64_t ret_ref = 0;
37269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37271         return ret_ref;
37272 }
37273
37274 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37275         LDKIgnoringMessageHandler this_arg_conv;
37276         this_arg_conv.inner = untag_ptr(this_arg);
37277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37279         this_arg_conv.is_owned = false;
37280         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37281         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37282         return tag_ptr(ret_ret, true);
37283 }
37284
37285 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
37286         LDKIgnoringMessageHandler this_arg_conv;
37287         this_arg_conv.inner = untag_ptr(this_arg);
37288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37290         this_arg_conv.is_owned = false;
37291         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37292         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
37293         return tag_ptr(ret_ret, true);
37294 }
37295
37296 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
37297         LDKIgnoringMessageHandler this_arg_conv;
37298         this_arg_conv.inner = untag_ptr(this_arg);
37299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37301         this_arg_conv.is_owned = false;
37302         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
37303         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
37304         return tag_ptr(ret_ret, true);
37305 }
37306
37307 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
37308         LDKIgnoringMessageHandler this_arg_conv;
37309         this_arg_conv.inner = untag_ptr(this_arg);
37310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37312         this_arg_conv.is_owned = false;
37313         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
37314         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
37315         return tag_ptr(ret_ret, true);
37316 }
37317
37318 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
37319         LDKIgnoringMessageHandler this_arg_conv;
37320         this_arg_conv.inner = untag_ptr(this_arg);
37321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37323         this_arg_conv.is_owned = false;
37324         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
37325         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
37326         return tag_ptr(ret_ret, true);
37327 }
37328
37329 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
37330         LDKIgnoringMessageHandler this_arg_conv;
37331         this_arg_conv.inner = untag_ptr(this_arg);
37332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37334         this_arg_conv.is_owned = false;
37335         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
37336         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
37337         return tag_ptr(ret_ret, true);
37338 }
37339
37340 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
37341         LDKIgnoringMessageHandler this_arg_conv;
37342         this_arg_conv.inner = untag_ptr(this_arg);
37343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37345         this_arg_conv.is_owned = false;
37346         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
37347         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
37348         return tag_ptr(ret_ret, true);
37349 }
37350
37351 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
37352         LDKErroringMessageHandler this_obj_conv;
37353         this_obj_conv.inner = untag_ptr(this_obj);
37354         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37356         ErroringMessageHandler_free(this_obj_conv);
37357 }
37358
37359 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
37360         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
37361         uint64_t ret_ref = 0;
37362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37364         return ret_ref;
37365 }
37366
37367 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37368         LDKErroringMessageHandler this_arg_conv;
37369         this_arg_conv.inner = untag_ptr(this_arg);
37370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37372         this_arg_conv.is_owned = false;
37373         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37374         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37375         return tag_ptr(ret_ret, true);
37376 }
37377
37378 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
37379         LDKErroringMessageHandler this_arg_conv;
37380         this_arg_conv.inner = untag_ptr(this_arg);
37381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37383         this_arg_conv.is_owned = false;
37384         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
37385         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
37386         return tag_ptr(ret_ret, true);
37387 }
37388
37389 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
37390         LDKMessageHandler this_obj_conv;
37391         this_obj_conv.inner = untag_ptr(this_obj);
37392         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37394         MessageHandler_free(this_obj_conv);
37395 }
37396
37397 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
37398         LDKMessageHandler this_ptr_conv;
37399         this_ptr_conv.inner = untag_ptr(this_ptr);
37400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37402         this_ptr_conv.is_owned = false;
37403         // WARNING: This object doesn't live past this scope, needs clone!
37404         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
37405         return ret_ret;
37406 }
37407
37408 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
37409         LDKMessageHandler this_ptr_conv;
37410         this_ptr_conv.inner = untag_ptr(this_ptr);
37411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37413         this_ptr_conv.is_owned = false;
37414         void* val_ptr = untag_ptr(val);
37415         CHECK_ACCESS(val_ptr);
37416         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
37417         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
37418                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37419                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
37420         }
37421         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
37422 }
37423
37424 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
37425         LDKMessageHandler this_ptr_conv;
37426         this_ptr_conv.inner = untag_ptr(this_ptr);
37427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37429         this_ptr_conv.is_owned = false;
37430         // WARNING: This object doesn't live past this scope, needs clone!
37431         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
37432         return ret_ret;
37433 }
37434
37435 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
37436         LDKMessageHandler this_ptr_conv;
37437         this_ptr_conv.inner = untag_ptr(this_ptr);
37438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37440         this_ptr_conv.is_owned = false;
37441         void* val_ptr = untag_ptr(val);
37442         CHECK_ACCESS(val_ptr);
37443         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
37444         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37445                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37446                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
37447         }
37448         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
37449 }
37450
37451 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
37452         LDKMessageHandler this_ptr_conv;
37453         this_ptr_conv.inner = untag_ptr(this_ptr);
37454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37456         this_ptr_conv.is_owned = false;
37457         // WARNING: This object doesn't live past this scope, needs clone!
37458         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
37459         return ret_ret;
37460 }
37461
37462 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
37463         LDKMessageHandler this_ptr_conv;
37464         this_ptr_conv.inner = untag_ptr(this_ptr);
37465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37467         this_ptr_conv.is_owned = false;
37468         void* val_ptr = untag_ptr(val);
37469         CHECK_ACCESS(val_ptr);
37470         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
37471         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
37472                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37473                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
37474         }
37475         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
37476 }
37477
37478 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) {
37479         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
37480         CHECK_ACCESS(chan_handler_arg_ptr);
37481         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
37482         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
37483                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37484                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
37485         }
37486         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
37487         CHECK_ACCESS(route_handler_arg_ptr);
37488         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
37489         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37490                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37491                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37492         }
37493         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
37494         CHECK_ACCESS(onion_message_handler_arg_ptr);
37495         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
37496         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
37497                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37498                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
37499         }
37500         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
37501         uint64_t ret_ref = 0;
37502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37504         return ret_ref;
37505 }
37506
37507 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37508         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37509         *ret_ret = SocketDescriptor_clone(arg);
37510         return tag_ptr(ret_ret, true);
37511 }
37512 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
37513         void* arg_ptr = untag_ptr(arg);
37514         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37515         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37516         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37517         return ret_conv;
37518 }
37519
37520 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
37521         void* orig_ptr = untag_ptr(orig);
37522         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37523         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37524         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37525         *ret_ret = SocketDescriptor_clone(orig_conv);
37526         return tag_ptr(ret_ret, true);
37527 }
37528
37529 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
37530         if (!ptr_is_owned(this_ptr)) return;
37531         void* this_ptr_ptr = untag_ptr(this_ptr);
37532         CHECK_ACCESS(this_ptr_ptr);
37533         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37534         FREE(untag_ptr(this_ptr));
37535         SocketDescriptor_free(this_ptr_conv);
37536 }
37537
37538 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
37539         LDKPeerHandleError this_obj_conv;
37540         this_obj_conv.inner = untag_ptr(this_obj);
37541         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37543         PeerHandleError_free(this_obj_conv);
37544 }
37545
37546 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
37547         LDKPeerHandleError ret_var = PeerHandleError_new();
37548         uint64_t ret_ref = 0;
37549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37551         return ret_ref;
37552 }
37553
37554 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37555         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37556         uint64_t ret_ref = 0;
37557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37559         return ret_ref;
37560 }
37561 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
37562         LDKPeerHandleError arg_conv;
37563         arg_conv.inner = untag_ptr(arg);
37564         arg_conv.is_owned = ptr_is_owned(arg);
37565         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37566         arg_conv.is_owned = false;
37567         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37568         return ret_conv;
37569 }
37570
37571 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
37572         LDKPeerHandleError orig_conv;
37573         orig_conv.inner = untag_ptr(orig);
37574         orig_conv.is_owned = ptr_is_owned(orig);
37575         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37576         orig_conv.is_owned = false;
37577         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37578         uint64_t ret_ref = 0;
37579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37581         return ret_ref;
37582 }
37583
37584 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
37585         LDKPeerManager this_obj_conv;
37586         this_obj_conv.inner = untag_ptr(this_obj);
37587         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37589         PeerManager_free(this_obj_conv);
37590 }
37591
37592 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) {
37593         LDKMessageHandler message_handler_conv;
37594         message_handler_conv.inner = untag_ptr(message_handler);
37595         message_handler_conv.is_owned = ptr_is_owned(message_handler);
37596         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37597         // WARNING: we need a move here but no clone is available for LDKMessageHandler
37598         
37599         uint8_t ephemeral_random_data_arr[32];
37600         CHECK(ephemeral_random_data->arr_len == 32);
37601         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
37602         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37603         void* logger_ptr = untag_ptr(logger);
37604         CHECK_ACCESS(logger_ptr);
37605         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37606         if (logger_conv.free == LDKLogger_JCalls_free) {
37607                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37608                 LDKLogger_JCalls_cloned(&logger_conv);
37609         }
37610         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
37611         CHECK_ACCESS(custom_message_handler_ptr);
37612         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37613         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37614                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37615                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37616         }
37617         void* node_signer_ptr = untag_ptr(node_signer);
37618         CHECK_ACCESS(node_signer_ptr);
37619         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
37620         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
37621                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37622                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
37623         }
37624         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_conv);
37625         uint64_t ret_ref = 0;
37626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37628         return ret_ref;
37629 }
37630
37631 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
37632         LDKPeerManager this_arg_conv;
37633         this_arg_conv.inner = untag_ptr(this_arg);
37634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37636         this_arg_conv.is_owned = false;
37637         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37638         uint64_tArray ret_arr = NULL;
37639         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
37640         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
37641         for (size_t o = 0; o < ret_var.datalen; o++) {
37642                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
37643                 *ret_conv_40_conv = ret_var.data[o];
37644                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
37645         }
37646         
37647         FREE(ret_var.data);
37648         return ret_arr;
37649 }
37650
37651 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) {
37652         LDKPeerManager this_arg_conv;
37653         this_arg_conv.inner = untag_ptr(this_arg);
37654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37656         this_arg_conv.is_owned = false;
37657         LDKPublicKey their_node_id_ref;
37658         CHECK(their_node_id->arr_len == 33);
37659         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
37660         void* descriptor_ptr = untag_ptr(descriptor);
37661         CHECK_ACCESS(descriptor_ptr);
37662         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37663         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37664                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37665                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37666         }
37667         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37668         CHECK_ACCESS(remote_network_address_ptr);
37669         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37670         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37671         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37672         return tag_ptr(ret_conv, true);
37673 }
37674
37675 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) {
37676         LDKPeerManager this_arg_conv;
37677         this_arg_conv.inner = untag_ptr(this_arg);
37678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37680         this_arg_conv.is_owned = false;
37681         void* descriptor_ptr = untag_ptr(descriptor);
37682         CHECK_ACCESS(descriptor_ptr);
37683         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37684         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37685                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37686                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37687         }
37688         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37689         CHECK_ACCESS(remote_network_address_ptr);
37690         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37691         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37692         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37693         return tag_ptr(ret_conv, true);
37694 }
37695
37696 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
37697         LDKPeerManager this_arg_conv;
37698         this_arg_conv.inner = untag_ptr(this_arg);
37699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37701         this_arg_conv.is_owned = false;
37702         void* descriptor_ptr = untag_ptr(descriptor);
37703         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37704         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37705         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37706         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37707         return tag_ptr(ret_conv, true);
37708 }
37709
37710 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
37711         LDKPeerManager this_arg_conv;
37712         this_arg_conv.inner = untag_ptr(this_arg);
37713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37715         this_arg_conv.is_owned = false;
37716         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
37717         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
37718         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37719         LDKu8slice data_ref;
37720         data_ref.datalen = data->arr_len;
37721         data_ref.data = data->elems;
37722         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37723         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37724         FREE(data);
37725         return tag_ptr(ret_conv, true);
37726 }
37727
37728 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
37729         LDKPeerManager this_arg_conv;
37730         this_arg_conv.inner = untag_ptr(this_arg);
37731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37733         this_arg_conv.is_owned = false;
37734         PeerManager_process_events(&this_arg_conv);
37735 }
37736
37737 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
37738         LDKPeerManager this_arg_conv;
37739         this_arg_conv.inner = untag_ptr(this_arg);
37740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37742         this_arg_conv.is_owned = false;
37743         void* descriptor_ptr = untag_ptr(descriptor);
37744         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37745         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37746         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37747 }
37748
37749 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
37750         LDKPeerManager this_arg_conv;
37751         this_arg_conv.inner = untag_ptr(this_arg);
37752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37754         this_arg_conv.is_owned = false;
37755         LDKPublicKey node_id_ref;
37756         CHECK(node_id->arr_len == 33);
37757         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
37758         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
37759 }
37760
37761 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
37762         LDKPeerManager this_arg_conv;
37763         this_arg_conv.inner = untag_ptr(this_arg);
37764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37766         this_arg_conv.is_owned = false;
37767         PeerManager_disconnect_all_peers(&this_arg_conv);
37768 }
37769
37770 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
37771         LDKPeerManager this_arg_conv;
37772         this_arg_conv.inner = untag_ptr(this_arg);
37773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37775         this_arg_conv.is_owned = false;
37776         PeerManager_timer_tick_occurred(&this_arg_conv);
37777 }
37778
37779 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) {
37780         LDKPeerManager this_arg_conv;
37781         this_arg_conv.inner = untag_ptr(this_arg);
37782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37784         this_arg_conv.is_owned = false;
37785         LDKThreeBytes rgb_ref;
37786         CHECK(rgb->arr_len == 3);
37787         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
37788         LDKThirtyTwoBytes alias_ref;
37789         CHECK(alias->arr_len == 32);
37790         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
37791         LDKCVec_NetAddressZ addresses_constr;
37792         addresses_constr.datalen = addresses->arr_len;
37793         if (addresses_constr.datalen > 0)
37794                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
37795         else
37796                 addresses_constr.data = NULL;
37797         uint64_t* addresses_vals = addresses->elems;
37798         for (size_t m = 0; m < addresses_constr.datalen; m++) {
37799                 uint64_t addresses_conv_12 = addresses_vals[m];
37800                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
37801                 CHECK_ACCESS(addresses_conv_12_ptr);
37802                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
37803                 addresses_constr.data[m] = addresses_conv_12_conv;
37804         }
37805         FREE(addresses);
37806         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
37807 }
37808
37809 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
37810         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37811         return ret_conv;
37812 }
37813
37814 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
37815         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37816         return ret_conv;
37817 }
37818
37819 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
37820         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
37821         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
37822         return ret_conv;
37823 }
37824
37825 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
37826         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
37827         return ret_conv;
37828 }
37829
37830 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
37831         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
37832         return ret_conv;
37833 }
37834
37835 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
37836         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
37837         return ret_conv;
37838 }
37839
37840 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
37841         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
37842         return ret_conv;
37843 }
37844
37845 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
37846         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
37847         return ret_conv;
37848 }
37849
37850 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
37851         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
37852         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
37853         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
37854         return ret_conv;
37855 }
37856
37857 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
37858         LDKWitness witness_ref;
37859         witness_ref.datalen = witness->arr_len;
37860         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
37861         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
37862         witness_ref.data_is_owned = true;
37863         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37864         *ret_copy = HTLCClaim_from_witness(witness_ref);
37865         uint64_t ret_ref = tag_ptr(ret_copy, true);
37866         return ret_ref;
37867 }
37868
37869 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
37870         uint8_t commitment_seed_arr[32];
37871         CHECK(commitment_seed->arr_len == 32);
37872         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
37873         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
37874         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37875         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
37876         return ret_arr;
37877 }
37878
37879 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) {
37880         LDKCVec_u8Z to_holder_script_ref;
37881         to_holder_script_ref.datalen = to_holder_script->arr_len;
37882         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37883         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37884         LDKCVec_u8Z to_counterparty_script_ref;
37885         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37886         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37887         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37888         LDKOutPoint funding_outpoint_conv;
37889         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37890         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37891         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37892         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37893         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);
37894         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37895         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37896         Transaction_free(ret_var);
37897         return ret_arr;
37898 }
37899
37900 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
37901         LDKCounterpartyCommitmentSecrets this_obj_conv;
37902         this_obj_conv.inner = untag_ptr(this_obj);
37903         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37905         CounterpartyCommitmentSecrets_free(this_obj_conv);
37906 }
37907
37908 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37909         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37910         uint64_t ret_ref = 0;
37911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37913         return ret_ref;
37914 }
37915 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
37916         LDKCounterpartyCommitmentSecrets arg_conv;
37917         arg_conv.inner = untag_ptr(arg);
37918         arg_conv.is_owned = ptr_is_owned(arg);
37919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37920         arg_conv.is_owned = false;
37921         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37922         return ret_conv;
37923 }
37924
37925 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
37926         LDKCounterpartyCommitmentSecrets orig_conv;
37927         orig_conv.inner = untag_ptr(orig);
37928         orig_conv.is_owned = ptr_is_owned(orig);
37929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37930         orig_conv.is_owned = false;
37931         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37932         uint64_t ret_ref = 0;
37933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37935         return ret_ref;
37936 }
37937
37938 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
37939         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37940         uint64_t ret_ref = 0;
37941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37943         return ret_ref;
37944 }
37945
37946 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
37947         LDKCounterpartyCommitmentSecrets this_arg_conv;
37948         this_arg_conv.inner = untag_ptr(this_arg);
37949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37951         this_arg_conv.is_owned = false;
37952         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37953         return ret_conv;
37954 }
37955
37956 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
37957         LDKCounterpartyCommitmentSecrets this_arg_conv;
37958         this_arg_conv.inner = untag_ptr(this_arg);
37959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37961         this_arg_conv.is_owned = false;
37962         LDKThirtyTwoBytes secret_ref;
37963         CHECK(secret->arr_len == 32);
37964         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
37965         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37966         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37967         return tag_ptr(ret_conv, true);
37968 }
37969
37970 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
37971         LDKCounterpartyCommitmentSecrets this_arg_conv;
37972         this_arg_conv.inner = untag_ptr(this_arg);
37973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37975         this_arg_conv.is_owned = false;
37976         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37977         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
37978         return ret_arr;
37979 }
37980
37981 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
37982         LDKCounterpartyCommitmentSecrets obj_conv;
37983         obj_conv.inner = untag_ptr(obj);
37984         obj_conv.is_owned = ptr_is_owned(obj);
37985         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37986         obj_conv.is_owned = false;
37987         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37988         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37989         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37990         CVec_u8Z_free(ret_var);
37991         return ret_arr;
37992 }
37993
37994 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
37995         LDKu8slice ser_ref;
37996         ser_ref.datalen = ser->arr_len;
37997         ser_ref.data = ser->elems;
37998         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37999         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
38000         FREE(ser);
38001         return tag_ptr(ret_conv, true);
38002 }
38003
38004 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
38005         LDKPublicKey per_commitment_point_ref;
38006         CHECK(per_commitment_point->arr_len == 33);
38007         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38008         uint8_t base_secret_arr[32];
38009         CHECK(base_secret->arr_len == 32);
38010         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
38011         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
38012         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38013         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
38014         return ret_arr;
38015 }
38016
38017 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
38018         LDKPublicKey per_commitment_point_ref;
38019         CHECK(per_commitment_point->arr_len == 33);
38020         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38021         LDKPublicKey base_point_ref;
38022         CHECK(base_point->arr_len == 33);
38023         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
38024         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38025         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
38026         return ret_arr;
38027 }
38028
38029 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) {
38030         uint8_t per_commitment_secret_arr[32];
38031         CHECK(per_commitment_secret->arr_len == 32);
38032         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
38033         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
38034         uint8_t countersignatory_revocation_base_secret_arr[32];
38035         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
38036         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
38037         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
38038         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38039         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
38040         return ret_arr;
38041 }
38042
38043 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) {
38044         LDKPublicKey per_commitment_point_ref;
38045         CHECK(per_commitment_point->arr_len == 33);
38046         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38047         LDKPublicKey countersignatory_revocation_base_point_ref;
38048         CHECK(countersignatory_revocation_base_point->arr_len == 33);
38049         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
38050         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38051         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
38052         return ret_arr;
38053 }
38054
38055 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
38056         LDKTxCreationKeys this_obj_conv;
38057         this_obj_conv.inner = untag_ptr(this_obj);
38058         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38060         TxCreationKeys_free(this_obj_conv);
38061 }
38062
38063 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
38064         LDKTxCreationKeys this_ptr_conv;
38065         this_ptr_conv.inner = untag_ptr(this_ptr);
38066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38068         this_ptr_conv.is_owned = false;
38069         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38070         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38071         return ret_arr;
38072 }
38073
38074 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
38075         LDKTxCreationKeys this_ptr_conv;
38076         this_ptr_conv.inner = untag_ptr(this_ptr);
38077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38079         this_ptr_conv.is_owned = false;
38080         LDKPublicKey val_ref;
38081         CHECK(val->arr_len == 33);
38082         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38083         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
38084 }
38085
38086 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
38087         LDKTxCreationKeys this_ptr_conv;
38088         this_ptr_conv.inner = untag_ptr(this_ptr);
38089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38091         this_ptr_conv.is_owned = false;
38092         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38093         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
38094         return ret_arr;
38095 }
38096
38097 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
38098         LDKTxCreationKeys this_ptr_conv;
38099         this_ptr_conv.inner = untag_ptr(this_ptr);
38100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38102         this_ptr_conv.is_owned = false;
38103         LDKPublicKey val_ref;
38104         CHECK(val->arr_len == 33);
38105         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38106         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
38107 }
38108
38109 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
38110         LDKTxCreationKeys this_ptr_conv;
38111         this_ptr_conv.inner = untag_ptr(this_ptr);
38112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38114         this_ptr_conv.is_owned = false;
38115         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38116         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
38117         return ret_arr;
38118 }
38119
38120 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
38121         LDKTxCreationKeys this_ptr_conv;
38122         this_ptr_conv.inner = untag_ptr(this_ptr);
38123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38125         this_ptr_conv.is_owned = false;
38126         LDKPublicKey val_ref;
38127         CHECK(val->arr_len == 33);
38128         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38129         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
38130 }
38131
38132 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
38133         LDKTxCreationKeys this_ptr_conv;
38134         this_ptr_conv.inner = untag_ptr(this_ptr);
38135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38137         this_ptr_conv.is_owned = false;
38138         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38139         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
38140         return ret_arr;
38141 }
38142
38143 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
38144         LDKTxCreationKeys this_ptr_conv;
38145         this_ptr_conv.inner = untag_ptr(this_ptr);
38146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38148         this_ptr_conv.is_owned = false;
38149         LDKPublicKey val_ref;
38150         CHECK(val->arr_len == 33);
38151         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38152         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
38153 }
38154
38155 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
38156         LDKTxCreationKeys this_ptr_conv;
38157         this_ptr_conv.inner = untag_ptr(this_ptr);
38158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38160         this_ptr_conv.is_owned = false;
38161         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38162         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
38163         return ret_arr;
38164 }
38165
38166 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) {
38167         LDKTxCreationKeys this_ptr_conv;
38168         this_ptr_conv.inner = untag_ptr(this_ptr);
38169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38171         this_ptr_conv.is_owned = false;
38172         LDKPublicKey val_ref;
38173         CHECK(val->arr_len == 33);
38174         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38175         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
38176 }
38177
38178 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) {
38179         LDKPublicKey per_commitment_point_arg_ref;
38180         CHECK(per_commitment_point_arg->arr_len == 33);
38181         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
38182         LDKPublicKey revocation_key_arg_ref;
38183         CHECK(revocation_key_arg->arr_len == 33);
38184         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
38185         LDKPublicKey broadcaster_htlc_key_arg_ref;
38186         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
38187         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
38188         LDKPublicKey countersignatory_htlc_key_arg_ref;
38189         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
38190         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
38191         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
38192         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
38193         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
38194         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);
38195         uint64_t ret_ref = 0;
38196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38198         return ret_ref;
38199 }
38200
38201 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
38202         LDKTxCreationKeys a_conv;
38203         a_conv.inner = untag_ptr(a);
38204         a_conv.is_owned = ptr_is_owned(a);
38205         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38206         a_conv.is_owned = false;
38207         LDKTxCreationKeys b_conv;
38208         b_conv.inner = untag_ptr(b);
38209         b_conv.is_owned = ptr_is_owned(b);
38210         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38211         b_conv.is_owned = false;
38212         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
38213         return ret_conv;
38214 }
38215
38216 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
38217         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
38218         uint64_t ret_ref = 0;
38219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38221         return ret_ref;
38222 }
38223 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
38224         LDKTxCreationKeys arg_conv;
38225         arg_conv.inner = untag_ptr(arg);
38226         arg_conv.is_owned = ptr_is_owned(arg);
38227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38228         arg_conv.is_owned = false;
38229         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
38230         return ret_conv;
38231 }
38232
38233 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
38234         LDKTxCreationKeys orig_conv;
38235         orig_conv.inner = untag_ptr(orig);
38236         orig_conv.is_owned = ptr_is_owned(orig);
38237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38238         orig_conv.is_owned = false;
38239         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
38240         uint64_t ret_ref = 0;
38241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38243         return ret_ref;
38244 }
38245
38246 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
38247         LDKTxCreationKeys obj_conv;
38248         obj_conv.inner = untag_ptr(obj);
38249         obj_conv.is_owned = ptr_is_owned(obj);
38250         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38251         obj_conv.is_owned = false;
38252         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
38253         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38254         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38255         CVec_u8Z_free(ret_var);
38256         return ret_arr;
38257 }
38258
38259 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
38260         LDKu8slice ser_ref;
38261         ser_ref.datalen = ser->arr_len;
38262         ser_ref.data = ser->elems;
38263         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
38264         *ret_conv = TxCreationKeys_read(ser_ref);
38265         FREE(ser);
38266         return tag_ptr(ret_conv, true);
38267 }
38268
38269 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
38270         LDKChannelPublicKeys this_obj_conv;
38271         this_obj_conv.inner = untag_ptr(this_obj);
38272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38274         ChannelPublicKeys_free(this_obj_conv);
38275 }
38276
38277 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
38278         LDKChannelPublicKeys this_ptr_conv;
38279         this_ptr_conv.inner = untag_ptr(this_ptr);
38280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38282         this_ptr_conv.is_owned = false;
38283         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38284         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38285         return ret_arr;
38286 }
38287
38288 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38289         LDKChannelPublicKeys this_ptr_conv;
38290         this_ptr_conv.inner = untag_ptr(this_ptr);
38291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38293         this_ptr_conv.is_owned = false;
38294         LDKPublicKey val_ref;
38295         CHECK(val->arr_len == 33);
38296         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38297         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
38298 }
38299
38300 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
38301         LDKChannelPublicKeys this_ptr_conv;
38302         this_ptr_conv.inner = untag_ptr(this_ptr);
38303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38305         this_ptr_conv.is_owned = false;
38306         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38307         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38308         return ret_arr;
38309 }
38310
38311 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38312         LDKChannelPublicKeys this_ptr_conv;
38313         this_ptr_conv.inner = untag_ptr(this_ptr);
38314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38316         this_ptr_conv.is_owned = false;
38317         LDKPublicKey val_ref;
38318         CHECK(val->arr_len == 33);
38319         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38320         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
38321 }
38322
38323 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
38324         LDKChannelPublicKeys this_ptr_conv;
38325         this_ptr_conv.inner = untag_ptr(this_ptr);
38326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38328         this_ptr_conv.is_owned = false;
38329         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38330         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
38331         return ret_arr;
38332 }
38333
38334 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38335         LDKChannelPublicKeys this_ptr_conv;
38336         this_ptr_conv.inner = untag_ptr(this_ptr);
38337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38339         this_ptr_conv.is_owned = false;
38340         LDKPublicKey val_ref;
38341         CHECK(val->arr_len == 33);
38342         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38343         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
38344 }
38345
38346 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
38347         LDKChannelPublicKeys this_ptr_conv;
38348         this_ptr_conv.inner = untag_ptr(this_ptr);
38349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38351         this_ptr_conv.is_owned = false;
38352         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38353         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38354         return ret_arr;
38355 }
38356
38357 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38358         LDKChannelPublicKeys this_ptr_conv;
38359         this_ptr_conv.inner = untag_ptr(this_ptr);
38360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38362         this_ptr_conv.is_owned = false;
38363         LDKPublicKey val_ref;
38364         CHECK(val->arr_len == 33);
38365         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38366         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38367 }
38368
38369 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
38370         LDKChannelPublicKeys this_ptr_conv;
38371         this_ptr_conv.inner = untag_ptr(this_ptr);
38372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38374         this_ptr_conv.is_owned = false;
38375         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38376         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38377         return ret_arr;
38378 }
38379
38380 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38381         LDKChannelPublicKeys this_ptr_conv;
38382         this_ptr_conv.inner = untag_ptr(this_ptr);
38383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38385         this_ptr_conv.is_owned = false;
38386         LDKPublicKey val_ref;
38387         CHECK(val->arr_len == 33);
38388         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38389         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
38390 }
38391
38392 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) {
38393         LDKPublicKey funding_pubkey_arg_ref;
38394         CHECK(funding_pubkey_arg->arr_len == 33);
38395         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38396         LDKPublicKey revocation_basepoint_arg_ref;
38397         CHECK(revocation_basepoint_arg->arr_len == 33);
38398         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38399         LDKPublicKey payment_point_arg_ref;
38400         CHECK(payment_point_arg->arr_len == 33);
38401         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38402         LDKPublicKey delayed_payment_basepoint_arg_ref;
38403         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38404         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38405         LDKPublicKey htlc_basepoint_arg_ref;
38406         CHECK(htlc_basepoint_arg->arr_len == 33);
38407         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38408         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);
38409         uint64_t ret_ref = 0;
38410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38412         return ret_ref;
38413 }
38414
38415 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
38416         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
38417         uint64_t ret_ref = 0;
38418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38420         return ret_ref;
38421 }
38422 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
38423         LDKChannelPublicKeys arg_conv;
38424         arg_conv.inner = untag_ptr(arg);
38425         arg_conv.is_owned = ptr_is_owned(arg);
38426         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38427         arg_conv.is_owned = false;
38428         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
38429         return ret_conv;
38430 }
38431
38432 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
38433         LDKChannelPublicKeys orig_conv;
38434         orig_conv.inner = untag_ptr(orig);
38435         orig_conv.is_owned = ptr_is_owned(orig);
38436         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38437         orig_conv.is_owned = false;
38438         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
38439         uint64_t ret_ref = 0;
38440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38442         return ret_ref;
38443 }
38444
38445 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
38446         LDKChannelPublicKeys a_conv;
38447         a_conv.inner = untag_ptr(a);
38448         a_conv.is_owned = ptr_is_owned(a);
38449         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38450         a_conv.is_owned = false;
38451         LDKChannelPublicKeys b_conv;
38452         b_conv.inner = untag_ptr(b);
38453         b_conv.is_owned = ptr_is_owned(b);
38454         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38455         b_conv.is_owned = false;
38456         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
38457         return ret_conv;
38458 }
38459
38460 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
38461         LDKChannelPublicKeys obj_conv;
38462         obj_conv.inner = untag_ptr(obj);
38463         obj_conv.is_owned = ptr_is_owned(obj);
38464         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38465         obj_conv.is_owned = false;
38466         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
38467         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38468         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38469         CVec_u8Z_free(ret_var);
38470         return ret_arr;
38471 }
38472
38473 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
38474         LDKu8slice ser_ref;
38475         ser_ref.datalen = ser->arr_len;
38476         ser_ref.data = ser->elems;
38477         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
38478         *ret_conv = ChannelPublicKeys_read(ser_ref);
38479         FREE(ser);
38480         return tag_ptr(ret_conv, true);
38481 }
38482
38483 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) {
38484         LDKPublicKey per_commitment_point_ref;
38485         CHECK(per_commitment_point->arr_len == 33);
38486         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38487         LDKPublicKey broadcaster_delayed_payment_base_ref;
38488         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
38489         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
38490         LDKPublicKey broadcaster_htlc_base_ref;
38491         CHECK(broadcaster_htlc_base->arr_len == 33);
38492         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
38493         LDKPublicKey countersignatory_revocation_base_ref;
38494         CHECK(countersignatory_revocation_base->arr_len == 33);
38495         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
38496         LDKPublicKey countersignatory_htlc_base_ref;
38497         CHECK(countersignatory_htlc_base->arr_len == 33);
38498         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
38499         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);
38500         uint64_t ret_ref = 0;
38501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38503         return ret_ref;
38504 }
38505
38506 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) {
38507         LDKPublicKey per_commitment_point_ref;
38508         CHECK(per_commitment_point->arr_len == 33);
38509         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38510         LDKChannelPublicKeys broadcaster_keys_conv;
38511         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
38512         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
38513         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38514         broadcaster_keys_conv.is_owned = false;
38515         LDKChannelPublicKeys countersignatory_keys_conv;
38516         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
38517         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
38518         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38519         countersignatory_keys_conv.is_owned = false;
38520         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
38521         uint64_t ret_ref = 0;
38522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38524         return ret_ref;
38525 }
38526
38527 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) {
38528         LDKPublicKey revocation_key_ref;
38529         CHECK(revocation_key->arr_len == 33);
38530         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38531         LDKPublicKey broadcaster_delayed_payment_key_ref;
38532         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38533         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38534         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
38535         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38536         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38537         CVec_u8Z_free(ret_var);
38538         return ret_arr;
38539 }
38540
38541 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
38542         LDKHTLCOutputInCommitment this_obj_conv;
38543         this_obj_conv.inner = untag_ptr(this_obj);
38544         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38546         HTLCOutputInCommitment_free(this_obj_conv);
38547 }
38548
38549 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
38550         LDKHTLCOutputInCommitment this_ptr_conv;
38551         this_ptr_conv.inner = untag_ptr(this_ptr);
38552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38554         this_ptr_conv.is_owned = false;
38555         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
38556         return ret_conv;
38557 }
38558
38559 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
38560         LDKHTLCOutputInCommitment this_ptr_conv;
38561         this_ptr_conv.inner = untag_ptr(this_ptr);
38562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38564         this_ptr_conv.is_owned = false;
38565         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
38566 }
38567
38568 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
38569         LDKHTLCOutputInCommitment this_ptr_conv;
38570         this_ptr_conv.inner = untag_ptr(this_ptr);
38571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38573         this_ptr_conv.is_owned = false;
38574         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
38575         return ret_conv;
38576 }
38577
38578 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
38579         LDKHTLCOutputInCommitment this_ptr_conv;
38580         this_ptr_conv.inner = untag_ptr(this_ptr);
38581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38583         this_ptr_conv.is_owned = false;
38584         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
38585 }
38586
38587 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
38588         LDKHTLCOutputInCommitment this_ptr_conv;
38589         this_ptr_conv.inner = untag_ptr(this_ptr);
38590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38592         this_ptr_conv.is_owned = false;
38593         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
38594         return ret_conv;
38595 }
38596
38597 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
38598         LDKHTLCOutputInCommitment this_ptr_conv;
38599         this_ptr_conv.inner = untag_ptr(this_ptr);
38600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38602         this_ptr_conv.is_owned = false;
38603         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38604 }
38605
38606 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
38607         LDKHTLCOutputInCommitment this_ptr_conv;
38608         this_ptr_conv.inner = untag_ptr(this_ptr);
38609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38611         this_ptr_conv.is_owned = false;
38612         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38613         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
38614         return ret_arr;
38615 }
38616
38617 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
38618         LDKHTLCOutputInCommitment this_ptr_conv;
38619         this_ptr_conv.inner = untag_ptr(this_ptr);
38620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38622         this_ptr_conv.is_owned = false;
38623         LDKThirtyTwoBytes val_ref;
38624         CHECK(val->arr_len == 32);
38625         memcpy(val_ref.data, val->elems, 32); FREE(val);
38626         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38627 }
38628
38629 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
38630         LDKHTLCOutputInCommitment this_ptr_conv;
38631         this_ptr_conv.inner = untag_ptr(this_ptr);
38632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38634         this_ptr_conv.is_owned = false;
38635         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38636         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38637         uint64_t ret_ref = tag_ptr(ret_copy, true);
38638         return ret_ref;
38639 }
38640
38641 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
38642         LDKHTLCOutputInCommitment this_ptr_conv;
38643         this_ptr_conv.inner = untag_ptr(this_ptr);
38644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38646         this_ptr_conv.is_owned = false;
38647         void* val_ptr = untag_ptr(val);
38648         CHECK_ACCESS(val_ptr);
38649         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38650         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38651         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38652 }
38653
38654 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) {
38655         LDKThirtyTwoBytes payment_hash_arg_ref;
38656         CHECK(payment_hash_arg->arr_len == 32);
38657         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
38658         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
38659         CHECK_ACCESS(transaction_output_index_arg_ptr);
38660         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38661         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
38662         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38663         uint64_t ret_ref = 0;
38664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38666         return ret_ref;
38667 }
38668
38669 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38670         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38671         uint64_t ret_ref = 0;
38672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38674         return ret_ref;
38675 }
38676 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
38677         LDKHTLCOutputInCommitment arg_conv;
38678         arg_conv.inner = untag_ptr(arg);
38679         arg_conv.is_owned = ptr_is_owned(arg);
38680         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38681         arg_conv.is_owned = false;
38682         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38683         return ret_conv;
38684 }
38685
38686 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
38687         LDKHTLCOutputInCommitment orig_conv;
38688         orig_conv.inner = untag_ptr(orig);
38689         orig_conv.is_owned = ptr_is_owned(orig);
38690         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38691         orig_conv.is_owned = false;
38692         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38693         uint64_t ret_ref = 0;
38694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38696         return ret_ref;
38697 }
38698
38699 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
38700         LDKHTLCOutputInCommitment a_conv;
38701         a_conv.inner = untag_ptr(a);
38702         a_conv.is_owned = ptr_is_owned(a);
38703         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38704         a_conv.is_owned = false;
38705         LDKHTLCOutputInCommitment b_conv;
38706         b_conv.inner = untag_ptr(b);
38707         b_conv.is_owned = ptr_is_owned(b);
38708         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38709         b_conv.is_owned = false;
38710         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
38711         return ret_conv;
38712 }
38713
38714 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
38715         LDKHTLCOutputInCommitment obj_conv;
38716         obj_conv.inner = untag_ptr(obj);
38717         obj_conv.is_owned = ptr_is_owned(obj);
38718         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38719         obj_conv.is_owned = false;
38720         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38721         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38722         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38723         CVec_u8Z_free(ret_var);
38724         return ret_arr;
38725 }
38726
38727 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
38728         LDKu8slice ser_ref;
38729         ser_ref.datalen = ser->arr_len;
38730         ser_ref.data = ser->elems;
38731         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38732         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38733         FREE(ser);
38734         return tag_ptr(ret_conv, true);
38735 }
38736
38737 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
38738         LDKHTLCOutputInCommitment htlc_conv;
38739         htlc_conv.inner = untag_ptr(htlc);
38740         htlc_conv.is_owned = ptr_is_owned(htlc);
38741         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38742         htlc_conv.is_owned = false;
38743         LDKTxCreationKeys keys_conv;
38744         keys_conv.inner = untag_ptr(keys);
38745         keys_conv.is_owned = ptr_is_owned(keys);
38746         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38747         keys_conv.is_owned = false;
38748         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38749         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38750         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38751         CVec_u8Z_free(ret_var);
38752         return ret_arr;
38753 }
38754
38755 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
38756         LDKPublicKey broadcaster_ref;
38757         CHECK(broadcaster->arr_len == 33);
38758         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
38759         LDKPublicKey countersignatory_ref;
38760         CHECK(countersignatory->arr_len == 33);
38761         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
38762         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38763         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38764         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38765         CVec_u8Z_free(ret_var);
38766         return ret_arr;
38767 }
38768
38769 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) {
38770         uint8_t commitment_txid_arr[32];
38771         CHECK(commitment_txid->arr_len == 32);
38772         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
38773         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
38774         LDKHTLCOutputInCommitment htlc_conv;
38775         htlc_conv.inner = untag_ptr(htlc);
38776         htlc_conv.is_owned = ptr_is_owned(htlc);
38777         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38778         htlc_conv.is_owned = false;
38779         LDKPublicKey broadcaster_delayed_payment_key_ref;
38780         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38781         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38782         LDKPublicKey revocation_key_ref;
38783         CHECK(revocation_key->arr_len == 33);
38784         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38785         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);
38786         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38787         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38788         Transaction_free(ret_var);
38789         return ret_arr;
38790 }
38791
38792 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) {
38793         LDKSignature local_sig_ref;
38794         CHECK(local_sig->arr_len == 64);
38795         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
38796         LDKSignature remote_sig_ref;
38797         CHECK(remote_sig->arr_len == 64);
38798         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
38799         LDKThirtyTwoBytes preimage_ref;
38800         CHECK(preimage->arr_len == 32);
38801         memcpy(preimage_ref.data, preimage->elems, 32); FREE(preimage);
38802         LDKu8slice redeem_script_ref;
38803         redeem_script_ref.datalen = redeem_script->arr_len;
38804         redeem_script_ref.data = redeem_script->elems;
38805         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors);
38806         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38807         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38808         Witness_free(ret_var);
38809         FREE(redeem_script);
38810         return ret_arr;
38811 }
38812
38813 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
38814         LDKPublicKey payment_point_ref;
38815         CHECK(payment_point->arr_len == 33);
38816         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
38817         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
38818         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38819         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38820         CVec_u8Z_free(ret_var);
38821         return ret_arr;
38822 }
38823
38824 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
38825         LDKPublicKey funding_pubkey_ref;
38826         CHECK(funding_pubkey->arr_len == 33);
38827         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
38828         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38829         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38830         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38831         CVec_u8Z_free(ret_var);
38832         return ret_arr;
38833 }
38834
38835 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
38836         LDKPublicKey funding_key_ref;
38837         CHECK(funding_key->arr_len == 33);
38838         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
38839         LDKSignature funding_sig_ref;
38840         CHECK(funding_sig->arr_len == 64);
38841         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
38842         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
38843         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38844         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38845         Witness_free(ret_var);
38846         return ret_arr;
38847 }
38848
38849 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
38850         LDKChannelTransactionParameters this_obj_conv;
38851         this_obj_conv.inner = untag_ptr(this_obj);
38852         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38854         ChannelTransactionParameters_free(this_obj_conv);
38855 }
38856
38857 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
38858         LDKChannelTransactionParameters this_ptr_conv;
38859         this_ptr_conv.inner = untag_ptr(this_ptr);
38860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38862         this_ptr_conv.is_owned = false;
38863         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38864         uint64_t ret_ref = 0;
38865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38867         return ret_ref;
38868 }
38869
38870 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
38871         LDKChannelTransactionParameters this_ptr_conv;
38872         this_ptr_conv.inner = untag_ptr(this_ptr);
38873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38875         this_ptr_conv.is_owned = false;
38876         LDKChannelPublicKeys val_conv;
38877         val_conv.inner = untag_ptr(val);
38878         val_conv.is_owned = ptr_is_owned(val);
38879         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38880         val_conv = ChannelPublicKeys_clone(&val_conv);
38881         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38882 }
38883
38884 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
38885         LDKChannelTransactionParameters this_ptr_conv;
38886         this_ptr_conv.inner = untag_ptr(this_ptr);
38887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38889         this_ptr_conv.is_owned = false;
38890         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38891         return ret_conv;
38892 }
38893
38894 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) {
38895         LDKChannelTransactionParameters this_ptr_conv;
38896         this_ptr_conv.inner = untag_ptr(this_ptr);
38897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38899         this_ptr_conv.is_owned = false;
38900         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38901 }
38902
38903 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
38904         LDKChannelTransactionParameters this_ptr_conv;
38905         this_ptr_conv.inner = untag_ptr(this_ptr);
38906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38908         this_ptr_conv.is_owned = false;
38909         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38910         return ret_conv;
38911 }
38912
38913 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
38914         LDKChannelTransactionParameters this_ptr_conv;
38915         this_ptr_conv.inner = untag_ptr(this_ptr);
38916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38918         this_ptr_conv.is_owned = false;
38919         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38920 }
38921
38922 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
38923         LDKChannelTransactionParameters this_ptr_conv;
38924         this_ptr_conv.inner = untag_ptr(this_ptr);
38925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38927         this_ptr_conv.is_owned = false;
38928         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38929         uint64_t ret_ref = 0;
38930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38932         return ret_ref;
38933 }
38934
38935 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
38936         LDKChannelTransactionParameters this_ptr_conv;
38937         this_ptr_conv.inner = untag_ptr(this_ptr);
38938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38940         this_ptr_conv.is_owned = false;
38941         LDKCounterpartyChannelTransactionParameters val_conv;
38942         val_conv.inner = untag_ptr(val);
38943         val_conv.is_owned = ptr_is_owned(val);
38944         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38945         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38946         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38947 }
38948
38949 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
38950         LDKChannelTransactionParameters this_ptr_conv;
38951         this_ptr_conv.inner = untag_ptr(this_ptr);
38952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38954         this_ptr_conv.is_owned = false;
38955         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38956         uint64_t ret_ref = 0;
38957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38959         return ret_ref;
38960 }
38961
38962 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
38963         LDKChannelTransactionParameters this_ptr_conv;
38964         this_ptr_conv.inner = untag_ptr(this_ptr);
38965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38967         this_ptr_conv.is_owned = false;
38968         LDKOutPoint val_conv;
38969         val_conv.inner = untag_ptr(val);
38970         val_conv.is_owned = ptr_is_owned(val);
38971         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38972         val_conv = OutPoint_clone(&val_conv);
38973         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38974 }
38975
38976 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
38977         LDKChannelTransactionParameters this_ptr_conv;
38978         this_ptr_conv.inner = untag_ptr(this_ptr);
38979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38981         this_ptr_conv.is_owned = false;
38982         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38983         return ret_conv;
38984 }
38985
38986 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
38987         LDKChannelTransactionParameters this_ptr_conv;
38988         this_ptr_conv.inner = untag_ptr(this_ptr);
38989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38991         this_ptr_conv.is_owned = false;
38992         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38993         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38994 }
38995
38996 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) {
38997         LDKChannelTransactionParameters this_ptr_conv;
38998         this_ptr_conv.inner = untag_ptr(this_ptr);
38999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39001         this_ptr_conv.is_owned = false;
39002         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_non_zero_fee_anchors(&this_ptr_conv));
39003         return ret_conv;
39004 }
39005
39006 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) {
39007         LDKChannelTransactionParameters this_ptr_conv;
39008         this_ptr_conv.inner = untag_ptr(this_ptr);
39009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39011         this_ptr_conv.is_owned = false;
39012         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
39013         ChannelTransactionParameters_set_opt_non_zero_fee_anchors(&this_ptr_conv, val_conv);
39014 }
39015
39016 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) {
39017         LDKChannelPublicKeys holder_pubkeys_arg_conv;
39018         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
39019         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
39020         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
39021         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
39022         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
39023         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
39024         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
39025         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
39026         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
39027         LDKOutPoint funding_outpoint_arg_conv;
39028         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
39029         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
39030         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
39031         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
39032         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
39033         LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_non_zero_fee_anchors_arg);
39034         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);
39035         uint64_t ret_ref = 0;
39036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39038         return ret_ref;
39039 }
39040
39041 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
39042         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
39043         uint64_t ret_ref = 0;
39044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39046         return ret_ref;
39047 }
39048 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
39049         LDKChannelTransactionParameters arg_conv;
39050         arg_conv.inner = untag_ptr(arg);
39051         arg_conv.is_owned = ptr_is_owned(arg);
39052         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39053         arg_conv.is_owned = false;
39054         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
39055         return ret_conv;
39056 }
39057
39058 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
39059         LDKChannelTransactionParameters orig_conv;
39060         orig_conv.inner = untag_ptr(orig);
39061         orig_conv.is_owned = ptr_is_owned(orig);
39062         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39063         orig_conv.is_owned = false;
39064         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
39065         uint64_t ret_ref = 0;
39066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39068         return ret_ref;
39069 }
39070
39071 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
39072         LDKCounterpartyChannelTransactionParameters this_obj_conv;
39073         this_obj_conv.inner = untag_ptr(this_obj);
39074         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39076         CounterpartyChannelTransactionParameters_free(this_obj_conv);
39077 }
39078
39079 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
39080         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39081         this_ptr_conv.inner = untag_ptr(this_ptr);
39082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39084         this_ptr_conv.is_owned = false;
39085         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
39086         uint64_t ret_ref = 0;
39087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39089         return ret_ref;
39090 }
39091
39092 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
39093         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39094         this_ptr_conv.inner = untag_ptr(this_ptr);
39095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39097         this_ptr_conv.is_owned = false;
39098         LDKChannelPublicKeys val_conv;
39099         val_conv.inner = untag_ptr(val);
39100         val_conv.is_owned = ptr_is_owned(val);
39101         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39102         val_conv = ChannelPublicKeys_clone(&val_conv);
39103         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
39104 }
39105
39106 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
39107         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39108         this_ptr_conv.inner = untag_ptr(this_ptr);
39109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39111         this_ptr_conv.is_owned = false;
39112         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
39113         return ret_conv;
39114 }
39115
39116 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
39117         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39118         this_ptr_conv.inner = untag_ptr(this_ptr);
39119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39121         this_ptr_conv.is_owned = false;
39122         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
39123 }
39124
39125 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
39126         LDKChannelPublicKeys pubkeys_arg_conv;
39127         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
39128         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
39129         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
39130         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
39131         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
39132         uint64_t ret_ref = 0;
39133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39135         return ret_ref;
39136 }
39137
39138 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
39139         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
39140         uint64_t ret_ref = 0;
39141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39143         return ret_ref;
39144 }
39145 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
39146         LDKCounterpartyChannelTransactionParameters arg_conv;
39147         arg_conv.inner = untag_ptr(arg);
39148         arg_conv.is_owned = ptr_is_owned(arg);
39149         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39150         arg_conv.is_owned = false;
39151         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
39152         return ret_conv;
39153 }
39154
39155 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
39156         LDKCounterpartyChannelTransactionParameters orig_conv;
39157         orig_conv.inner = untag_ptr(orig);
39158         orig_conv.is_owned = ptr_is_owned(orig);
39159         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39160         orig_conv.is_owned = false;
39161         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
39162         uint64_t ret_ref = 0;
39163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39165         return ret_ref;
39166 }
39167
39168 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
39169         LDKChannelTransactionParameters this_arg_conv;
39170         this_arg_conv.inner = untag_ptr(this_arg);
39171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39173         this_arg_conv.is_owned = false;
39174         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
39175         return ret_conv;
39176 }
39177
39178 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
39179         LDKChannelTransactionParameters this_arg_conv;
39180         this_arg_conv.inner = untag_ptr(this_arg);
39181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39183         this_arg_conv.is_owned = false;
39184         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
39185         uint64_t ret_ref = 0;
39186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39188         return ret_ref;
39189 }
39190
39191 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
39192         LDKChannelTransactionParameters this_arg_conv;
39193         this_arg_conv.inner = untag_ptr(this_arg);
39194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39196         this_arg_conv.is_owned = false;
39197         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
39198         uint64_t ret_ref = 0;
39199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39201         return ret_ref;
39202 }
39203
39204 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
39205         LDKCounterpartyChannelTransactionParameters obj_conv;
39206         obj_conv.inner = untag_ptr(obj);
39207         obj_conv.is_owned = ptr_is_owned(obj);
39208         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39209         obj_conv.is_owned = false;
39210         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
39211         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39212         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39213         CVec_u8Z_free(ret_var);
39214         return ret_arr;
39215 }
39216
39217 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
39218         LDKu8slice ser_ref;
39219         ser_ref.datalen = ser->arr_len;
39220         ser_ref.data = ser->elems;
39221         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
39222         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
39223         FREE(ser);
39224         return tag_ptr(ret_conv, true);
39225 }
39226
39227 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
39228         LDKChannelTransactionParameters obj_conv;
39229         obj_conv.inner = untag_ptr(obj);
39230         obj_conv.is_owned = ptr_is_owned(obj);
39231         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39232         obj_conv.is_owned = false;
39233         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
39234         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39235         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39236         CVec_u8Z_free(ret_var);
39237         return ret_arr;
39238 }
39239
39240 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
39241         LDKu8slice ser_ref;
39242         ser_ref.datalen = ser->arr_len;
39243         ser_ref.data = ser->elems;
39244         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
39245         *ret_conv = ChannelTransactionParameters_read(ser_ref);
39246         FREE(ser);
39247         return tag_ptr(ret_conv, true);
39248 }
39249
39250 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
39251         LDKDirectedChannelTransactionParameters this_obj_conv;
39252         this_obj_conv.inner = untag_ptr(this_obj);
39253         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39255         DirectedChannelTransactionParameters_free(this_obj_conv);
39256 }
39257
39258 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
39259         LDKDirectedChannelTransactionParameters this_arg_conv;
39260         this_arg_conv.inner = untag_ptr(this_arg);
39261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39263         this_arg_conv.is_owned = false;
39264         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
39265         uint64_t ret_ref = 0;
39266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39268         return ret_ref;
39269 }
39270
39271 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
39272         LDKDirectedChannelTransactionParameters this_arg_conv;
39273         this_arg_conv.inner = untag_ptr(this_arg);
39274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39276         this_arg_conv.is_owned = false;
39277         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
39278         uint64_t ret_ref = 0;
39279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39281         return ret_ref;
39282 }
39283
39284 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
39285         LDKDirectedChannelTransactionParameters this_arg_conv;
39286         this_arg_conv.inner = untag_ptr(this_arg);
39287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39289         this_arg_conv.is_owned = false;
39290         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
39291         return ret_conv;
39292 }
39293
39294 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
39295         LDKDirectedChannelTransactionParameters this_arg_conv;
39296         this_arg_conv.inner = untag_ptr(this_arg);
39297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39299         this_arg_conv.is_owned = false;
39300         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
39301         return ret_conv;
39302 }
39303
39304 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
39305         LDKDirectedChannelTransactionParameters this_arg_conv;
39306         this_arg_conv.inner = untag_ptr(this_arg);
39307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39309         this_arg_conv.is_owned = false;
39310         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
39311         uint64_t ret_ref = 0;
39312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39314         return ret_ref;
39315 }
39316
39317 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
39318         LDKDirectedChannelTransactionParameters this_arg_conv;
39319         this_arg_conv.inner = untag_ptr(this_arg);
39320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39322         this_arg_conv.is_owned = false;
39323         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
39324         return ret_conv;
39325 }
39326
39327 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
39328         LDKHolderCommitmentTransaction this_obj_conv;
39329         this_obj_conv.inner = untag_ptr(this_obj);
39330         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39332         HolderCommitmentTransaction_free(this_obj_conv);
39333 }
39334
39335 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
39336         LDKHolderCommitmentTransaction this_ptr_conv;
39337         this_ptr_conv.inner = untag_ptr(this_ptr);
39338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39340         this_ptr_conv.is_owned = false;
39341         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39342         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
39343         return ret_arr;
39344 }
39345
39346 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
39347         LDKHolderCommitmentTransaction this_ptr_conv;
39348         this_ptr_conv.inner = untag_ptr(this_ptr);
39349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39351         this_ptr_conv.is_owned = false;
39352         LDKSignature val_ref;
39353         CHECK(val->arr_len == 64);
39354         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39355         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
39356 }
39357
39358 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
39359         LDKHolderCommitmentTransaction this_ptr_conv;
39360         this_ptr_conv.inner = untag_ptr(this_ptr);
39361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39363         this_ptr_conv.is_owned = false;
39364         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
39365         ptrArray ret_arr = NULL;
39366         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39367         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39368         for (size_t m = 0; m < ret_var.datalen; m++) {
39369                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
39370                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
39371                 ret_arr_ptr[m] = ret_conv_12_arr;
39372         }
39373         
39374         FREE(ret_var.data);
39375         return ret_arr;
39376 }
39377
39378 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
39379         LDKHolderCommitmentTransaction this_ptr_conv;
39380         this_ptr_conv.inner = untag_ptr(this_ptr);
39381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39383         this_ptr_conv.is_owned = false;
39384         LDKCVec_SignatureZ val_constr;
39385         val_constr.datalen = val->arr_len;
39386         if (val_constr.datalen > 0)
39387                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39388         else
39389                 val_constr.data = NULL;
39390         int8_tArray* val_vals = (void*) val->elems;
39391         for (size_t m = 0; m < val_constr.datalen; m++) {
39392                 int8_tArray val_conv_12 = val_vals[m];
39393                 LDKSignature val_conv_12_ref;
39394                 CHECK(val_conv_12->arr_len == 64);
39395                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
39396                 val_constr.data[m] = val_conv_12_ref;
39397         }
39398         FREE(val);
39399         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
39400 }
39401
39402 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
39403         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
39404         uint64_t ret_ref = 0;
39405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39407         return ret_ref;
39408 }
39409 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
39410         LDKHolderCommitmentTransaction arg_conv;
39411         arg_conv.inner = untag_ptr(arg);
39412         arg_conv.is_owned = ptr_is_owned(arg);
39413         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39414         arg_conv.is_owned = false;
39415         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
39416         return ret_conv;
39417 }
39418
39419 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
39420         LDKHolderCommitmentTransaction orig_conv;
39421         orig_conv.inner = untag_ptr(orig);
39422         orig_conv.is_owned = ptr_is_owned(orig);
39423         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39424         orig_conv.is_owned = false;
39425         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
39426         uint64_t ret_ref = 0;
39427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39429         return ret_ref;
39430 }
39431
39432 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
39433         LDKHolderCommitmentTransaction obj_conv;
39434         obj_conv.inner = untag_ptr(obj);
39435         obj_conv.is_owned = ptr_is_owned(obj);
39436         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39437         obj_conv.is_owned = false;
39438         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
39439         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39440         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39441         CVec_u8Z_free(ret_var);
39442         return ret_arr;
39443 }
39444
39445 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
39446         LDKu8slice ser_ref;
39447         ser_ref.datalen = ser->arr_len;
39448         ser_ref.data = ser->elems;
39449         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
39450         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
39451         FREE(ser);
39452         return tag_ptr(ret_conv, true);
39453 }
39454
39455 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) {
39456         LDKCommitmentTransaction commitment_tx_conv;
39457         commitment_tx_conv.inner = untag_ptr(commitment_tx);
39458         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
39459         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
39460         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
39461         LDKSignature counterparty_sig_ref;
39462         CHECK(counterparty_sig->arr_len == 64);
39463         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
39464         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
39465         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
39466         if (counterparty_htlc_sigs_constr.datalen > 0)
39467                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39468         else
39469                 counterparty_htlc_sigs_constr.data = NULL;
39470         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
39471         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
39472                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
39473                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
39474                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
39475                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
39476                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
39477         }
39478         FREE(counterparty_htlc_sigs);
39479         LDKPublicKey holder_funding_key_ref;
39480         CHECK(holder_funding_key->arr_len == 33);
39481         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
39482         LDKPublicKey counterparty_funding_key_ref;
39483         CHECK(counterparty_funding_key->arr_len == 33);
39484         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
39485         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
39486         uint64_t ret_ref = 0;
39487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39489         return ret_ref;
39490 }
39491
39492 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
39493         LDKBuiltCommitmentTransaction this_obj_conv;
39494         this_obj_conv.inner = untag_ptr(this_obj);
39495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39497         BuiltCommitmentTransaction_free(this_obj_conv);
39498 }
39499
39500 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
39501         LDKBuiltCommitmentTransaction this_ptr_conv;
39502         this_ptr_conv.inner = untag_ptr(this_ptr);
39503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39505         this_ptr_conv.is_owned = false;
39506         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
39507         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39508         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39509         Transaction_free(ret_var);
39510         return ret_arr;
39511 }
39512
39513 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
39514         LDKBuiltCommitmentTransaction this_ptr_conv;
39515         this_ptr_conv.inner = untag_ptr(this_ptr);
39516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39518         this_ptr_conv.is_owned = false;
39519         LDKTransaction val_ref;
39520         val_ref.datalen = val->arr_len;
39521         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
39522         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39523         val_ref.data_is_owned = true;
39524         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
39525 }
39526
39527 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
39528         LDKBuiltCommitmentTransaction this_ptr_conv;
39529         this_ptr_conv.inner = untag_ptr(this_ptr);
39530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39532         this_ptr_conv.is_owned = false;
39533         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39534         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
39535         return ret_arr;
39536 }
39537
39538 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
39539         LDKBuiltCommitmentTransaction this_ptr_conv;
39540         this_ptr_conv.inner = untag_ptr(this_ptr);
39541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39543         this_ptr_conv.is_owned = false;
39544         LDKThirtyTwoBytes val_ref;
39545         CHECK(val->arr_len == 32);
39546         memcpy(val_ref.data, val->elems, 32); FREE(val);
39547         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
39548 }
39549
39550 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
39551         LDKTransaction transaction_arg_ref;
39552         transaction_arg_ref.datalen = transaction_arg->arr_len;
39553         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
39554         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
39555         transaction_arg_ref.data_is_owned = true;
39556         LDKThirtyTwoBytes txid_arg_ref;
39557         CHECK(txid_arg->arr_len == 32);
39558         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
39559         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
39560         uint64_t ret_ref = 0;
39561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39563         return ret_ref;
39564 }
39565
39566 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
39567         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
39568         uint64_t ret_ref = 0;
39569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39571         return ret_ref;
39572 }
39573 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
39574         LDKBuiltCommitmentTransaction arg_conv;
39575         arg_conv.inner = untag_ptr(arg);
39576         arg_conv.is_owned = ptr_is_owned(arg);
39577         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39578         arg_conv.is_owned = false;
39579         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
39580         return ret_conv;
39581 }
39582
39583 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
39584         LDKBuiltCommitmentTransaction orig_conv;
39585         orig_conv.inner = untag_ptr(orig);
39586         orig_conv.is_owned = ptr_is_owned(orig);
39587         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39588         orig_conv.is_owned = false;
39589         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
39590         uint64_t ret_ref = 0;
39591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39593         return ret_ref;
39594 }
39595
39596 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
39597         LDKBuiltCommitmentTransaction obj_conv;
39598         obj_conv.inner = untag_ptr(obj);
39599         obj_conv.is_owned = ptr_is_owned(obj);
39600         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39601         obj_conv.is_owned = false;
39602         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
39603         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39604         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39605         CVec_u8Z_free(ret_var);
39606         return ret_arr;
39607 }
39608
39609 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
39610         LDKu8slice ser_ref;
39611         ser_ref.datalen = ser->arr_len;
39612         ser_ref.data = ser->elems;
39613         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
39614         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
39615         FREE(ser);
39616         return tag_ptr(ret_conv, true);
39617 }
39618
39619 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) {
39620         LDKBuiltCommitmentTransaction this_arg_conv;
39621         this_arg_conv.inner = untag_ptr(this_arg);
39622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39624         this_arg_conv.is_owned = false;
39625         LDKu8slice funding_redeemscript_ref;
39626         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39627         funding_redeemscript_ref.data = funding_redeemscript->elems;
39628         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39629         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39630         FREE(funding_redeemscript);
39631         return ret_arr;
39632 }
39633
39634 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_sign"))) TS_BuiltCommitmentTransaction_sign(uint64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
39635         LDKBuiltCommitmentTransaction this_arg_conv;
39636         this_arg_conv.inner = untag_ptr(this_arg);
39637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39639         this_arg_conv.is_owned = false;
39640         uint8_t funding_key_arr[32];
39641         CHECK(funding_key->arr_len == 32);
39642         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39643         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39644         LDKu8slice funding_redeemscript_ref;
39645         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39646         funding_redeemscript_ref.data = funding_redeemscript->elems;
39647         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39648         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39649         FREE(funding_redeemscript);
39650         return ret_arr;
39651 }
39652
39653 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
39654         LDKClosingTransaction this_obj_conv;
39655         this_obj_conv.inner = untag_ptr(this_obj);
39656         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39658         ClosingTransaction_free(this_obj_conv);
39659 }
39660
39661 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
39662         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
39663         uint64_t ret_ref = 0;
39664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39666         return ret_ref;
39667 }
39668 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
39669         LDKClosingTransaction arg_conv;
39670         arg_conv.inner = untag_ptr(arg);
39671         arg_conv.is_owned = ptr_is_owned(arg);
39672         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39673         arg_conv.is_owned = false;
39674         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
39675         return ret_conv;
39676 }
39677
39678 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
39679         LDKClosingTransaction orig_conv;
39680         orig_conv.inner = untag_ptr(orig);
39681         orig_conv.is_owned = ptr_is_owned(orig);
39682         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39683         orig_conv.is_owned = false;
39684         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
39685         uint64_t ret_ref = 0;
39686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39688         return ret_ref;
39689 }
39690
39691 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
39692         LDKClosingTransaction o_conv;
39693         o_conv.inner = untag_ptr(o);
39694         o_conv.is_owned = ptr_is_owned(o);
39695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39696         o_conv.is_owned = false;
39697         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39698         return ret_conv;
39699 }
39700
39701 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
39702         LDKClosingTransaction a_conv;
39703         a_conv.inner = untag_ptr(a);
39704         a_conv.is_owned = ptr_is_owned(a);
39705         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39706         a_conv.is_owned = false;
39707         LDKClosingTransaction b_conv;
39708         b_conv.inner = untag_ptr(b);
39709         b_conv.is_owned = ptr_is_owned(b);
39710         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39711         b_conv.is_owned = false;
39712         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
39713         return ret_conv;
39714 }
39715
39716 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) {
39717         LDKCVec_u8Z to_holder_script_ref;
39718         to_holder_script_ref.datalen = to_holder_script->arr_len;
39719         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39720         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
39721         LDKCVec_u8Z to_counterparty_script_ref;
39722         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
39723         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39724         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
39725         LDKOutPoint funding_outpoint_conv;
39726         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39727         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39728         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39729         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39730         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39731         uint64_t ret_ref = 0;
39732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39734         return ret_ref;
39735 }
39736
39737 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
39738         LDKClosingTransaction this_arg_conv;
39739         this_arg_conv.inner = untag_ptr(this_arg);
39740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39742         this_arg_conv.is_owned = false;
39743         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39744         uint64_t ret_ref = 0;
39745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39747         return ret_ref;
39748 }
39749
39750 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
39751         LDKClosingTransaction this_arg_conv;
39752         this_arg_conv.inner = untag_ptr(this_arg);
39753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39755         this_arg_conv.is_owned = false;
39756         LDKOutPoint funding_outpoint_conv;
39757         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39758         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39759         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39760         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39761         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39762         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39763         return tag_ptr(ret_conv, true);
39764 }
39765
39766 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
39767         LDKClosingTransaction this_arg_conv;
39768         this_arg_conv.inner = untag_ptr(this_arg);
39769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39771         this_arg_conv.is_owned = false;
39772         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39773         return ret_conv;
39774 }
39775
39776 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
39777         LDKClosingTransaction 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         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39783         return ret_conv;
39784 }
39785
39786 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
39787         LDKClosingTransaction this_arg_conv;
39788         this_arg_conv.inner = untag_ptr(this_arg);
39789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39791         this_arg_conv.is_owned = false;
39792         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39793         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39794         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39795         return ret_arr;
39796 }
39797
39798 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
39799         LDKClosingTransaction this_arg_conv;
39800         this_arg_conv.inner = untag_ptr(this_arg);
39801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39803         this_arg_conv.is_owned = false;
39804         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
39805         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39806         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39807         return ret_arr;
39808 }
39809
39810 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
39811         LDKTrustedClosingTransaction this_obj_conv;
39812         this_obj_conv.inner = untag_ptr(this_obj);
39813         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39815         TrustedClosingTransaction_free(this_obj_conv);
39816 }
39817
39818 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
39819         LDKTrustedClosingTransaction this_arg_conv;
39820         this_arg_conv.inner = untag_ptr(this_arg);
39821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39823         this_arg_conv.is_owned = false;
39824         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39825         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39826         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39827         Transaction_free(ret_var);
39828         return ret_arr;
39829 }
39830
39831 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) {
39832         LDKTrustedClosingTransaction this_arg_conv;
39833         this_arg_conv.inner = untag_ptr(this_arg);
39834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39836         this_arg_conv.is_owned = false;
39837         LDKu8slice funding_redeemscript_ref;
39838         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39839         funding_redeemscript_ref.data = funding_redeemscript->elems;
39840         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39841         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39842         FREE(funding_redeemscript);
39843         return ret_arr;
39844 }
39845
39846 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) {
39847         LDKTrustedClosingTransaction this_arg_conv;
39848         this_arg_conv.inner = untag_ptr(this_arg);
39849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39851         this_arg_conv.is_owned = false;
39852         uint8_t funding_key_arr[32];
39853         CHECK(funding_key->arr_len == 32);
39854         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39855         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39856         LDKu8slice funding_redeemscript_ref;
39857         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39858         funding_redeemscript_ref.data = funding_redeemscript->elems;
39859         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39860         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39861         FREE(funding_redeemscript);
39862         return ret_arr;
39863 }
39864
39865 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
39866         LDKCommitmentTransaction this_obj_conv;
39867         this_obj_conv.inner = untag_ptr(this_obj);
39868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39870         CommitmentTransaction_free(this_obj_conv);
39871 }
39872
39873 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39874         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39875         uint64_t ret_ref = 0;
39876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39878         return ret_ref;
39879 }
39880 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
39881         LDKCommitmentTransaction arg_conv;
39882         arg_conv.inner = untag_ptr(arg);
39883         arg_conv.is_owned = ptr_is_owned(arg);
39884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39885         arg_conv.is_owned = false;
39886         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39887         return ret_conv;
39888 }
39889
39890 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
39891         LDKCommitmentTransaction orig_conv;
39892         orig_conv.inner = untag_ptr(orig);
39893         orig_conv.is_owned = ptr_is_owned(orig);
39894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39895         orig_conv.is_owned = false;
39896         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39897         uint64_t ret_ref = 0;
39898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39900         return ret_ref;
39901 }
39902
39903 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
39904         LDKCommitmentTransaction obj_conv;
39905         obj_conv.inner = untag_ptr(obj);
39906         obj_conv.is_owned = ptr_is_owned(obj);
39907         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39908         obj_conv.is_owned = false;
39909         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39910         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39911         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39912         CVec_u8Z_free(ret_var);
39913         return ret_arr;
39914 }
39915
39916 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
39917         LDKu8slice ser_ref;
39918         ser_ref.datalen = ser->arr_len;
39919         ser_ref.data = ser->elems;
39920         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39921         *ret_conv = CommitmentTransaction_read(ser_ref);
39922         FREE(ser);
39923         return tag_ptr(ret_conv, true);
39924 }
39925
39926 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
39927         LDKCommitmentTransaction this_arg_conv;
39928         this_arg_conv.inner = untag_ptr(this_arg);
39929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39931         this_arg_conv.is_owned = false;
39932         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39933         return ret_conv;
39934 }
39935
39936 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
39937         LDKCommitmentTransaction this_arg_conv;
39938         this_arg_conv.inner = untag_ptr(this_arg);
39939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39941         this_arg_conv.is_owned = false;
39942         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39943         return ret_conv;
39944 }
39945
39946 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
39947         LDKCommitmentTransaction this_arg_conv;
39948         this_arg_conv.inner = untag_ptr(this_arg);
39949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39951         this_arg_conv.is_owned = false;
39952         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39953         return ret_conv;
39954 }
39955
39956 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
39957         LDKCommitmentTransaction this_arg_conv;
39958         this_arg_conv.inner = untag_ptr(this_arg);
39959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39961         this_arg_conv.is_owned = false;
39962         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39963         return ret_conv;
39964 }
39965
39966 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
39967         LDKCommitmentTransaction this_arg_conv;
39968         this_arg_conv.inner = untag_ptr(this_arg);
39969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39971         this_arg_conv.is_owned = false;
39972         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39973         uint64_t ret_ref = 0;
39974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39976         return ret_ref;
39977 }
39978
39979 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) {
39980         LDKCommitmentTransaction this_arg_conv;
39981         this_arg_conv.inner = untag_ptr(this_arg);
39982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39984         this_arg_conv.is_owned = false;
39985         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39986         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39987         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39988         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39989         channel_parameters_conv.is_owned = false;
39990         LDKChannelPublicKeys broadcaster_keys_conv;
39991         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39992         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39993         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39994         broadcaster_keys_conv.is_owned = false;
39995         LDKChannelPublicKeys countersignatory_keys_conv;
39996         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39997         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39998         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39999         countersignatory_keys_conv.is_owned = false;
40000         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
40001         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
40002         return tag_ptr(ret_conv, true);
40003 }
40004
40005 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
40006         LDKTrustedCommitmentTransaction this_obj_conv;
40007         this_obj_conv.inner = untag_ptr(this_obj);
40008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40010         TrustedCommitmentTransaction_free(this_obj_conv);
40011 }
40012
40013 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
40014         LDKTrustedCommitmentTransaction this_arg_conv;
40015         this_arg_conv.inner = untag_ptr(this_arg);
40016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40018         this_arg_conv.is_owned = false;
40019         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40020         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
40021         return ret_arr;
40022 }
40023
40024 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
40025         LDKTrustedCommitmentTransaction this_arg_conv;
40026         this_arg_conv.inner = untag_ptr(this_arg);
40027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40029         this_arg_conv.is_owned = false;
40030         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
40031         uint64_t ret_ref = 0;
40032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40034         return ret_ref;
40035 }
40036
40037 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
40038         LDKTrustedCommitmentTransaction this_arg_conv;
40039         this_arg_conv.inner = untag_ptr(this_arg);
40040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40042         this_arg_conv.is_owned = false;
40043         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
40044         uint64_t ret_ref = 0;
40045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40047         return ret_ref;
40048 }
40049
40050 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
40051         LDKTrustedCommitmentTransaction this_arg_conv;
40052         this_arg_conv.inner = untag_ptr(this_arg);
40053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40055         this_arg_conv.is_owned = false;
40056         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
40057         return ret_conv;
40058 }
40059
40060 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) {
40061         LDKTrustedCommitmentTransaction this_arg_conv;
40062         this_arg_conv.inner = untag_ptr(this_arg);
40063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40065         this_arg_conv.is_owned = false;
40066         uint8_t htlc_base_key_arr[32];
40067         CHECK(htlc_base_key->arr_len == 32);
40068         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
40069         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
40070         LDKDirectedChannelTransactionParameters channel_parameters_conv;
40071         channel_parameters_conv.inner = untag_ptr(channel_parameters);
40072         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
40073         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40074         channel_parameters_conv.is_owned = false;
40075         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
40076         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
40077         return tag_ptr(ret_conv, true);
40078 }
40079
40080 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) {
40081         LDKPublicKey broadcaster_payment_basepoint_ref;
40082         CHECK(broadcaster_payment_basepoint->arr_len == 33);
40083         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
40084         LDKPublicKey countersignatory_payment_basepoint_ref;
40085         CHECK(countersignatory_payment_basepoint->arr_len == 33);
40086         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
40087         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
40088         return ret_conv;
40089 }
40090
40091 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
40092         LDKInitFeatures a_conv;
40093         a_conv.inner = untag_ptr(a);
40094         a_conv.is_owned = ptr_is_owned(a);
40095         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40096         a_conv.is_owned = false;
40097         LDKInitFeatures b_conv;
40098         b_conv.inner = untag_ptr(b);
40099         b_conv.is_owned = ptr_is_owned(b);
40100         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40101         b_conv.is_owned = false;
40102         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
40103         return ret_conv;
40104 }
40105
40106 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
40107         LDKNodeFeatures a_conv;
40108         a_conv.inner = untag_ptr(a);
40109         a_conv.is_owned = ptr_is_owned(a);
40110         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40111         a_conv.is_owned = false;
40112         LDKNodeFeatures b_conv;
40113         b_conv.inner = untag_ptr(b);
40114         b_conv.is_owned = ptr_is_owned(b);
40115         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40116         b_conv.is_owned = false;
40117         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
40118         return ret_conv;
40119 }
40120
40121 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
40122         LDKChannelFeatures a_conv;
40123         a_conv.inner = untag_ptr(a);
40124         a_conv.is_owned = ptr_is_owned(a);
40125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40126         a_conv.is_owned = false;
40127         LDKChannelFeatures b_conv;
40128         b_conv.inner = untag_ptr(b);
40129         b_conv.is_owned = ptr_is_owned(b);
40130         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40131         b_conv.is_owned = false;
40132         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
40133         return ret_conv;
40134 }
40135
40136 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40137         LDKInvoiceFeatures a_conv;
40138         a_conv.inner = untag_ptr(a);
40139         a_conv.is_owned = ptr_is_owned(a);
40140         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40141         a_conv.is_owned = false;
40142         LDKInvoiceFeatures b_conv;
40143         b_conv.inner = untag_ptr(b);
40144         b_conv.is_owned = ptr_is_owned(b);
40145         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40146         b_conv.is_owned = false;
40147         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
40148         return ret_conv;
40149 }
40150
40151 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
40152         LDKOfferFeatures a_conv;
40153         a_conv.inner = untag_ptr(a);
40154         a_conv.is_owned = ptr_is_owned(a);
40155         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40156         a_conv.is_owned = false;
40157         LDKOfferFeatures b_conv;
40158         b_conv.inner = untag_ptr(b);
40159         b_conv.is_owned = ptr_is_owned(b);
40160         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40161         b_conv.is_owned = false;
40162         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
40163         return ret_conv;
40164 }
40165
40166 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
40167         LDKInvoiceRequestFeatures a_conv;
40168         a_conv.inner = untag_ptr(a);
40169         a_conv.is_owned = ptr_is_owned(a);
40170         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40171         a_conv.is_owned = false;
40172         LDKInvoiceRequestFeatures b_conv;
40173         b_conv.inner = untag_ptr(b);
40174         b_conv.is_owned = ptr_is_owned(b);
40175         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40176         b_conv.is_owned = false;
40177         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
40178         return ret_conv;
40179 }
40180
40181 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40182         LDKBolt12InvoiceFeatures a_conv;
40183         a_conv.inner = untag_ptr(a);
40184         a_conv.is_owned = ptr_is_owned(a);
40185         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40186         a_conv.is_owned = false;
40187         LDKBolt12InvoiceFeatures b_conv;
40188         b_conv.inner = untag_ptr(b);
40189         b_conv.is_owned = ptr_is_owned(b);
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40191         b_conv.is_owned = false;
40192         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
40193         return ret_conv;
40194 }
40195
40196 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
40197         LDKBlindedHopFeatures a_conv;
40198         a_conv.inner = untag_ptr(a);
40199         a_conv.is_owned = ptr_is_owned(a);
40200         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40201         a_conv.is_owned = false;
40202         LDKBlindedHopFeatures b_conv;
40203         b_conv.inner = untag_ptr(b);
40204         b_conv.is_owned = ptr_is_owned(b);
40205         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40206         b_conv.is_owned = false;
40207         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
40208         return ret_conv;
40209 }
40210
40211 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
40212         LDKChannelTypeFeatures a_conv;
40213         a_conv.inner = untag_ptr(a);
40214         a_conv.is_owned = ptr_is_owned(a);
40215         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40216         a_conv.is_owned = false;
40217         LDKChannelTypeFeatures b_conv;
40218         b_conv.inner = untag_ptr(b);
40219         b_conv.is_owned = ptr_is_owned(b);
40220         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40221         b_conv.is_owned = false;
40222         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
40223         return ret_conv;
40224 }
40225
40226 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
40227         LDKInitFeatures ret_var = InitFeatures_clone(arg);
40228         uint64_t ret_ref = 0;
40229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40231         return ret_ref;
40232 }
40233 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
40234         LDKInitFeatures arg_conv;
40235         arg_conv.inner = untag_ptr(arg);
40236         arg_conv.is_owned = ptr_is_owned(arg);
40237         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40238         arg_conv.is_owned = false;
40239         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
40240         return ret_conv;
40241 }
40242
40243 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
40244         LDKInitFeatures orig_conv;
40245         orig_conv.inner = untag_ptr(orig);
40246         orig_conv.is_owned = ptr_is_owned(orig);
40247         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40248         orig_conv.is_owned = false;
40249         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
40250         uint64_t ret_ref = 0;
40251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40253         return ret_ref;
40254 }
40255
40256 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
40257         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
40258         uint64_t ret_ref = 0;
40259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40261         return ret_ref;
40262 }
40263 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
40264         LDKNodeFeatures arg_conv;
40265         arg_conv.inner = untag_ptr(arg);
40266         arg_conv.is_owned = ptr_is_owned(arg);
40267         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40268         arg_conv.is_owned = false;
40269         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
40270         return ret_conv;
40271 }
40272
40273 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
40274         LDKNodeFeatures orig_conv;
40275         orig_conv.inner = untag_ptr(orig);
40276         orig_conv.is_owned = ptr_is_owned(orig);
40277         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40278         orig_conv.is_owned = false;
40279         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
40280         uint64_t ret_ref = 0;
40281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40283         return ret_ref;
40284 }
40285
40286 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
40287         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
40288         uint64_t ret_ref = 0;
40289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40291         return ret_ref;
40292 }
40293 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
40294         LDKChannelFeatures arg_conv;
40295         arg_conv.inner = untag_ptr(arg);
40296         arg_conv.is_owned = ptr_is_owned(arg);
40297         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40298         arg_conv.is_owned = false;
40299         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
40300         return ret_conv;
40301 }
40302
40303 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
40304         LDKChannelFeatures orig_conv;
40305         orig_conv.inner = untag_ptr(orig);
40306         orig_conv.is_owned = ptr_is_owned(orig);
40307         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40308         orig_conv.is_owned = false;
40309         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
40310         uint64_t ret_ref = 0;
40311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40313         return ret_ref;
40314 }
40315
40316 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
40317         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
40318         uint64_t ret_ref = 0;
40319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40321         return ret_ref;
40322 }
40323 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
40324         LDKInvoiceFeatures arg_conv;
40325         arg_conv.inner = untag_ptr(arg);
40326         arg_conv.is_owned = ptr_is_owned(arg);
40327         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40328         arg_conv.is_owned = false;
40329         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
40330         return ret_conv;
40331 }
40332
40333 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
40334         LDKInvoiceFeatures orig_conv;
40335         orig_conv.inner = untag_ptr(orig);
40336         orig_conv.is_owned = ptr_is_owned(orig);
40337         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40338         orig_conv.is_owned = false;
40339         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
40340         uint64_t ret_ref = 0;
40341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40343         return ret_ref;
40344 }
40345
40346 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
40347         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
40348         uint64_t ret_ref = 0;
40349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40351         return ret_ref;
40352 }
40353 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
40354         LDKOfferFeatures arg_conv;
40355         arg_conv.inner = untag_ptr(arg);
40356         arg_conv.is_owned = ptr_is_owned(arg);
40357         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40358         arg_conv.is_owned = false;
40359         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
40360         return ret_conv;
40361 }
40362
40363 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
40364         LDKOfferFeatures orig_conv;
40365         orig_conv.inner = untag_ptr(orig);
40366         orig_conv.is_owned = ptr_is_owned(orig);
40367         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40368         orig_conv.is_owned = false;
40369         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
40370         uint64_t ret_ref = 0;
40371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40373         return ret_ref;
40374 }
40375
40376 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
40377         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
40378         uint64_t ret_ref = 0;
40379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40381         return ret_ref;
40382 }
40383 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
40384         LDKInvoiceRequestFeatures arg_conv;
40385         arg_conv.inner = untag_ptr(arg);
40386         arg_conv.is_owned = ptr_is_owned(arg);
40387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40388         arg_conv.is_owned = false;
40389         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
40390         return ret_conv;
40391 }
40392
40393 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
40394         LDKInvoiceRequestFeatures orig_conv;
40395         orig_conv.inner = untag_ptr(orig);
40396         orig_conv.is_owned = ptr_is_owned(orig);
40397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40398         orig_conv.is_owned = false;
40399         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
40400         uint64_t ret_ref = 0;
40401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40403         return ret_ref;
40404 }
40405
40406 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
40407         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
40408         uint64_t ret_ref = 0;
40409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40411         return ret_ref;
40412 }
40413 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
40414         LDKBolt12InvoiceFeatures arg_conv;
40415         arg_conv.inner = untag_ptr(arg);
40416         arg_conv.is_owned = ptr_is_owned(arg);
40417         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40418         arg_conv.is_owned = false;
40419         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
40420         return ret_conv;
40421 }
40422
40423 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
40424         LDKBolt12InvoiceFeatures orig_conv;
40425         orig_conv.inner = untag_ptr(orig);
40426         orig_conv.is_owned = ptr_is_owned(orig);
40427         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40428         orig_conv.is_owned = false;
40429         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
40430         uint64_t ret_ref = 0;
40431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40433         return ret_ref;
40434 }
40435
40436 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
40437         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
40438         uint64_t ret_ref = 0;
40439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40441         return ret_ref;
40442 }
40443 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
40444         LDKBlindedHopFeatures arg_conv;
40445         arg_conv.inner = untag_ptr(arg);
40446         arg_conv.is_owned = ptr_is_owned(arg);
40447         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40448         arg_conv.is_owned = false;
40449         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
40450         return ret_conv;
40451 }
40452
40453 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
40454         LDKBlindedHopFeatures orig_conv;
40455         orig_conv.inner = untag_ptr(orig);
40456         orig_conv.is_owned = ptr_is_owned(orig);
40457         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40458         orig_conv.is_owned = false;
40459         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
40460         uint64_t ret_ref = 0;
40461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40463         return ret_ref;
40464 }
40465
40466 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
40467         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
40468         uint64_t ret_ref = 0;
40469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40471         return ret_ref;
40472 }
40473 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
40474         LDKChannelTypeFeatures arg_conv;
40475         arg_conv.inner = untag_ptr(arg);
40476         arg_conv.is_owned = ptr_is_owned(arg);
40477         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40478         arg_conv.is_owned = false;
40479         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
40480         return ret_conv;
40481 }
40482
40483 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
40484         LDKChannelTypeFeatures orig_conv;
40485         orig_conv.inner = untag_ptr(orig);
40486         orig_conv.is_owned = ptr_is_owned(orig);
40487         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40488         orig_conv.is_owned = false;
40489         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
40490         uint64_t ret_ref = 0;
40491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40493         return ret_ref;
40494 }
40495
40496 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
40497         LDKInitFeatures this_obj_conv;
40498         this_obj_conv.inner = untag_ptr(this_obj);
40499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40501         InitFeatures_free(this_obj_conv);
40502 }
40503
40504 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
40505         LDKNodeFeatures this_obj_conv;
40506         this_obj_conv.inner = untag_ptr(this_obj);
40507         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40509         NodeFeatures_free(this_obj_conv);
40510 }
40511
40512 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
40513         LDKChannelFeatures this_obj_conv;
40514         this_obj_conv.inner = untag_ptr(this_obj);
40515         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40517         ChannelFeatures_free(this_obj_conv);
40518 }
40519
40520 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
40521         LDKInvoiceFeatures this_obj_conv;
40522         this_obj_conv.inner = untag_ptr(this_obj);
40523         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40525         InvoiceFeatures_free(this_obj_conv);
40526 }
40527
40528 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
40529         LDKOfferFeatures this_obj_conv;
40530         this_obj_conv.inner = untag_ptr(this_obj);
40531         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40533         OfferFeatures_free(this_obj_conv);
40534 }
40535
40536 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
40537         LDKInvoiceRequestFeatures this_obj_conv;
40538         this_obj_conv.inner = untag_ptr(this_obj);
40539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40541         InvoiceRequestFeatures_free(this_obj_conv);
40542 }
40543
40544 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
40545         LDKBolt12InvoiceFeatures this_obj_conv;
40546         this_obj_conv.inner = untag_ptr(this_obj);
40547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40549         Bolt12InvoiceFeatures_free(this_obj_conv);
40550 }
40551
40552 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
40553         LDKBlindedHopFeatures this_obj_conv;
40554         this_obj_conv.inner = untag_ptr(this_obj);
40555         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40557         BlindedHopFeatures_free(this_obj_conv);
40558 }
40559
40560 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
40561         LDKChannelTypeFeatures this_obj_conv;
40562         this_obj_conv.inner = untag_ptr(this_obj);
40563         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40565         ChannelTypeFeatures_free(this_obj_conv);
40566 }
40567
40568 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
40569         LDKInitFeatures ret_var = InitFeatures_empty();
40570         uint64_t ret_ref = 0;
40571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40573         return ret_ref;
40574 }
40575
40576 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
40577         LDKInitFeatures this_arg_conv;
40578         this_arg_conv.inner = untag_ptr(this_arg);
40579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40581         this_arg_conv.is_owned = false;
40582         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
40583         return ret_conv;
40584 }
40585
40586 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
40587         LDKNodeFeatures ret_var = NodeFeatures_empty();
40588         uint64_t ret_ref = 0;
40589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40591         return ret_ref;
40592 }
40593
40594 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
40595         LDKNodeFeatures this_arg_conv;
40596         this_arg_conv.inner = untag_ptr(this_arg);
40597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40599         this_arg_conv.is_owned = false;
40600         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
40601         return ret_conv;
40602 }
40603
40604 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
40605         LDKChannelFeatures ret_var = ChannelFeatures_empty();
40606         uint64_t ret_ref = 0;
40607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40609         return ret_ref;
40610 }
40611
40612 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
40613         LDKChannelFeatures this_arg_conv;
40614         this_arg_conv.inner = untag_ptr(this_arg);
40615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40617         this_arg_conv.is_owned = false;
40618         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
40619         return ret_conv;
40620 }
40621
40622 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
40623         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
40624         uint64_t ret_ref = 0;
40625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40627         return ret_ref;
40628 }
40629
40630 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40631         LDKInvoiceFeatures this_arg_conv;
40632         this_arg_conv.inner = untag_ptr(this_arg);
40633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40635         this_arg_conv.is_owned = false;
40636         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40637         return ret_conv;
40638 }
40639
40640 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
40641         LDKOfferFeatures ret_var = OfferFeatures_empty();
40642         uint64_t ret_ref = 0;
40643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40645         return ret_ref;
40646 }
40647
40648 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
40649         LDKOfferFeatures this_arg_conv;
40650         this_arg_conv.inner = untag_ptr(this_arg);
40651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40653         this_arg_conv.is_owned = false;
40654         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
40655         return ret_conv;
40656 }
40657
40658 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
40659         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
40660         uint64_t ret_ref = 0;
40661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40663         return ret_ref;
40664 }
40665
40666 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
40667         LDKInvoiceRequestFeatures this_arg_conv;
40668         this_arg_conv.inner = untag_ptr(this_arg);
40669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40671         this_arg_conv.is_owned = false;
40672         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
40673         return ret_conv;
40674 }
40675
40676 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
40677         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
40678         uint64_t ret_ref = 0;
40679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40681         return ret_ref;
40682 }
40683
40684 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40685         LDKBolt12InvoiceFeatures this_arg_conv;
40686         this_arg_conv.inner = untag_ptr(this_arg);
40687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40689         this_arg_conv.is_owned = false;
40690         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40691         return ret_conv;
40692 }
40693
40694 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
40695         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
40696         uint64_t ret_ref = 0;
40697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40699         return ret_ref;
40700 }
40701
40702 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
40703         LDKBlindedHopFeatures this_arg_conv;
40704         this_arg_conv.inner = untag_ptr(this_arg);
40705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40707         this_arg_conv.is_owned = false;
40708         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
40709         return ret_conv;
40710 }
40711
40712 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
40713         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
40714         uint64_t ret_ref = 0;
40715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40717         return ret_ref;
40718 }
40719
40720 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
40721         LDKChannelTypeFeatures this_arg_conv;
40722         this_arg_conv.inner = untag_ptr(this_arg);
40723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40725         this_arg_conv.is_owned = false;
40726         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
40727         return ret_conv;
40728 }
40729
40730 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
40731         LDKInitFeatures obj_conv;
40732         obj_conv.inner = untag_ptr(obj);
40733         obj_conv.is_owned = ptr_is_owned(obj);
40734         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40735         obj_conv.is_owned = false;
40736         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
40737         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40738         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40739         CVec_u8Z_free(ret_var);
40740         return ret_arr;
40741 }
40742
40743 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
40744         LDKu8slice ser_ref;
40745         ser_ref.datalen = ser->arr_len;
40746         ser_ref.data = ser->elems;
40747         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
40748         *ret_conv = InitFeatures_read(ser_ref);
40749         FREE(ser);
40750         return tag_ptr(ret_conv, true);
40751 }
40752
40753 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
40754         LDKChannelFeatures obj_conv;
40755         obj_conv.inner = untag_ptr(obj);
40756         obj_conv.is_owned = ptr_is_owned(obj);
40757         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40758         obj_conv.is_owned = false;
40759         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
40760         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40761         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40762         CVec_u8Z_free(ret_var);
40763         return ret_arr;
40764 }
40765
40766 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
40767         LDKu8slice ser_ref;
40768         ser_ref.datalen = ser->arr_len;
40769         ser_ref.data = ser->elems;
40770         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
40771         *ret_conv = ChannelFeatures_read(ser_ref);
40772         FREE(ser);
40773         return tag_ptr(ret_conv, true);
40774 }
40775
40776 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
40777         LDKNodeFeatures obj_conv;
40778         obj_conv.inner = untag_ptr(obj);
40779         obj_conv.is_owned = ptr_is_owned(obj);
40780         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40781         obj_conv.is_owned = false;
40782         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
40783         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40784         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40785         CVec_u8Z_free(ret_var);
40786         return ret_arr;
40787 }
40788
40789 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
40790         LDKu8slice ser_ref;
40791         ser_ref.datalen = ser->arr_len;
40792         ser_ref.data = ser->elems;
40793         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
40794         *ret_conv = NodeFeatures_read(ser_ref);
40795         FREE(ser);
40796         return tag_ptr(ret_conv, true);
40797 }
40798
40799 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
40800         LDKInvoiceFeatures obj_conv;
40801         obj_conv.inner = untag_ptr(obj);
40802         obj_conv.is_owned = ptr_is_owned(obj);
40803         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40804         obj_conv.is_owned = false;
40805         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
40806         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40807         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40808         CVec_u8Z_free(ret_var);
40809         return ret_arr;
40810 }
40811
40812 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
40813         LDKu8slice ser_ref;
40814         ser_ref.datalen = ser->arr_len;
40815         ser_ref.data = ser->elems;
40816         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
40817         *ret_conv = InvoiceFeatures_read(ser_ref);
40818         FREE(ser);
40819         return tag_ptr(ret_conv, true);
40820 }
40821
40822 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
40823         LDKBlindedHopFeatures obj_conv;
40824         obj_conv.inner = untag_ptr(obj);
40825         obj_conv.is_owned = ptr_is_owned(obj);
40826         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40827         obj_conv.is_owned = false;
40828         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
40829         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40830         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40831         CVec_u8Z_free(ret_var);
40832         return ret_arr;
40833 }
40834
40835 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
40836         LDKu8slice ser_ref;
40837         ser_ref.datalen = ser->arr_len;
40838         ser_ref.data = ser->elems;
40839         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
40840         *ret_conv = BlindedHopFeatures_read(ser_ref);
40841         FREE(ser);
40842         return tag_ptr(ret_conv, true);
40843 }
40844
40845 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
40846         LDKChannelTypeFeatures obj_conv;
40847         obj_conv.inner = untag_ptr(obj);
40848         obj_conv.is_owned = ptr_is_owned(obj);
40849         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40850         obj_conv.is_owned = false;
40851         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
40852         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40853         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40854         CVec_u8Z_free(ret_var);
40855         return ret_arr;
40856 }
40857
40858 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
40859         LDKu8slice ser_ref;
40860         ser_ref.datalen = ser->arr_len;
40861         ser_ref.data = ser->elems;
40862         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
40863         *ret_conv = ChannelTypeFeatures_read(ser_ref);
40864         FREE(ser);
40865         return tag_ptr(ret_conv, true);
40866 }
40867
40868 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40869         LDKInitFeatures this_arg_conv;
40870         this_arg_conv.inner = untag_ptr(this_arg);
40871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40873         this_arg_conv.is_owned = false;
40874         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
40875 }
40876
40877 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40878         LDKInitFeatures this_arg_conv;
40879         this_arg_conv.inner = untag_ptr(this_arg);
40880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40882         this_arg_conv.is_owned = false;
40883         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
40884 }
40885
40886 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
40887         LDKInitFeatures this_arg_conv;
40888         this_arg_conv.inner = untag_ptr(this_arg);
40889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40891         this_arg_conv.is_owned = false;
40892         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
40893         return ret_conv;
40894 }
40895
40896 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40897         LDKNodeFeatures this_arg_conv;
40898         this_arg_conv.inner = untag_ptr(this_arg);
40899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40901         this_arg_conv.is_owned = false;
40902         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
40903 }
40904
40905 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40906         LDKNodeFeatures 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         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
40912 }
40913
40914 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
40915         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
40921         return ret_conv;
40922 }
40923
40924 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
40925         LDKInitFeatures this_arg_conv;
40926         this_arg_conv.inner = untag_ptr(this_arg);
40927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40929         this_arg_conv.is_owned = false;
40930         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
40931         return ret_conv;
40932 }
40933
40934 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
40935         LDKNodeFeatures this_arg_conv;
40936         this_arg_conv.inner = untag_ptr(this_arg);
40937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40939         this_arg_conv.is_owned = false;
40940         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
40941         return ret_conv;
40942 }
40943
40944 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
40945         LDKInitFeatures this_arg_conv;
40946         this_arg_conv.inner = untag_ptr(this_arg);
40947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40949         this_arg_conv.is_owned = false;
40950         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40951 }
40952
40953 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
40954         LDKInitFeatures this_arg_conv;
40955         this_arg_conv.inner = untag_ptr(this_arg);
40956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40958         this_arg_conv.is_owned = false;
40959         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40960 }
40961
40962 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
40963         LDKInitFeatures this_arg_conv;
40964         this_arg_conv.inner = untag_ptr(this_arg);
40965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40967         this_arg_conv.is_owned = false;
40968         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40969         return ret_conv;
40970 }
40971
40972 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40973         LDKInitFeatures this_arg_conv;
40974         this_arg_conv.inner = untag_ptr(this_arg);
40975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40977         this_arg_conv.is_owned = false;
40978         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40979 }
40980
40981 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40982         LDKInitFeatures this_arg_conv;
40983         this_arg_conv.inner = untag_ptr(this_arg);
40984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40986         this_arg_conv.is_owned = false;
40987         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40988 }
40989
40990 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40991         LDKInitFeatures this_arg_conv;
40992         this_arg_conv.inner = untag_ptr(this_arg);
40993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40995         this_arg_conv.is_owned = false;
40996         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40997         return ret_conv;
40998 }
40999
41000 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
41001         LDKNodeFeatures this_arg_conv;
41002         this_arg_conv.inner = untag_ptr(this_arg);
41003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41005         this_arg_conv.is_owned = false;
41006         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
41007 }
41008
41009 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
41010         LDKNodeFeatures 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         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
41016 }
41017
41018 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
41019         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
41025         return ret_conv;
41026 }
41027
41028 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
41029         LDKInitFeatures this_arg_conv;
41030         this_arg_conv.inner = untag_ptr(this_arg);
41031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41033         this_arg_conv.is_owned = false;
41034         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41035         return ret_conv;
41036 }
41037
41038 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
41039         LDKNodeFeatures this_arg_conv;
41040         this_arg_conv.inner = untag_ptr(this_arg);
41041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41043         this_arg_conv.is_owned = false;
41044         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41045         return ret_conv;
41046 }
41047
41048 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41049         LDKInitFeatures this_arg_conv;
41050         this_arg_conv.inner = untag_ptr(this_arg);
41051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41053         this_arg_conv.is_owned = false;
41054         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
41055 }
41056
41057 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
41058         LDKInitFeatures this_arg_conv;
41059         this_arg_conv.inner = untag_ptr(this_arg);
41060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41062         this_arg_conv.is_owned = false;
41063         InitFeatures_set_gossip_queries_required(&this_arg_conv);
41064 }
41065
41066 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
41067         LDKInitFeatures this_arg_conv;
41068         this_arg_conv.inner = untag_ptr(this_arg);
41069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41071         this_arg_conv.is_owned = false;
41072         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
41073         return ret_conv;
41074 }
41075
41076 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41077         LDKNodeFeatures this_arg_conv;
41078         this_arg_conv.inner = untag_ptr(this_arg);
41079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41081         this_arg_conv.is_owned = false;
41082         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
41083 }
41084
41085 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
41086         LDKNodeFeatures 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         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
41092 }
41093
41094 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
41095         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
41101         return ret_conv;
41102 }
41103
41104 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
41105         LDKInitFeatures this_arg_conv;
41106         this_arg_conv.inner = untag_ptr(this_arg);
41107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41109         this_arg_conv.is_owned = false;
41110         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
41111         return ret_conv;
41112 }
41113
41114 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
41115         LDKNodeFeatures this_arg_conv;
41116         this_arg_conv.inner = untag_ptr(this_arg);
41117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41119         this_arg_conv.is_owned = false;
41120         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
41121         return ret_conv;
41122 }
41123
41124 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41125         LDKInitFeatures this_arg_conv;
41126         this_arg_conv.inner = untag_ptr(this_arg);
41127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41129         this_arg_conv.is_owned = false;
41130         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
41131 }
41132
41133 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41134         LDKInitFeatures this_arg_conv;
41135         this_arg_conv.inner = untag_ptr(this_arg);
41136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41138         this_arg_conv.is_owned = false;
41139         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
41140 }
41141
41142 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
41143         LDKInitFeatures this_arg_conv;
41144         this_arg_conv.inner = untag_ptr(this_arg);
41145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41147         this_arg_conv.is_owned = false;
41148         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
41149         return ret_conv;
41150 }
41151
41152 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41153         LDKNodeFeatures this_arg_conv;
41154         this_arg_conv.inner = untag_ptr(this_arg);
41155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41157         this_arg_conv.is_owned = false;
41158         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
41159 }
41160
41161 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41162         LDKNodeFeatures this_arg_conv;
41163         this_arg_conv.inner = untag_ptr(this_arg);
41164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41166         this_arg_conv.is_owned = false;
41167         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
41168 }
41169
41170 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
41171         LDKNodeFeatures this_arg_conv;
41172         this_arg_conv.inner = untag_ptr(this_arg);
41173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41175         this_arg_conv.is_owned = false;
41176         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
41177         return ret_conv;
41178 }
41179
41180 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41181         LDKInvoiceFeatures this_arg_conv;
41182         this_arg_conv.inner = untag_ptr(this_arg);
41183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41185         this_arg_conv.is_owned = false;
41186         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
41187 }
41188
41189 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(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         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
41196 }
41197
41198 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
41199         LDKInvoiceFeatures this_arg_conv;
41200         this_arg_conv.inner = untag_ptr(this_arg);
41201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41203         this_arg_conv.is_owned = false;
41204         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
41205         return ret_conv;
41206 }
41207
41208 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(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         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
41215         return ret_conv;
41216 }
41217
41218 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
41219         LDKNodeFeatures this_arg_conv;
41220         this_arg_conv.inner = untag_ptr(this_arg);
41221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41223         this_arg_conv.is_owned = false;
41224         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
41225         return ret_conv;
41226 }
41227
41228 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
41229         LDKInvoiceFeatures this_arg_conv;
41230         this_arg_conv.inner = untag_ptr(this_arg);
41231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41233         this_arg_conv.is_owned = false;
41234         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
41235         return ret_conv;
41236 }
41237
41238 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41239         LDKInitFeatures this_arg_conv;
41240         this_arg_conv.inner = untag_ptr(this_arg);
41241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41243         this_arg_conv.is_owned = false;
41244         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
41245 }
41246
41247 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
41248         LDKInitFeatures this_arg_conv;
41249         this_arg_conv.inner = untag_ptr(this_arg);
41250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41252         this_arg_conv.is_owned = false;
41253         InitFeatures_set_static_remote_key_required(&this_arg_conv);
41254 }
41255
41256 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
41257         LDKInitFeatures this_arg_conv;
41258         this_arg_conv.inner = untag_ptr(this_arg);
41259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41261         this_arg_conv.is_owned = false;
41262         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
41263         return ret_conv;
41264 }
41265
41266 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41267         LDKNodeFeatures this_arg_conv;
41268         this_arg_conv.inner = untag_ptr(this_arg);
41269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41271         this_arg_conv.is_owned = false;
41272         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
41273 }
41274
41275 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41276         LDKNodeFeatures this_arg_conv;
41277         this_arg_conv.inner = untag_ptr(this_arg);
41278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41280         this_arg_conv.is_owned = false;
41281         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
41282 }
41283
41284 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
41285         LDKNodeFeatures this_arg_conv;
41286         this_arg_conv.inner = untag_ptr(this_arg);
41287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41289         this_arg_conv.is_owned = false;
41290         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
41291         return ret_conv;
41292 }
41293
41294 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41295         LDKChannelTypeFeatures this_arg_conv;
41296         this_arg_conv.inner = untag_ptr(this_arg);
41297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41299         this_arg_conv.is_owned = false;
41300         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
41301 }
41302
41303 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(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         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
41310 }
41311
41312 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
41313         LDKChannelTypeFeatures this_arg_conv;
41314         this_arg_conv.inner = untag_ptr(this_arg);
41315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41317         this_arg_conv.is_owned = false;
41318         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
41319         return ret_conv;
41320 }
41321
41322 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(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         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
41329         return ret_conv;
41330 }
41331
41332 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
41333         LDKNodeFeatures this_arg_conv;
41334         this_arg_conv.inner = untag_ptr(this_arg);
41335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41337         this_arg_conv.is_owned = false;
41338         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
41339         return ret_conv;
41340 }
41341
41342 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
41343         LDKChannelTypeFeatures this_arg_conv;
41344         this_arg_conv.inner = untag_ptr(this_arg);
41345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41347         this_arg_conv.is_owned = false;
41348         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
41349         return ret_conv;
41350 }
41351
41352 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
41353         LDKInitFeatures this_arg_conv;
41354         this_arg_conv.inner = untag_ptr(this_arg);
41355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41357         this_arg_conv.is_owned = false;
41358         InitFeatures_set_payment_secret_optional(&this_arg_conv);
41359 }
41360
41361 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
41362         LDKInitFeatures this_arg_conv;
41363         this_arg_conv.inner = untag_ptr(this_arg);
41364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41366         this_arg_conv.is_owned = false;
41367         InitFeatures_set_payment_secret_required(&this_arg_conv);
41368 }
41369
41370 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
41371         LDKInitFeatures this_arg_conv;
41372         this_arg_conv.inner = untag_ptr(this_arg);
41373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41375         this_arg_conv.is_owned = false;
41376         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
41377         return ret_conv;
41378 }
41379
41380 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
41381         LDKNodeFeatures this_arg_conv;
41382         this_arg_conv.inner = untag_ptr(this_arg);
41383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41385         this_arg_conv.is_owned = false;
41386         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
41387 }
41388
41389 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
41390         LDKNodeFeatures this_arg_conv;
41391         this_arg_conv.inner = untag_ptr(this_arg);
41392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41394         this_arg_conv.is_owned = false;
41395         NodeFeatures_set_payment_secret_required(&this_arg_conv);
41396 }
41397
41398 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
41399         LDKNodeFeatures this_arg_conv;
41400         this_arg_conv.inner = untag_ptr(this_arg);
41401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41403         this_arg_conv.is_owned = false;
41404         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
41405         return ret_conv;
41406 }
41407
41408 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
41409         LDKInvoiceFeatures this_arg_conv;
41410         this_arg_conv.inner = untag_ptr(this_arg);
41411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41413         this_arg_conv.is_owned = false;
41414         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
41415 }
41416
41417 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(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         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
41424 }
41425
41426 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
41427         LDKInvoiceFeatures this_arg_conv;
41428         this_arg_conv.inner = untag_ptr(this_arg);
41429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41431         this_arg_conv.is_owned = false;
41432         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
41433         return ret_conv;
41434 }
41435
41436 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(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         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
41443         return ret_conv;
41444 }
41445
41446 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
41447         LDKNodeFeatures this_arg_conv;
41448         this_arg_conv.inner = untag_ptr(this_arg);
41449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41451         this_arg_conv.is_owned = false;
41452         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
41453         return ret_conv;
41454 }
41455
41456 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
41457         LDKInvoiceFeatures this_arg_conv;
41458         this_arg_conv.inner = untag_ptr(this_arg);
41459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41461         this_arg_conv.is_owned = false;
41462         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
41463         return ret_conv;
41464 }
41465
41466 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41467         LDKInitFeatures this_arg_conv;
41468         this_arg_conv.inner = untag_ptr(this_arg);
41469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41471         this_arg_conv.is_owned = false;
41472         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
41473 }
41474
41475 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
41476         LDKInitFeatures this_arg_conv;
41477         this_arg_conv.inner = untag_ptr(this_arg);
41478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41480         this_arg_conv.is_owned = false;
41481         InitFeatures_set_basic_mpp_required(&this_arg_conv);
41482 }
41483
41484 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
41485         LDKInitFeatures this_arg_conv;
41486         this_arg_conv.inner = untag_ptr(this_arg);
41487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41489         this_arg_conv.is_owned = false;
41490         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
41491         return ret_conv;
41492 }
41493
41494 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41495         LDKNodeFeatures this_arg_conv;
41496         this_arg_conv.inner = untag_ptr(this_arg);
41497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41499         this_arg_conv.is_owned = false;
41500         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
41501 }
41502
41503 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
41504         LDKNodeFeatures this_arg_conv;
41505         this_arg_conv.inner = untag_ptr(this_arg);
41506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41508         this_arg_conv.is_owned = false;
41509         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
41510 }
41511
41512 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
41513         LDKNodeFeatures this_arg_conv;
41514         this_arg_conv.inner = untag_ptr(this_arg);
41515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41517         this_arg_conv.is_owned = false;
41518         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
41519         return ret_conv;
41520 }
41521
41522 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41523         LDKInvoiceFeatures this_arg_conv;
41524         this_arg_conv.inner = untag_ptr(this_arg);
41525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41527         this_arg_conv.is_owned = false;
41528         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41529 }
41530
41531 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41532         LDKInvoiceFeatures this_arg_conv;
41533         this_arg_conv.inner = untag_ptr(this_arg);
41534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41536         this_arg_conv.is_owned = false;
41537         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41538 }
41539
41540 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41541         LDKInvoiceFeatures this_arg_conv;
41542         this_arg_conv.inner = untag_ptr(this_arg);
41543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41545         this_arg_conv.is_owned = false;
41546         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41547         return ret_conv;
41548 }
41549
41550 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41551         LDKBolt12InvoiceFeatures this_arg_conv;
41552         this_arg_conv.inner = untag_ptr(this_arg);
41553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41555         this_arg_conv.is_owned = false;
41556         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41557 }
41558
41559 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41560         LDKBolt12InvoiceFeatures 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         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41566 }
41567
41568 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41569         LDKBolt12InvoiceFeatures this_arg_conv;
41570         this_arg_conv.inner = untag_ptr(this_arg);
41571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41573         this_arg_conv.is_owned = false;
41574         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41575         return ret_conv;
41576 }
41577
41578 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
41579         LDKInitFeatures this_arg_conv;
41580         this_arg_conv.inner = untag_ptr(this_arg);
41581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41583         this_arg_conv.is_owned = false;
41584         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
41585         return ret_conv;
41586 }
41587
41588 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
41589         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
41595         return ret_conv;
41596 }
41597
41598 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41599         LDKInvoiceFeatures this_arg_conv;
41600         this_arg_conv.inner = untag_ptr(this_arg);
41601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41603         this_arg_conv.is_owned = false;
41604         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41605         return ret_conv;
41606 }
41607
41608 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41609         LDKBolt12InvoiceFeatures this_arg_conv;
41610         this_arg_conv.inner = untag_ptr(this_arg);
41611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41613         this_arg_conv.is_owned = false;
41614         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41615         return ret_conv;
41616 }
41617
41618 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
41619         LDKInitFeatures this_arg_conv;
41620         this_arg_conv.inner = untag_ptr(this_arg);
41621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41623         this_arg_conv.is_owned = false;
41624         InitFeatures_set_wumbo_optional(&this_arg_conv);
41625 }
41626
41627 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
41628         LDKInitFeatures this_arg_conv;
41629         this_arg_conv.inner = untag_ptr(this_arg);
41630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41632         this_arg_conv.is_owned = false;
41633         InitFeatures_set_wumbo_required(&this_arg_conv);
41634 }
41635
41636 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
41637         LDKInitFeatures this_arg_conv;
41638         this_arg_conv.inner = untag_ptr(this_arg);
41639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41641         this_arg_conv.is_owned = false;
41642         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
41643         return ret_conv;
41644 }
41645
41646 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
41647         LDKNodeFeatures this_arg_conv;
41648         this_arg_conv.inner = untag_ptr(this_arg);
41649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41651         this_arg_conv.is_owned = false;
41652         NodeFeatures_set_wumbo_optional(&this_arg_conv);
41653 }
41654
41655 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
41656         LDKNodeFeatures 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         NodeFeatures_set_wumbo_required(&this_arg_conv);
41662 }
41663
41664 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
41665         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
41671         return ret_conv;
41672 }
41673
41674 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
41675         LDKInitFeatures this_arg_conv;
41676         this_arg_conv.inner = untag_ptr(this_arg);
41677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41679         this_arg_conv.is_owned = false;
41680         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
41681         return ret_conv;
41682 }
41683
41684 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
41685         LDKNodeFeatures this_arg_conv;
41686         this_arg_conv.inner = untag_ptr(this_arg);
41687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41689         this_arg_conv.is_owned = false;
41690         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
41691         return ret_conv;
41692 }
41693
41694 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) {
41695         LDKInitFeatures this_arg_conv;
41696         this_arg_conv.inner = untag_ptr(this_arg);
41697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41699         this_arg_conv.is_owned = false;
41700         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41701 }
41702
41703 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) {
41704         LDKInitFeatures this_arg_conv;
41705         this_arg_conv.inner = untag_ptr(this_arg);
41706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41708         this_arg_conv.is_owned = false;
41709         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41710 }
41711
41712 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41713         LDKInitFeatures this_arg_conv;
41714         this_arg_conv.inner = untag_ptr(this_arg);
41715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41717         this_arg_conv.is_owned = false;
41718         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41719         return ret_conv;
41720 }
41721
41722 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) {
41723         LDKNodeFeatures this_arg_conv;
41724         this_arg_conv.inner = untag_ptr(this_arg);
41725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41727         this_arg_conv.is_owned = false;
41728         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41729 }
41730
41731 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) {
41732         LDKNodeFeatures this_arg_conv;
41733         this_arg_conv.inner = untag_ptr(this_arg);
41734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41736         this_arg_conv.is_owned = false;
41737         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41738 }
41739
41740 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41741         LDKNodeFeatures this_arg_conv;
41742         this_arg_conv.inner = untag_ptr(this_arg);
41743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41745         this_arg_conv.is_owned = false;
41746         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41747         return ret_conv;
41748 }
41749
41750 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) {
41751         LDKChannelTypeFeatures this_arg_conv;
41752         this_arg_conv.inner = untag_ptr(this_arg);
41753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41755         this_arg_conv.is_owned = false;
41756         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41757 }
41758
41759 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) {
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         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41766 }
41767
41768 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41769         LDKChannelTypeFeatures this_arg_conv;
41770         this_arg_conv.inner = untag_ptr(this_arg);
41771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41773         this_arg_conv.is_owned = false;
41774         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41775         return ret_conv;
41776 }
41777
41778 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(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         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41785         return ret_conv;
41786 }
41787
41788 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41789         LDKNodeFeatures this_arg_conv;
41790         this_arg_conv.inner = untag_ptr(this_arg);
41791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41793         this_arg_conv.is_owned = false;
41794         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41795         return ret_conv;
41796 }
41797
41798 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41799         LDKChannelTypeFeatures this_arg_conv;
41800         this_arg_conv.inner = untag_ptr(this_arg);
41801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41803         this_arg_conv.is_owned = false;
41804         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41805         return ret_conv;
41806 }
41807
41808 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41809         LDKInitFeatures this_arg_conv;
41810         this_arg_conv.inner = untag_ptr(this_arg);
41811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41813         this_arg_conv.is_owned = false;
41814         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41815 }
41816
41817 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41818         LDKInitFeatures this_arg_conv;
41819         this_arg_conv.inner = untag_ptr(this_arg);
41820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41822         this_arg_conv.is_owned = false;
41823         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41824 }
41825
41826 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41827         LDKInitFeatures this_arg_conv;
41828         this_arg_conv.inner = untag_ptr(this_arg);
41829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41831         this_arg_conv.is_owned = false;
41832         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41833         return ret_conv;
41834 }
41835
41836 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41837         LDKNodeFeatures this_arg_conv;
41838         this_arg_conv.inner = untag_ptr(this_arg);
41839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41841         this_arg_conv.is_owned = false;
41842         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41843 }
41844
41845 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41846         LDKNodeFeatures 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         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41852 }
41853
41854 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41855         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41861         return ret_conv;
41862 }
41863
41864 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41865         LDKInitFeatures this_arg_conv;
41866         this_arg_conv.inner = untag_ptr(this_arg);
41867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41869         this_arg_conv.is_owned = false;
41870         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41871         return ret_conv;
41872 }
41873
41874 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41875         LDKNodeFeatures this_arg_conv;
41876         this_arg_conv.inner = untag_ptr(this_arg);
41877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41879         this_arg_conv.is_owned = false;
41880         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41881         return ret_conv;
41882 }
41883
41884 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
41885         LDKInitFeatures this_arg_conv;
41886         this_arg_conv.inner = untag_ptr(this_arg);
41887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41889         this_arg_conv.is_owned = false;
41890         InitFeatures_set_onion_messages_optional(&this_arg_conv);
41891 }
41892
41893 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
41894         LDKInitFeatures this_arg_conv;
41895         this_arg_conv.inner = untag_ptr(this_arg);
41896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41898         this_arg_conv.is_owned = false;
41899         InitFeatures_set_onion_messages_required(&this_arg_conv);
41900 }
41901
41902 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
41903         LDKInitFeatures this_arg_conv;
41904         this_arg_conv.inner = untag_ptr(this_arg);
41905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41907         this_arg_conv.is_owned = false;
41908         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
41909         return ret_conv;
41910 }
41911
41912 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
41913         LDKNodeFeatures this_arg_conv;
41914         this_arg_conv.inner = untag_ptr(this_arg);
41915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41917         this_arg_conv.is_owned = false;
41918         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
41919 }
41920
41921 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
41922         LDKNodeFeatures 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         NodeFeatures_set_onion_messages_required(&this_arg_conv);
41928 }
41929
41930 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
41931         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
41937         return ret_conv;
41938 }
41939
41940 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
41941         LDKInitFeatures this_arg_conv;
41942         this_arg_conv.inner = untag_ptr(this_arg);
41943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41945         this_arg_conv.is_owned = false;
41946         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
41947         return ret_conv;
41948 }
41949
41950 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
41951         LDKNodeFeatures this_arg_conv;
41952         this_arg_conv.inner = untag_ptr(this_arg);
41953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41955         this_arg_conv.is_owned = false;
41956         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
41957         return ret_conv;
41958 }
41959
41960 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
41961         LDKInitFeatures this_arg_conv;
41962         this_arg_conv.inner = untag_ptr(this_arg);
41963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41965         this_arg_conv.is_owned = false;
41966         InitFeatures_set_channel_type_optional(&this_arg_conv);
41967 }
41968
41969 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
41970         LDKInitFeatures this_arg_conv;
41971         this_arg_conv.inner = untag_ptr(this_arg);
41972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41974         this_arg_conv.is_owned = false;
41975         InitFeatures_set_channel_type_required(&this_arg_conv);
41976 }
41977
41978 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
41979         LDKInitFeatures this_arg_conv;
41980         this_arg_conv.inner = untag_ptr(this_arg);
41981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41983         this_arg_conv.is_owned = false;
41984         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
41985         return ret_conv;
41986 }
41987
41988 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
41989         LDKNodeFeatures this_arg_conv;
41990         this_arg_conv.inner = untag_ptr(this_arg);
41991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41993         this_arg_conv.is_owned = false;
41994         NodeFeatures_set_channel_type_optional(&this_arg_conv);
41995 }
41996
41997 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
41998         LDKNodeFeatures 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         NodeFeatures_set_channel_type_required(&this_arg_conv);
42004 }
42005
42006 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
42007         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
42013         return ret_conv;
42014 }
42015
42016 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
42017         LDKInitFeatures this_arg_conv;
42018         this_arg_conv.inner = untag_ptr(this_arg);
42019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42021         this_arg_conv.is_owned = false;
42022         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
42023         return ret_conv;
42024 }
42025
42026 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
42027         LDKNodeFeatures this_arg_conv;
42028         this_arg_conv.inner = untag_ptr(this_arg);
42029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42031         this_arg_conv.is_owned = false;
42032         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
42033         return ret_conv;
42034 }
42035
42036 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42037         LDKInitFeatures this_arg_conv;
42038         this_arg_conv.inner = untag_ptr(this_arg);
42039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42041         this_arg_conv.is_owned = false;
42042         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
42043 }
42044
42045 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
42046         LDKInitFeatures this_arg_conv;
42047         this_arg_conv.inner = untag_ptr(this_arg);
42048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42050         this_arg_conv.is_owned = false;
42051         InitFeatures_set_scid_privacy_required(&this_arg_conv);
42052 }
42053
42054 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
42055         LDKInitFeatures this_arg_conv;
42056         this_arg_conv.inner = untag_ptr(this_arg);
42057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42059         this_arg_conv.is_owned = false;
42060         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
42061         return ret_conv;
42062 }
42063
42064 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42065         LDKNodeFeatures this_arg_conv;
42066         this_arg_conv.inner = untag_ptr(this_arg);
42067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42069         this_arg_conv.is_owned = false;
42070         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
42071 }
42072
42073 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42074         LDKNodeFeatures this_arg_conv;
42075         this_arg_conv.inner = untag_ptr(this_arg);
42076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42078         this_arg_conv.is_owned = false;
42079         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
42080 }
42081
42082 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
42083         LDKNodeFeatures this_arg_conv;
42084         this_arg_conv.inner = untag_ptr(this_arg);
42085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42087         this_arg_conv.is_owned = false;
42088         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
42089         return ret_conv;
42090 }
42091
42092 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42093         LDKChannelTypeFeatures this_arg_conv;
42094         this_arg_conv.inner = untag_ptr(this_arg);
42095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42097         this_arg_conv.is_owned = false;
42098         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
42099 }
42100
42101 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(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         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
42108 }
42109
42110 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
42111         LDKChannelTypeFeatures this_arg_conv;
42112         this_arg_conv.inner = untag_ptr(this_arg);
42113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42115         this_arg_conv.is_owned = false;
42116         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
42117         return ret_conv;
42118 }
42119
42120 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
42121         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
42127         return ret_conv;
42128 }
42129
42130 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
42131         LDKNodeFeatures this_arg_conv;
42132         this_arg_conv.inner = untag_ptr(this_arg);
42133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42135         this_arg_conv.is_owned = false;
42136         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
42137         return ret_conv;
42138 }
42139
42140 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
42141         LDKChannelTypeFeatures this_arg_conv;
42142         this_arg_conv.inner = untag_ptr(this_arg);
42143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42145         this_arg_conv.is_owned = false;
42146         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
42147         return ret_conv;
42148 }
42149
42150 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
42151         LDKInitFeatures this_arg_conv;
42152         this_arg_conv.inner = untag_ptr(this_arg);
42153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42155         this_arg_conv.is_owned = false;
42156         InitFeatures_set_zero_conf_optional(&this_arg_conv);
42157 }
42158
42159 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
42160         LDKInitFeatures this_arg_conv;
42161         this_arg_conv.inner = untag_ptr(this_arg);
42162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42164         this_arg_conv.is_owned = false;
42165         InitFeatures_set_zero_conf_required(&this_arg_conv);
42166 }
42167
42168 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
42169         LDKInitFeatures this_arg_conv;
42170         this_arg_conv.inner = untag_ptr(this_arg);
42171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42173         this_arg_conv.is_owned = false;
42174         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
42175         return ret_conv;
42176 }
42177
42178 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42179         LDKNodeFeatures this_arg_conv;
42180         this_arg_conv.inner = untag_ptr(this_arg);
42181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42183         this_arg_conv.is_owned = false;
42184         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
42185 }
42186
42187 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
42188         LDKNodeFeatures this_arg_conv;
42189         this_arg_conv.inner = untag_ptr(this_arg);
42190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42192         this_arg_conv.is_owned = false;
42193         NodeFeatures_set_zero_conf_required(&this_arg_conv);
42194 }
42195
42196 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
42197         LDKNodeFeatures this_arg_conv;
42198         this_arg_conv.inner = untag_ptr(this_arg);
42199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42201         this_arg_conv.is_owned = false;
42202         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
42203         return ret_conv;
42204 }
42205
42206 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42207         LDKChannelTypeFeatures this_arg_conv;
42208         this_arg_conv.inner = untag_ptr(this_arg);
42209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42211         this_arg_conv.is_owned = false;
42212         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
42213 }
42214
42215 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
42216         LDKChannelTypeFeatures this_arg_conv;
42217         this_arg_conv.inner = untag_ptr(this_arg);
42218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42220         this_arg_conv.is_owned = false;
42221         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
42222 }
42223
42224 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
42225         LDKChannelTypeFeatures this_arg_conv;
42226         this_arg_conv.inner = untag_ptr(this_arg);
42227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42229         this_arg_conv.is_owned = false;
42230         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
42231         return ret_conv;
42232 }
42233
42234 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
42235         LDKInitFeatures this_arg_conv;
42236         this_arg_conv.inner = untag_ptr(this_arg);
42237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42239         this_arg_conv.is_owned = false;
42240         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
42241         return ret_conv;
42242 }
42243
42244 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
42245         LDKNodeFeatures this_arg_conv;
42246         this_arg_conv.inner = untag_ptr(this_arg);
42247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42249         this_arg_conv.is_owned = false;
42250         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
42251         return ret_conv;
42252 }
42253
42254 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
42255         LDKChannelTypeFeatures this_arg_conv;
42256         this_arg_conv.inner = untag_ptr(this_arg);
42257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42259         this_arg_conv.is_owned = false;
42260         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
42261         return ret_conv;
42262 }
42263
42264 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
42265         LDKNodeFeatures this_arg_conv;
42266         this_arg_conv.inner = untag_ptr(this_arg);
42267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42269         this_arg_conv.is_owned = false;
42270         NodeFeatures_set_keysend_optional(&this_arg_conv);
42271 }
42272
42273 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
42274         LDKNodeFeatures this_arg_conv;
42275         this_arg_conv.inner = untag_ptr(this_arg);
42276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42278         this_arg_conv.is_owned = false;
42279         NodeFeatures_set_keysend_required(&this_arg_conv);
42280 }
42281
42282 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
42283         LDKNodeFeatures this_arg_conv;
42284         this_arg_conv.inner = untag_ptr(this_arg);
42285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42287         this_arg_conv.is_owned = false;
42288         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
42289         return ret_conv;
42290 }
42291
42292 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
42293         LDKNodeFeatures this_arg_conv;
42294         this_arg_conv.inner = untag_ptr(this_arg);
42295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42297         this_arg_conv.is_owned = false;
42298         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
42299         return ret_conv;
42300 }
42301
42302 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
42303         LDKShutdownScript this_obj_conv;
42304         this_obj_conv.inner = untag_ptr(this_obj);
42305         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42307         ShutdownScript_free(this_obj_conv);
42308 }
42309
42310 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
42311         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
42312         uint64_t ret_ref = 0;
42313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42315         return ret_ref;
42316 }
42317 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
42318         LDKShutdownScript arg_conv;
42319         arg_conv.inner = untag_ptr(arg);
42320         arg_conv.is_owned = ptr_is_owned(arg);
42321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42322         arg_conv.is_owned = false;
42323         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
42324         return ret_conv;
42325 }
42326
42327 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
42328         LDKShutdownScript orig_conv;
42329         orig_conv.inner = untag_ptr(orig);
42330         orig_conv.is_owned = ptr_is_owned(orig);
42331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42332         orig_conv.is_owned = false;
42333         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
42334         uint64_t ret_ref = 0;
42335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42337         return ret_ref;
42338 }
42339
42340 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
42341         LDKShutdownScript a_conv;
42342         a_conv.inner = untag_ptr(a);
42343         a_conv.is_owned = ptr_is_owned(a);
42344         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42345         a_conv.is_owned = false;
42346         LDKShutdownScript b_conv;
42347         b_conv.inner = untag_ptr(b);
42348         b_conv.is_owned = ptr_is_owned(b);
42349         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42350         b_conv.is_owned = false;
42351         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
42352         return ret_conv;
42353 }
42354
42355 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
42356         LDKInvalidShutdownScript this_obj_conv;
42357         this_obj_conv.inner = untag_ptr(this_obj);
42358         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42360         InvalidShutdownScript_free(this_obj_conv);
42361 }
42362
42363 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
42364         LDKInvalidShutdownScript this_ptr_conv;
42365         this_ptr_conv.inner = untag_ptr(this_ptr);
42366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42368         this_ptr_conv.is_owned = false;
42369         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
42370         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42371         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42372         return ret_arr;
42373 }
42374
42375 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
42376         LDKInvalidShutdownScript this_ptr_conv;
42377         this_ptr_conv.inner = untag_ptr(this_ptr);
42378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42380         this_ptr_conv.is_owned = false;
42381         LDKCVec_u8Z val_ref;
42382         val_ref.datalen = val->arr_len;
42383         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42384         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
42385         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
42386 }
42387
42388 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
42389         LDKCVec_u8Z script_arg_ref;
42390         script_arg_ref.datalen = script_arg->arr_len;
42391         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42392         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
42393         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
42394         uint64_t ret_ref = 0;
42395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42397         return ret_ref;
42398 }
42399
42400 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
42401         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
42402         uint64_t ret_ref = 0;
42403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42405         return ret_ref;
42406 }
42407 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
42408         LDKInvalidShutdownScript arg_conv;
42409         arg_conv.inner = untag_ptr(arg);
42410         arg_conv.is_owned = ptr_is_owned(arg);
42411         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42412         arg_conv.is_owned = false;
42413         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
42414         return ret_conv;
42415 }
42416
42417 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
42418         LDKInvalidShutdownScript orig_conv;
42419         orig_conv.inner = untag_ptr(orig);
42420         orig_conv.is_owned = ptr_is_owned(orig);
42421         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42422         orig_conv.is_owned = false;
42423         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
42424         uint64_t ret_ref = 0;
42425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42427         return ret_ref;
42428 }
42429
42430 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
42431         LDKShutdownScript obj_conv;
42432         obj_conv.inner = untag_ptr(obj);
42433         obj_conv.is_owned = ptr_is_owned(obj);
42434         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42435         obj_conv.is_owned = false;
42436         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
42437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42439         CVec_u8Z_free(ret_var);
42440         return ret_arr;
42441 }
42442
42443 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
42444         LDKu8slice ser_ref;
42445         ser_ref.datalen = ser->arr_len;
42446         ser_ref.data = ser->elems;
42447         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
42448         *ret_conv = ShutdownScript_read(ser_ref);
42449         FREE(ser);
42450         return tag_ptr(ret_conv, true);
42451 }
42452
42453 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
42454         uint8_t pubkey_hash_arr[20];
42455         CHECK(pubkey_hash->arr_len == 20);
42456         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
42457         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
42458         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
42459         uint64_t ret_ref = 0;
42460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42462         return ret_ref;
42463 }
42464
42465 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
42466         uint8_t script_hash_arr[32];
42467         CHECK(script_hash->arr_len == 32);
42468         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
42469         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
42470         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
42471         uint64_t ret_ref = 0;
42472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42474         return ret_ref;
42475 }
42476
42477 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
42478         
42479         LDKu8slice program_ref;
42480         program_ref.datalen = program->arr_len;
42481         program_ref.data = program->elems;
42482         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
42483         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
42484         FREE(program);
42485         return tag_ptr(ret_conv, true);
42486 }
42487
42488 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
42489         LDKShutdownScript this_arg_conv;
42490         this_arg_conv.inner = untag_ptr(this_arg);
42491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42493         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
42494         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
42495         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42496         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42497         CVec_u8Z_free(ret_var);
42498         return ret_arr;
42499 }
42500
42501 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
42502         LDKShutdownScript this_arg_conv;
42503         this_arg_conv.inner = untag_ptr(this_arg);
42504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42506         this_arg_conv.is_owned = false;
42507         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42508         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
42509         return ret_arr;
42510 }
42511
42512 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
42513         LDKShutdownScript this_arg_conv;
42514         this_arg_conv.inner = untag_ptr(this_arg);
42515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42517         this_arg_conv.is_owned = false;
42518         LDKInitFeatures features_conv;
42519         features_conv.inner = untag_ptr(features);
42520         features_conv.is_owned = ptr_is_owned(features);
42521         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42522         features_conv.is_owned = false;
42523         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
42524         return ret_conv;
42525 }
42526
42527 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
42528         if (!ptr_is_owned(this_ptr)) return;
42529         void* this_ptr_ptr = untag_ptr(this_ptr);
42530         CHECK_ACCESS(this_ptr_ptr);
42531         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
42532         FREE(untag_ptr(this_ptr));
42533         Retry_free(this_ptr_conv);
42534 }
42535
42536 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
42537         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42538         *ret_copy = Retry_clone(arg);
42539         uint64_t ret_ref = tag_ptr(ret_copy, true);
42540         return ret_ref;
42541 }
42542 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
42543         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
42544         int64_t ret_conv = Retry_clone_ptr(arg_conv);
42545         return ret_conv;
42546 }
42547
42548 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
42549         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
42550         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42551         *ret_copy = Retry_clone(orig_conv);
42552         uint64_t ret_ref = tag_ptr(ret_copy, true);
42553         return ret_ref;
42554 }
42555
42556 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
42557         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42558         *ret_copy = Retry_attempts(a);
42559         uint64_t ret_ref = tag_ptr(ret_copy, true);
42560         return ret_ref;
42561 }
42562
42563 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
42564         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
42565         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
42566         jboolean ret_conv = Retry_eq(a_conv, b_conv);
42567         return ret_conv;
42568 }
42569
42570 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
42571         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
42572         int64_t ret_conv = Retry_hash(o_conv);
42573         return ret_conv;
42574 }
42575
42576 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
42577         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
42578         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
42579         return ret_conv;
42580 }
42581
42582 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
42583         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
42584         return ret_conv;
42585 }
42586
42587 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
42588         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
42589         return ret_conv;
42590 }
42591
42592 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
42593         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
42594         return ret_conv;
42595 }
42596
42597 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
42598         if (!ptr_is_owned(this_ptr)) return;
42599         void* this_ptr_ptr = untag_ptr(this_ptr);
42600         CHECK_ACCESS(this_ptr_ptr);
42601         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
42602         FREE(untag_ptr(this_ptr));
42603         PaymentSendFailure_free(this_ptr_conv);
42604 }
42605
42606 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
42607         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42608         *ret_copy = PaymentSendFailure_clone(arg);
42609         uint64_t ret_ref = tag_ptr(ret_copy, true);
42610         return ret_ref;
42611 }
42612 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
42613         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
42614         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
42615         return ret_conv;
42616 }
42617
42618 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
42619         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
42620         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42621         *ret_copy = PaymentSendFailure_clone(orig_conv);
42622         uint64_t ret_ref = tag_ptr(ret_copy, true);
42623         return ret_ref;
42624 }
42625
42626 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
42627         void* a_ptr = untag_ptr(a);
42628         CHECK_ACCESS(a_ptr);
42629         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
42630         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
42631         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42632         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
42633         uint64_t ret_ref = tag_ptr(ret_copy, true);
42634         return ret_ref;
42635 }
42636
42637 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
42638         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
42639         a_constr.datalen = a->arr_len;
42640         if (a_constr.datalen > 0)
42641                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42642         else
42643                 a_constr.data = NULL;
42644         uint64_t* a_vals = a->elems;
42645         for (size_t w = 0; w < a_constr.datalen; w++) {
42646                 uint64_t a_conv_22 = a_vals[w];
42647                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
42648                 CHECK_ACCESS(a_conv_22_ptr);
42649                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
42650                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
42651                 a_constr.data[w] = a_conv_22_conv;
42652         }
42653         FREE(a);
42654         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42655         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
42656         uint64_t ret_ref = tag_ptr(ret_copy, true);
42657         return ret_ref;
42658 }
42659
42660 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
42661         LDKCVec_APIErrorZ a_constr;
42662         a_constr.datalen = a->arr_len;
42663         if (a_constr.datalen > 0)
42664                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
42665         else
42666                 a_constr.data = NULL;
42667         uint64_t* a_vals = a->elems;
42668         for (size_t k = 0; k < a_constr.datalen; k++) {
42669                 uint64_t a_conv_10 = a_vals[k];
42670                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
42671                 CHECK_ACCESS(a_conv_10_ptr);
42672                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
42673                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
42674                 a_constr.data[k] = a_conv_10_conv;
42675         }
42676         FREE(a);
42677         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42678         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
42679         uint64_t ret_ref = tag_ptr(ret_copy, true);
42680         return ret_ref;
42681 }
42682
42683 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
42684         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42685         *ret_copy = PaymentSendFailure_duplicate_payment();
42686         uint64_t ret_ref = tag_ptr(ret_copy, true);
42687         return ret_ref;
42688 }
42689
42690 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) {
42691         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
42692         results_constr.datalen = results->arr_len;
42693         if (results_constr.datalen > 0)
42694                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42695         else
42696                 results_constr.data = NULL;
42697         uint64_t* results_vals = results->elems;
42698         for (size_t w = 0; w < results_constr.datalen; w++) {
42699                 uint64_t results_conv_22 = results_vals[w];
42700                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
42701                 CHECK_ACCESS(results_conv_22_ptr);
42702                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
42703                 results_constr.data[w] = results_conv_22_conv;
42704         }
42705         FREE(results);
42706         LDKRouteParameters failed_paths_retry_conv;
42707         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
42708         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
42709         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
42710         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
42711         LDKThirtyTwoBytes payment_id_ref;
42712         CHECK(payment_id->arr_len == 32);
42713         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42714         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42715         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
42716         uint64_t ret_ref = tag_ptr(ret_copy, true);
42717         return ret_ref;
42718 }
42719
42720 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
42721         if (!ptr_is_owned(this_ptr)) return;
42722         void* this_ptr_ptr = untag_ptr(this_ptr);
42723         CHECK_ACCESS(this_ptr_ptr);
42724         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
42725         FREE(untag_ptr(this_ptr));
42726         CustomMessageReader_free(this_ptr_conv);
42727 }
42728
42729 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
42730         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42731         *ret_ret = Type_clone(arg);
42732         return tag_ptr(ret_ret, true);
42733 }
42734 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
42735         void* arg_ptr = untag_ptr(arg);
42736         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
42737         LDKType* arg_conv = (LDKType*)arg_ptr;
42738         int64_t ret_conv = Type_clone_ptr(arg_conv);
42739         return ret_conv;
42740 }
42741
42742 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
42743         void* orig_ptr = untag_ptr(orig);
42744         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
42745         LDKType* orig_conv = (LDKType*)orig_ptr;
42746         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42747         *ret_ret = Type_clone(orig_conv);
42748         return tag_ptr(ret_ret, true);
42749 }
42750
42751 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
42752         if (!ptr_is_owned(this_ptr)) return;
42753         void* this_ptr_ptr = untag_ptr(this_ptr);
42754         CHECK_ACCESS(this_ptr_ptr);
42755         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
42756         FREE(untag_ptr(this_ptr));
42757         Type_free(this_ptr_conv);
42758 }
42759
42760 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
42761         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
42762         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
42763         return ret_conv;
42764 }
42765
42766 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
42767         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
42768         return ret_conv;
42769 }
42770
42771 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
42772         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
42773         return ret_conv;
42774 }
42775
42776 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
42777         if (!ptr_is_owned(this_ptr)) return;
42778         void* this_ptr_ptr = untag_ptr(this_ptr);
42779         CHECK_ACCESS(this_ptr_ptr);
42780         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
42781         FREE(untag_ptr(this_ptr));
42782         UtxoResult_free(this_ptr_conv);
42783 }
42784
42785 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
42786         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
42787         *ret_copy = UtxoResult_clone(arg);
42788         uint64_t ret_ref = tag_ptr(ret_copy, true);
42789         return ret_ref;
42790 }
42791 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
42792         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
42793         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
42794         return ret_conv;
42795 }
42796
42797 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
42798         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
42799         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
42800         *ret_copy = UtxoResult_clone(orig_conv);
42801         uint64_t ret_ref = tag_ptr(ret_copy, true);
42802         return ret_ref;
42803 }
42804
42805 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
42806         void* a_ptr = untag_ptr(a);
42807         CHECK_ACCESS(a_ptr);
42808         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
42809         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
42810         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
42811         *ret_copy = UtxoResult_sync(a_conv);
42812         uint64_t ret_ref = tag_ptr(ret_copy, true);
42813         return ret_ref;
42814 }
42815
42816 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
42817         LDKUtxoFuture a_conv;
42818         a_conv.inner = untag_ptr(a);
42819         a_conv.is_owned = ptr_is_owned(a);
42820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42821         a_conv = UtxoFuture_clone(&a_conv);
42822         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
42823         *ret_copy = UtxoResult_async(a_conv);
42824         uint64_t ret_ref = tag_ptr(ret_copy, true);
42825         return ret_ref;
42826 }
42827
42828 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
42829         if (!ptr_is_owned(this_ptr)) return;
42830         void* this_ptr_ptr = untag_ptr(this_ptr);
42831         CHECK_ACCESS(this_ptr_ptr);
42832         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
42833         FREE(untag_ptr(this_ptr));
42834         UtxoLookup_free(this_ptr_conv);
42835 }
42836
42837 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
42838         LDKUtxoFuture this_obj_conv;
42839         this_obj_conv.inner = untag_ptr(this_obj);
42840         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42842         UtxoFuture_free(this_obj_conv);
42843 }
42844
42845 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
42846         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
42847         uint64_t ret_ref = 0;
42848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42850         return ret_ref;
42851 }
42852 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
42853         LDKUtxoFuture arg_conv;
42854         arg_conv.inner = untag_ptr(arg);
42855         arg_conv.is_owned = ptr_is_owned(arg);
42856         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42857         arg_conv.is_owned = false;
42858         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
42859         return ret_conv;
42860 }
42861
42862 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
42863         LDKUtxoFuture orig_conv;
42864         orig_conv.inner = untag_ptr(orig);
42865         orig_conv.is_owned = ptr_is_owned(orig);
42866         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42867         orig_conv.is_owned = false;
42868         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
42869         uint64_t ret_ref = 0;
42870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42872         return ret_ref;
42873 }
42874
42875 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
42876         LDKUtxoFuture ret_var = UtxoFuture_new();
42877         uint64_t ret_ref = 0;
42878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42880         return ret_ref;
42881 }
42882
42883 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
42884         LDKUtxoFuture this_arg_conv;
42885         this_arg_conv.inner = untag_ptr(this_arg);
42886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42888         this_arg_conv.is_owned = false;
42889         LDKNetworkGraph graph_conv;
42890         graph_conv.inner = untag_ptr(graph);
42891         graph_conv.is_owned = ptr_is_owned(graph);
42892         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
42893         graph_conv.is_owned = false;
42894         void* result_ptr = untag_ptr(result);
42895         CHECK_ACCESS(result_ptr);
42896         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
42897         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
42898 }
42899
42900 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
42901         LDKUtxoFuture this_arg_conv;
42902         this_arg_conv.inner = untag_ptr(this_arg);
42903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42905         this_arg_conv.is_owned = false;
42906         LDKNetworkGraph graph_conv;
42907         graph_conv.inner = untag_ptr(graph);
42908         graph_conv.is_owned = ptr_is_owned(graph);
42909         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
42910         graph_conv.is_owned = false;
42911         LDKP2PGossipSync gossip_conv;
42912         gossip_conv.inner = untag_ptr(gossip);
42913         gossip_conv.is_owned = ptr_is_owned(gossip);
42914         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
42915         gossip_conv.is_owned = false;
42916         void* result_ptr = untag_ptr(result);
42917         CHECK_ACCESS(result_ptr);
42918         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
42919         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
42920 }
42921
42922 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
42923         LDKNodeId this_obj_conv;
42924         this_obj_conv.inner = untag_ptr(this_obj);
42925         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42927         NodeId_free(this_obj_conv);
42928 }
42929
42930 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
42931         LDKNodeId ret_var = NodeId_clone(arg);
42932         uint64_t ret_ref = 0;
42933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42935         return ret_ref;
42936 }
42937 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
42938         LDKNodeId arg_conv;
42939         arg_conv.inner = untag_ptr(arg);
42940         arg_conv.is_owned = ptr_is_owned(arg);
42941         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42942         arg_conv.is_owned = false;
42943         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
42944         return ret_conv;
42945 }
42946
42947 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
42948         LDKNodeId orig_conv;
42949         orig_conv.inner = untag_ptr(orig);
42950         orig_conv.is_owned = ptr_is_owned(orig);
42951         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42952         orig_conv.is_owned = false;
42953         LDKNodeId ret_var = NodeId_clone(&orig_conv);
42954         uint64_t ret_ref = 0;
42955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42957         return ret_ref;
42958 }
42959
42960 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
42961         LDKPublicKey pubkey_ref;
42962         CHECK(pubkey->arr_len == 33);
42963         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
42964         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
42965         uint64_t ret_ref = 0;
42966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42968         return ret_ref;
42969 }
42970
42971 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
42972         LDKNodeId this_arg_conv;
42973         this_arg_conv.inner = untag_ptr(this_arg);
42974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42976         this_arg_conv.is_owned = false;
42977         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
42978         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42979         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42980         return ret_arr;
42981 }
42982
42983 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
42984         LDKNodeId o_conv;
42985         o_conv.inner = untag_ptr(o);
42986         o_conv.is_owned = ptr_is_owned(o);
42987         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42988         o_conv.is_owned = false;
42989         int64_t ret_conv = NodeId_hash(&o_conv);
42990         return ret_conv;
42991 }
42992
42993 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
42994         LDKNodeId obj_conv;
42995         obj_conv.inner = untag_ptr(obj);
42996         obj_conv.is_owned = ptr_is_owned(obj);
42997         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42998         obj_conv.is_owned = false;
42999         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
43000         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43001         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43002         CVec_u8Z_free(ret_var);
43003         return ret_arr;
43004 }
43005
43006 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
43007         LDKu8slice ser_ref;
43008         ser_ref.datalen = ser->arr_len;
43009         ser_ref.data = ser->elems;
43010         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
43011         *ret_conv = NodeId_read(ser_ref);
43012         FREE(ser);
43013         return tag_ptr(ret_conv, true);
43014 }
43015
43016 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
43017         LDKNetworkGraph this_obj_conv;
43018         this_obj_conv.inner = untag_ptr(this_obj);
43019         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43021         NetworkGraph_free(this_obj_conv);
43022 }
43023
43024 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
43025         LDKReadOnlyNetworkGraph this_obj_conv;
43026         this_obj_conv.inner = untag_ptr(this_obj);
43027         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43029         ReadOnlyNetworkGraph_free(this_obj_conv);
43030 }
43031
43032 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
43033         if (!ptr_is_owned(this_ptr)) return;
43034         void* this_ptr_ptr = untag_ptr(this_ptr);
43035         CHECK_ACCESS(this_ptr_ptr);
43036         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
43037         FREE(untag_ptr(this_ptr));
43038         NetworkUpdate_free(this_ptr_conv);
43039 }
43040
43041 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
43042         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43043         *ret_copy = NetworkUpdate_clone(arg);
43044         uint64_t ret_ref = tag_ptr(ret_copy, true);
43045         return ret_ref;
43046 }
43047 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
43048         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
43049         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
43050         return ret_conv;
43051 }
43052
43053 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
43054         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
43055         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43056         *ret_copy = NetworkUpdate_clone(orig_conv);
43057         uint64_t ret_ref = tag_ptr(ret_copy, true);
43058         return ret_ref;
43059 }
43060
43061 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
43062         LDKChannelUpdate msg_conv;
43063         msg_conv.inner = untag_ptr(msg);
43064         msg_conv.is_owned = ptr_is_owned(msg);
43065         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43066         msg_conv = ChannelUpdate_clone(&msg_conv);
43067         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43068         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
43069         uint64_t ret_ref = tag_ptr(ret_copy, true);
43070         return ret_ref;
43071 }
43072
43073 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
43074         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43075         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
43076         uint64_t ret_ref = tag_ptr(ret_copy, true);
43077         return ret_ref;
43078 }
43079
43080 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
43081         LDKPublicKey node_id_ref;
43082         CHECK(node_id->arr_len == 33);
43083         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
43084         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43085         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
43086         uint64_t ret_ref = tag_ptr(ret_copy, true);
43087         return ret_ref;
43088 }
43089
43090 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
43091         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
43092         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
43093         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
43094         return ret_conv;
43095 }
43096
43097 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
43098         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
43099         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
43100         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43101         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43102         CVec_u8Z_free(ret_var);
43103         return ret_arr;
43104 }
43105
43106 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
43107         LDKu8slice ser_ref;
43108         ser_ref.datalen = ser->arr_len;
43109         ser_ref.data = ser->elems;
43110         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
43111         *ret_conv = NetworkUpdate_read(ser_ref);
43112         FREE(ser);
43113         return tag_ptr(ret_conv, true);
43114 }
43115
43116 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
43117         LDKP2PGossipSync this_obj_conv;
43118         this_obj_conv.inner = untag_ptr(this_obj);
43119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43121         P2PGossipSync_free(this_obj_conv);
43122 }
43123
43124 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
43125         LDKNetworkGraph network_graph_conv;
43126         network_graph_conv.inner = untag_ptr(network_graph);
43127         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43128         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43129         network_graph_conv.is_owned = false;
43130         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
43131         CHECK_ACCESS(utxo_lookup_ptr);
43132         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
43133         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
43134         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
43135                 // Manually implement clone for Java trait instances
43136                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
43137                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43138                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
43139                 }
43140         }
43141         void* logger_ptr = untag_ptr(logger);
43142         CHECK_ACCESS(logger_ptr);
43143         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43144         if (logger_conv.free == LDKLogger_JCalls_free) {
43145                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43146                 LDKLogger_JCalls_cloned(&logger_conv);
43147         }
43148         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
43149         uint64_t ret_ref = 0;
43150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43152         return ret_ref;
43153 }
43154
43155 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
43156         LDKP2PGossipSync this_arg_conv;
43157         this_arg_conv.inner = untag_ptr(this_arg);
43158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43160         this_arg_conv.is_owned = false;
43161         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
43162         CHECK_ACCESS(utxo_lookup_ptr);
43163         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
43164         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
43165         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
43166                 // Manually implement clone for Java trait instances
43167                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
43168                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43169                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
43170                 }
43171         }
43172         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
43173 }
43174
43175 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
43176         LDKNetworkGraph this_arg_conv;
43177         this_arg_conv.inner = untag_ptr(this_arg);
43178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43180         this_arg_conv.is_owned = false;
43181         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
43182         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
43183 }
43184
43185 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
43186         LDKP2PGossipSync this_arg_conv;
43187         this_arg_conv.inner = untag_ptr(this_arg);
43188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43190         this_arg_conv.is_owned = false;
43191         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
43192         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
43193         return tag_ptr(ret_ret, true);
43194 }
43195
43196 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
43197         LDKP2PGossipSync this_arg_conv;
43198         this_arg_conv.inner = untag_ptr(this_arg);
43199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43201         this_arg_conv.is_owned = false;
43202         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43203         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
43204         return tag_ptr(ret_ret, true);
43205 }
43206
43207 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
43208         LDKChannelUpdateInfo this_obj_conv;
43209         this_obj_conv.inner = untag_ptr(this_obj);
43210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43212         ChannelUpdateInfo_free(this_obj_conv);
43213 }
43214
43215 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
43216         LDKChannelUpdateInfo this_ptr_conv;
43217         this_ptr_conv.inner = untag_ptr(this_ptr);
43218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43220         this_ptr_conv.is_owned = false;
43221         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
43222         return ret_conv;
43223 }
43224
43225 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
43226         LDKChannelUpdateInfo this_ptr_conv;
43227         this_ptr_conv.inner = untag_ptr(this_ptr);
43228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43230         this_ptr_conv.is_owned = false;
43231         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
43232 }
43233
43234 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
43235         LDKChannelUpdateInfo this_ptr_conv;
43236         this_ptr_conv.inner = untag_ptr(this_ptr);
43237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43239         this_ptr_conv.is_owned = false;
43240         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
43241         return ret_conv;
43242 }
43243
43244 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
43245         LDKChannelUpdateInfo this_ptr_conv;
43246         this_ptr_conv.inner = untag_ptr(this_ptr);
43247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43249         this_ptr_conv.is_owned = false;
43250         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
43251 }
43252
43253 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
43254         LDKChannelUpdateInfo this_ptr_conv;
43255         this_ptr_conv.inner = untag_ptr(this_ptr);
43256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43258         this_ptr_conv.is_owned = false;
43259         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
43260         return ret_conv;
43261 }
43262
43263 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
43264         LDKChannelUpdateInfo this_ptr_conv;
43265         this_ptr_conv.inner = untag_ptr(this_ptr);
43266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43268         this_ptr_conv.is_owned = false;
43269         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
43270 }
43271
43272 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
43273         LDKChannelUpdateInfo this_ptr_conv;
43274         this_ptr_conv.inner = untag_ptr(this_ptr);
43275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43277         this_ptr_conv.is_owned = false;
43278         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
43279         return ret_conv;
43280 }
43281
43282 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
43283         LDKChannelUpdateInfo this_ptr_conv;
43284         this_ptr_conv.inner = untag_ptr(this_ptr);
43285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43287         this_ptr_conv.is_owned = false;
43288         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
43289 }
43290
43291 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
43292         LDKChannelUpdateInfo this_ptr_conv;
43293         this_ptr_conv.inner = untag_ptr(this_ptr);
43294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43296         this_ptr_conv.is_owned = false;
43297         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
43298         return ret_conv;
43299 }
43300
43301 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
43302         LDKChannelUpdateInfo this_ptr_conv;
43303         this_ptr_conv.inner = untag_ptr(this_ptr);
43304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43306         this_ptr_conv.is_owned = false;
43307         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
43308 }
43309
43310 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
43311         LDKChannelUpdateInfo this_ptr_conv;
43312         this_ptr_conv.inner = untag_ptr(this_ptr);
43313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43315         this_ptr_conv.is_owned = false;
43316         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
43317         uint64_t ret_ref = 0;
43318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43320         return ret_ref;
43321 }
43322
43323 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
43324         LDKChannelUpdateInfo this_ptr_conv;
43325         this_ptr_conv.inner = untag_ptr(this_ptr);
43326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43328         this_ptr_conv.is_owned = false;
43329         LDKRoutingFees val_conv;
43330         val_conv.inner = untag_ptr(val);
43331         val_conv.is_owned = ptr_is_owned(val);
43332         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43333         val_conv = RoutingFees_clone(&val_conv);
43334         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
43335 }
43336
43337 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
43338         LDKChannelUpdateInfo this_ptr_conv;
43339         this_ptr_conv.inner = untag_ptr(this_ptr);
43340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43342         this_ptr_conv.is_owned = false;
43343         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
43344         uint64_t ret_ref = 0;
43345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43347         return ret_ref;
43348 }
43349
43350 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
43351         LDKChannelUpdateInfo this_ptr_conv;
43352         this_ptr_conv.inner = untag_ptr(this_ptr);
43353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43355         this_ptr_conv.is_owned = false;
43356         LDKChannelUpdate val_conv;
43357         val_conv.inner = untag_ptr(val);
43358         val_conv.is_owned = ptr_is_owned(val);
43359         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43360         val_conv = ChannelUpdate_clone(&val_conv);
43361         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
43362 }
43363
43364 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) {
43365         LDKRoutingFees fees_arg_conv;
43366         fees_arg_conv.inner = untag_ptr(fees_arg);
43367         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
43368         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
43369         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
43370         LDKChannelUpdate last_update_message_arg_conv;
43371         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
43372         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
43373         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
43374         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
43375         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);
43376         uint64_t ret_ref = 0;
43377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43379         return ret_ref;
43380 }
43381
43382 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
43383         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
43384         uint64_t ret_ref = 0;
43385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43387         return ret_ref;
43388 }
43389 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
43390         LDKChannelUpdateInfo arg_conv;
43391         arg_conv.inner = untag_ptr(arg);
43392         arg_conv.is_owned = ptr_is_owned(arg);
43393         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43394         arg_conv.is_owned = false;
43395         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
43396         return ret_conv;
43397 }
43398
43399 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
43400         LDKChannelUpdateInfo orig_conv;
43401         orig_conv.inner = untag_ptr(orig);
43402         orig_conv.is_owned = ptr_is_owned(orig);
43403         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43404         orig_conv.is_owned = false;
43405         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
43406         uint64_t ret_ref = 0;
43407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43409         return ret_ref;
43410 }
43411
43412 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
43413         LDKChannelUpdateInfo a_conv;
43414         a_conv.inner = untag_ptr(a);
43415         a_conv.is_owned = ptr_is_owned(a);
43416         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43417         a_conv.is_owned = false;
43418         LDKChannelUpdateInfo b_conv;
43419         b_conv.inner = untag_ptr(b);
43420         b_conv.is_owned = ptr_is_owned(b);
43421         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43422         b_conv.is_owned = false;
43423         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
43424         return ret_conv;
43425 }
43426
43427 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
43428         LDKChannelUpdateInfo obj_conv;
43429         obj_conv.inner = untag_ptr(obj);
43430         obj_conv.is_owned = ptr_is_owned(obj);
43431         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43432         obj_conv.is_owned = false;
43433         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
43434         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43435         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43436         CVec_u8Z_free(ret_var);
43437         return ret_arr;
43438 }
43439
43440 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
43441         LDKu8slice ser_ref;
43442         ser_ref.datalen = ser->arr_len;
43443         ser_ref.data = ser->elems;
43444         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
43445         *ret_conv = ChannelUpdateInfo_read(ser_ref);
43446         FREE(ser);
43447         return tag_ptr(ret_conv, true);
43448 }
43449
43450 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
43451         LDKChannelInfo this_obj_conv;
43452         this_obj_conv.inner = untag_ptr(this_obj);
43453         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43455         ChannelInfo_free(this_obj_conv);
43456 }
43457
43458 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
43459         LDKChannelInfo this_ptr_conv;
43460         this_ptr_conv.inner = untag_ptr(this_ptr);
43461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43463         this_ptr_conv.is_owned = false;
43464         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
43465         uint64_t ret_ref = 0;
43466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43468         return ret_ref;
43469 }
43470
43471 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
43472         LDKChannelInfo this_ptr_conv;
43473         this_ptr_conv.inner = untag_ptr(this_ptr);
43474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43476         this_ptr_conv.is_owned = false;
43477         LDKChannelFeatures val_conv;
43478         val_conv.inner = untag_ptr(val);
43479         val_conv.is_owned = ptr_is_owned(val);
43480         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43481         val_conv = ChannelFeatures_clone(&val_conv);
43482         ChannelInfo_set_features(&this_ptr_conv, val_conv);
43483 }
43484
43485 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
43486         LDKChannelInfo this_ptr_conv;
43487         this_ptr_conv.inner = untag_ptr(this_ptr);
43488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43490         this_ptr_conv.is_owned = false;
43491         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
43492         uint64_t ret_ref = 0;
43493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43495         return ret_ref;
43496 }
43497
43498 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
43499         LDKChannelInfo this_ptr_conv;
43500         this_ptr_conv.inner = untag_ptr(this_ptr);
43501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43503         this_ptr_conv.is_owned = false;
43504         LDKNodeId val_conv;
43505         val_conv.inner = untag_ptr(val);
43506         val_conv.is_owned = ptr_is_owned(val);
43507         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43508         val_conv = NodeId_clone(&val_conv);
43509         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
43510 }
43511
43512 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
43513         LDKChannelInfo this_ptr_conv;
43514         this_ptr_conv.inner = untag_ptr(this_ptr);
43515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43517         this_ptr_conv.is_owned = false;
43518         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
43519         uint64_t ret_ref = 0;
43520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43522         return ret_ref;
43523 }
43524
43525 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
43526         LDKChannelInfo this_ptr_conv;
43527         this_ptr_conv.inner = untag_ptr(this_ptr);
43528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43530         this_ptr_conv.is_owned = false;
43531         LDKChannelUpdateInfo val_conv;
43532         val_conv.inner = untag_ptr(val);
43533         val_conv.is_owned = ptr_is_owned(val);
43534         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43535         val_conv = ChannelUpdateInfo_clone(&val_conv);
43536         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
43537 }
43538
43539 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
43540         LDKChannelInfo this_ptr_conv;
43541         this_ptr_conv.inner = untag_ptr(this_ptr);
43542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43544         this_ptr_conv.is_owned = false;
43545         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
43546         uint64_t ret_ref = 0;
43547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43549         return ret_ref;
43550 }
43551
43552 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
43553         LDKChannelInfo this_ptr_conv;
43554         this_ptr_conv.inner = untag_ptr(this_ptr);
43555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43557         this_ptr_conv.is_owned = false;
43558         LDKNodeId val_conv;
43559         val_conv.inner = untag_ptr(val);
43560         val_conv.is_owned = ptr_is_owned(val);
43561         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43562         val_conv = NodeId_clone(&val_conv);
43563         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
43564 }
43565
43566 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
43567         LDKChannelInfo this_ptr_conv;
43568         this_ptr_conv.inner = untag_ptr(this_ptr);
43569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43571         this_ptr_conv.is_owned = false;
43572         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
43573         uint64_t ret_ref = 0;
43574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43576         return ret_ref;
43577 }
43578
43579 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
43580         LDKChannelInfo this_ptr_conv;
43581         this_ptr_conv.inner = untag_ptr(this_ptr);
43582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43584         this_ptr_conv.is_owned = false;
43585         LDKChannelUpdateInfo val_conv;
43586         val_conv.inner = untag_ptr(val);
43587         val_conv.is_owned = ptr_is_owned(val);
43588         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43589         val_conv = ChannelUpdateInfo_clone(&val_conv);
43590         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
43591 }
43592
43593 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
43594         LDKChannelInfo this_ptr_conv;
43595         this_ptr_conv.inner = untag_ptr(this_ptr);
43596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43598         this_ptr_conv.is_owned = false;
43599         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43600         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
43601         uint64_t ret_ref = tag_ptr(ret_copy, true);
43602         return ret_ref;
43603 }
43604
43605 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
43606         LDKChannelInfo this_ptr_conv;
43607         this_ptr_conv.inner = untag_ptr(this_ptr);
43608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43610         this_ptr_conv.is_owned = false;
43611         void* val_ptr = untag_ptr(val);
43612         CHECK_ACCESS(val_ptr);
43613         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43614         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43615         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
43616 }
43617
43618 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
43619         LDKChannelInfo this_ptr_conv;
43620         this_ptr_conv.inner = untag_ptr(this_ptr);
43621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43623         this_ptr_conv.is_owned = false;
43624         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
43625         uint64_t ret_ref = 0;
43626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43628         return ret_ref;
43629 }
43630
43631 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
43632         LDKChannelInfo this_ptr_conv;
43633         this_ptr_conv.inner = untag_ptr(this_ptr);
43634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43636         this_ptr_conv.is_owned = false;
43637         LDKChannelAnnouncement val_conv;
43638         val_conv.inner = untag_ptr(val);
43639         val_conv.is_owned = ptr_is_owned(val);
43640         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43641         val_conv = ChannelAnnouncement_clone(&val_conv);
43642         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
43643 }
43644
43645 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
43646         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
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 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
43653         LDKChannelInfo arg_conv;
43654         arg_conv.inner = untag_ptr(arg);
43655         arg_conv.is_owned = ptr_is_owned(arg);
43656         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43657         arg_conv.is_owned = false;
43658         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
43659         return ret_conv;
43660 }
43661
43662 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
43663         LDKChannelInfo orig_conv;
43664         orig_conv.inner = untag_ptr(orig);
43665         orig_conv.is_owned = ptr_is_owned(orig);
43666         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43667         orig_conv.is_owned = false;
43668         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
43669         uint64_t ret_ref = 0;
43670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43672         return ret_ref;
43673 }
43674
43675 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
43676         LDKChannelInfo a_conv;
43677         a_conv.inner = untag_ptr(a);
43678         a_conv.is_owned = ptr_is_owned(a);
43679         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43680         a_conv.is_owned = false;
43681         LDKChannelInfo b_conv;
43682         b_conv.inner = untag_ptr(b);
43683         b_conv.is_owned = ptr_is_owned(b);
43684         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43685         b_conv.is_owned = false;
43686         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
43687         return ret_conv;
43688 }
43689
43690 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
43691         LDKChannelInfo this_arg_conv;
43692         this_arg_conv.inner = untag_ptr(this_arg);
43693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43695         this_arg_conv.is_owned = false;
43696         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
43697         uint64_t ret_ref = 0;
43698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43700         return ret_ref;
43701 }
43702
43703 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
43704         LDKChannelInfo obj_conv;
43705         obj_conv.inner = untag_ptr(obj);
43706         obj_conv.is_owned = ptr_is_owned(obj);
43707         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43708         obj_conv.is_owned = false;
43709         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
43710         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43711         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43712         CVec_u8Z_free(ret_var);
43713         return ret_arr;
43714 }
43715
43716 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
43717         LDKu8slice ser_ref;
43718         ser_ref.datalen = ser->arr_len;
43719         ser_ref.data = ser->elems;
43720         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
43721         *ret_conv = ChannelInfo_read(ser_ref);
43722         FREE(ser);
43723         return tag_ptr(ret_conv, true);
43724 }
43725
43726 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
43727         LDKDirectedChannelInfo this_obj_conv;
43728         this_obj_conv.inner = untag_ptr(this_obj);
43729         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43731         DirectedChannelInfo_free(this_obj_conv);
43732 }
43733
43734 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
43735         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
43736         uint64_t ret_ref = 0;
43737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43739         return ret_ref;
43740 }
43741 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
43742         LDKDirectedChannelInfo arg_conv;
43743         arg_conv.inner = untag_ptr(arg);
43744         arg_conv.is_owned = ptr_is_owned(arg);
43745         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43746         arg_conv.is_owned = false;
43747         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
43748         return ret_conv;
43749 }
43750
43751 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
43752         LDKDirectedChannelInfo orig_conv;
43753         orig_conv.inner = untag_ptr(orig);
43754         orig_conv.is_owned = ptr_is_owned(orig);
43755         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43756         orig_conv.is_owned = false;
43757         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
43758         uint64_t ret_ref = 0;
43759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43761         return ret_ref;
43762 }
43763
43764 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
43765         LDKDirectedChannelInfo this_arg_conv;
43766         this_arg_conv.inner = untag_ptr(this_arg);
43767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43769         this_arg_conv.is_owned = false;
43770         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
43771         uint64_t ret_ref = 0;
43772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43774         return ret_ref;
43775 }
43776
43777 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
43778         LDKDirectedChannelInfo this_arg_conv;
43779         this_arg_conv.inner = untag_ptr(this_arg);
43780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43782         this_arg_conv.is_owned = false;
43783         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
43784         return ret_conv;
43785 }
43786
43787 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
43788         LDKDirectedChannelInfo this_arg_conv;
43789         this_arg_conv.inner = untag_ptr(this_arg);
43790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43792         this_arg_conv.is_owned = false;
43793         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43794         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
43795         uint64_t ret_ref = tag_ptr(ret_copy, true);
43796         return ret_ref;
43797 }
43798
43799 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
43800         if (!ptr_is_owned(this_ptr)) return;
43801         void* this_ptr_ptr = untag_ptr(this_ptr);
43802         CHECK_ACCESS(this_ptr_ptr);
43803         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
43804         FREE(untag_ptr(this_ptr));
43805         EffectiveCapacity_free(this_ptr_conv);
43806 }
43807
43808 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
43809         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43810         *ret_copy = EffectiveCapacity_clone(arg);
43811         uint64_t ret_ref = tag_ptr(ret_copy, true);
43812         return ret_ref;
43813 }
43814 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
43815         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
43816         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
43817         return ret_conv;
43818 }
43819
43820 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
43821         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
43822         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43823         *ret_copy = EffectiveCapacity_clone(orig_conv);
43824         uint64_t ret_ref = tag_ptr(ret_copy, true);
43825         return ret_ref;
43826 }
43827
43828 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
43829         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43830         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
43831         uint64_t ret_ref = tag_ptr(ret_copy, true);
43832         return ret_ref;
43833 }
43834
43835 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
43836         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43837         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
43838         uint64_t ret_ref = tag_ptr(ret_copy, true);
43839         return ret_ref;
43840 }
43841
43842 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
43843         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43844         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
43845         uint64_t ret_ref = tag_ptr(ret_copy, true);
43846         return ret_ref;
43847 }
43848
43849 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
43850         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43851         *ret_copy = EffectiveCapacity_infinite();
43852         uint64_t ret_ref = tag_ptr(ret_copy, true);
43853         return ret_ref;
43854 }
43855
43856 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
43857         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43858         *ret_copy = EffectiveCapacity_unknown();
43859         uint64_t ret_ref = tag_ptr(ret_copy, true);
43860         return ret_ref;
43861 }
43862
43863 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
43864         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
43865         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
43866         return ret_conv;
43867 }
43868
43869 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
43870         LDKRoutingFees this_obj_conv;
43871         this_obj_conv.inner = untag_ptr(this_obj);
43872         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43874         RoutingFees_free(this_obj_conv);
43875 }
43876
43877 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
43878         LDKRoutingFees this_ptr_conv;
43879         this_ptr_conv.inner = untag_ptr(this_ptr);
43880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43882         this_ptr_conv.is_owned = false;
43883         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
43884         return ret_conv;
43885 }
43886
43887 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
43888         LDKRoutingFees this_ptr_conv;
43889         this_ptr_conv.inner = untag_ptr(this_ptr);
43890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43892         this_ptr_conv.is_owned = false;
43893         RoutingFees_set_base_msat(&this_ptr_conv, val);
43894 }
43895
43896 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
43897         LDKRoutingFees this_ptr_conv;
43898         this_ptr_conv.inner = untag_ptr(this_ptr);
43899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43901         this_ptr_conv.is_owned = false;
43902         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
43903         return ret_conv;
43904 }
43905
43906 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
43907         LDKRoutingFees this_ptr_conv;
43908         this_ptr_conv.inner = untag_ptr(this_ptr);
43909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43911         this_ptr_conv.is_owned = false;
43912         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
43913 }
43914
43915 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
43916         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
43917         uint64_t ret_ref = 0;
43918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43920         return ret_ref;
43921 }
43922
43923 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
43924         LDKRoutingFees a_conv;
43925         a_conv.inner = untag_ptr(a);
43926         a_conv.is_owned = ptr_is_owned(a);
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43928         a_conv.is_owned = false;
43929         LDKRoutingFees b_conv;
43930         b_conv.inner = untag_ptr(b);
43931         b_conv.is_owned = ptr_is_owned(b);
43932         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43933         b_conv.is_owned = false;
43934         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
43935         return ret_conv;
43936 }
43937
43938 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
43939         LDKRoutingFees ret_var = RoutingFees_clone(arg);
43940         uint64_t ret_ref = 0;
43941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43943         return ret_ref;
43944 }
43945 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
43946         LDKRoutingFees arg_conv;
43947         arg_conv.inner = untag_ptr(arg);
43948         arg_conv.is_owned = ptr_is_owned(arg);
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43950         arg_conv.is_owned = false;
43951         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
43952         return ret_conv;
43953 }
43954
43955 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
43956         LDKRoutingFees orig_conv;
43957         orig_conv.inner = untag_ptr(orig);
43958         orig_conv.is_owned = ptr_is_owned(orig);
43959         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43960         orig_conv.is_owned = false;
43961         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
43962         uint64_t ret_ref = 0;
43963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43965         return ret_ref;
43966 }
43967
43968 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
43969         LDKRoutingFees o_conv;
43970         o_conv.inner = untag_ptr(o);
43971         o_conv.is_owned = ptr_is_owned(o);
43972         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43973         o_conv.is_owned = false;
43974         int64_t ret_conv = RoutingFees_hash(&o_conv);
43975         return ret_conv;
43976 }
43977
43978 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
43979         LDKRoutingFees obj_conv;
43980         obj_conv.inner = untag_ptr(obj);
43981         obj_conv.is_owned = ptr_is_owned(obj);
43982         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43983         obj_conv.is_owned = false;
43984         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
43985         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43986         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43987         CVec_u8Z_free(ret_var);
43988         return ret_arr;
43989 }
43990
43991 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
43992         LDKu8slice ser_ref;
43993         ser_ref.datalen = ser->arr_len;
43994         ser_ref.data = ser->elems;
43995         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
43996         *ret_conv = RoutingFees_read(ser_ref);
43997         FREE(ser);
43998         return tag_ptr(ret_conv, true);
43999 }
44000
44001 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
44002         LDKNodeAnnouncementInfo this_obj_conv;
44003         this_obj_conv.inner = untag_ptr(this_obj);
44004         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44006         NodeAnnouncementInfo_free(this_obj_conv);
44007 }
44008
44009 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
44010         LDKNodeAnnouncementInfo this_ptr_conv;
44011         this_ptr_conv.inner = untag_ptr(this_ptr);
44012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44014         this_ptr_conv.is_owned = false;
44015         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
44016         uint64_t ret_ref = 0;
44017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44019         return ret_ref;
44020 }
44021
44022 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
44023         LDKNodeAnnouncementInfo this_ptr_conv;
44024         this_ptr_conv.inner = untag_ptr(this_ptr);
44025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44027         this_ptr_conv.is_owned = false;
44028         LDKNodeFeatures val_conv;
44029         val_conv.inner = untag_ptr(val);
44030         val_conv.is_owned = ptr_is_owned(val);
44031         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44032         val_conv = NodeFeatures_clone(&val_conv);
44033         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
44034 }
44035
44036 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
44037         LDKNodeAnnouncementInfo this_ptr_conv;
44038         this_ptr_conv.inner = untag_ptr(this_ptr);
44039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44041         this_ptr_conv.is_owned = false;
44042         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
44043         return ret_conv;
44044 }
44045
44046 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
44047         LDKNodeAnnouncementInfo this_ptr_conv;
44048         this_ptr_conv.inner = untag_ptr(this_ptr);
44049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44051         this_ptr_conv.is_owned = false;
44052         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
44053 }
44054
44055 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
44056         LDKNodeAnnouncementInfo this_ptr_conv;
44057         this_ptr_conv.inner = untag_ptr(this_ptr);
44058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44060         this_ptr_conv.is_owned = false;
44061         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
44062         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
44063         return ret_arr;
44064 }
44065
44066 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
44067         LDKNodeAnnouncementInfo this_ptr_conv;
44068         this_ptr_conv.inner = untag_ptr(this_ptr);
44069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44071         this_ptr_conv.is_owned = false;
44072         LDKThreeBytes val_ref;
44073         CHECK(val->arr_len == 3);
44074         memcpy(val_ref.data, val->elems, 3); FREE(val);
44075         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
44076 }
44077
44078 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
44079         LDKNodeAnnouncementInfo this_ptr_conv;
44080         this_ptr_conv.inner = untag_ptr(this_ptr);
44081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44083         this_ptr_conv.is_owned = false;
44084         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
44085         uint64_t ret_ref = 0;
44086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44088         return ret_ref;
44089 }
44090
44091 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
44092         LDKNodeAnnouncementInfo this_ptr_conv;
44093         this_ptr_conv.inner = untag_ptr(this_ptr);
44094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44096         this_ptr_conv.is_owned = false;
44097         LDKNodeAlias val_conv;
44098         val_conv.inner = untag_ptr(val);
44099         val_conv.is_owned = ptr_is_owned(val);
44100         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44101         val_conv = NodeAlias_clone(&val_conv);
44102         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
44103 }
44104
44105 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
44106         LDKNodeAnnouncementInfo this_ptr_conv;
44107         this_ptr_conv.inner = untag_ptr(this_ptr);
44108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44110         this_ptr_conv.is_owned = false;
44111         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
44112         uint64_tArray ret_arr = NULL;
44113         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44114         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44115         for (size_t m = 0; m < ret_var.datalen; m++) {
44116                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
44117                 *ret_conv_12_copy = ret_var.data[m];
44118                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
44119                 ret_arr_ptr[m] = ret_conv_12_ref;
44120         }
44121         
44122         FREE(ret_var.data);
44123         return ret_arr;
44124 }
44125
44126 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
44127         LDKNodeAnnouncementInfo this_ptr_conv;
44128         this_ptr_conv.inner = untag_ptr(this_ptr);
44129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44131         this_ptr_conv.is_owned = false;
44132         LDKCVec_NetAddressZ val_constr;
44133         val_constr.datalen = val->arr_len;
44134         if (val_constr.datalen > 0)
44135                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44136         else
44137                 val_constr.data = NULL;
44138         uint64_t* val_vals = val->elems;
44139         for (size_t m = 0; m < val_constr.datalen; m++) {
44140                 uint64_t val_conv_12 = val_vals[m];
44141                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
44142                 CHECK_ACCESS(val_conv_12_ptr);
44143                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
44144                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
44145                 val_constr.data[m] = val_conv_12_conv;
44146         }
44147         FREE(val);
44148         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
44149 }
44150
44151 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
44152         LDKNodeAnnouncementInfo this_ptr_conv;
44153         this_ptr_conv.inner = untag_ptr(this_ptr);
44154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44156         this_ptr_conv.is_owned = false;
44157         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
44158         uint64_t ret_ref = 0;
44159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44161         return ret_ref;
44162 }
44163
44164 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
44165         LDKNodeAnnouncementInfo this_ptr_conv;
44166         this_ptr_conv.inner = untag_ptr(this_ptr);
44167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44169         this_ptr_conv.is_owned = false;
44170         LDKNodeAnnouncement val_conv;
44171         val_conv.inner = untag_ptr(val);
44172         val_conv.is_owned = ptr_is_owned(val);
44173         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44174         val_conv = NodeAnnouncement_clone(&val_conv);
44175         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
44176 }
44177
44178 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_new"))) TS_NodeAnnouncementInfo_new(uint64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, uint64_t alias_arg, uint64_tArray addresses_arg, uint64_t announcement_message_arg) {
44179         LDKNodeFeatures features_arg_conv;
44180         features_arg_conv.inner = untag_ptr(features_arg);
44181         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44182         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44183         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
44184         LDKThreeBytes rgb_arg_ref;
44185         CHECK(rgb_arg->arr_len == 3);
44186         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
44187         LDKNodeAlias alias_arg_conv;
44188         alias_arg_conv.inner = untag_ptr(alias_arg);
44189         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
44190         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
44191         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
44192         LDKCVec_NetAddressZ addresses_arg_constr;
44193         addresses_arg_constr.datalen = addresses_arg->arr_len;
44194         if (addresses_arg_constr.datalen > 0)
44195                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44196         else
44197                 addresses_arg_constr.data = NULL;
44198         uint64_t* addresses_arg_vals = addresses_arg->elems;
44199         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
44200                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
44201                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
44202                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
44203                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
44204                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
44205         }
44206         FREE(addresses_arg);
44207         LDKNodeAnnouncement announcement_message_arg_conv;
44208         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
44209         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
44210         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
44211         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
44212         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
44213         uint64_t ret_ref = 0;
44214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44216         return ret_ref;
44217 }
44218
44219 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
44220         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
44221         uint64_t ret_ref = 0;
44222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44224         return ret_ref;
44225 }
44226 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
44227         LDKNodeAnnouncementInfo arg_conv;
44228         arg_conv.inner = untag_ptr(arg);
44229         arg_conv.is_owned = ptr_is_owned(arg);
44230         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44231         arg_conv.is_owned = false;
44232         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
44233         return ret_conv;
44234 }
44235
44236 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
44237         LDKNodeAnnouncementInfo orig_conv;
44238         orig_conv.inner = untag_ptr(orig);
44239         orig_conv.is_owned = ptr_is_owned(orig);
44240         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44241         orig_conv.is_owned = false;
44242         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
44243         uint64_t ret_ref = 0;
44244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44246         return ret_ref;
44247 }
44248
44249 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
44250         LDKNodeAnnouncementInfo a_conv;
44251         a_conv.inner = untag_ptr(a);
44252         a_conv.is_owned = ptr_is_owned(a);
44253         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44254         a_conv.is_owned = false;
44255         LDKNodeAnnouncementInfo b_conv;
44256         b_conv.inner = untag_ptr(b);
44257         b_conv.is_owned = ptr_is_owned(b);
44258         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44259         b_conv.is_owned = false;
44260         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
44261         return ret_conv;
44262 }
44263
44264 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
44265         LDKNodeAnnouncementInfo obj_conv;
44266         obj_conv.inner = untag_ptr(obj);
44267         obj_conv.is_owned = ptr_is_owned(obj);
44268         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44269         obj_conv.is_owned = false;
44270         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
44271         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44272         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44273         CVec_u8Z_free(ret_var);
44274         return ret_arr;
44275 }
44276
44277 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
44278         LDKu8slice ser_ref;
44279         ser_ref.datalen = ser->arr_len;
44280         ser_ref.data = ser->elems;
44281         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
44282         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
44283         FREE(ser);
44284         return tag_ptr(ret_conv, true);
44285 }
44286
44287 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
44288         LDKNodeAlias this_obj_conv;
44289         this_obj_conv.inner = untag_ptr(this_obj);
44290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44292         NodeAlias_free(this_obj_conv);
44293 }
44294
44295 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
44296         LDKNodeAlias this_ptr_conv;
44297         this_ptr_conv.inner = untag_ptr(this_ptr);
44298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44300         this_ptr_conv.is_owned = false;
44301         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44302         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
44303         return ret_arr;
44304 }
44305
44306 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
44307         LDKNodeAlias this_ptr_conv;
44308         this_ptr_conv.inner = untag_ptr(this_ptr);
44309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44311         this_ptr_conv.is_owned = false;
44312         LDKThirtyTwoBytes val_ref;
44313         CHECK(val->arr_len == 32);
44314         memcpy(val_ref.data, val->elems, 32); FREE(val);
44315         NodeAlias_set_a(&this_ptr_conv, val_ref);
44316 }
44317
44318 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
44319         LDKThirtyTwoBytes a_arg_ref;
44320         CHECK(a_arg->arr_len == 32);
44321         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
44322         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
44323         uint64_t ret_ref = 0;
44324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44326         return ret_ref;
44327 }
44328
44329 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
44330         LDKNodeAlias ret_var = NodeAlias_clone(arg);
44331         uint64_t ret_ref = 0;
44332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44334         return ret_ref;
44335 }
44336 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
44337         LDKNodeAlias arg_conv;
44338         arg_conv.inner = untag_ptr(arg);
44339         arg_conv.is_owned = ptr_is_owned(arg);
44340         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44341         arg_conv.is_owned = false;
44342         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
44343         return ret_conv;
44344 }
44345
44346 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
44347         LDKNodeAlias orig_conv;
44348         orig_conv.inner = untag_ptr(orig);
44349         orig_conv.is_owned = ptr_is_owned(orig);
44350         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44351         orig_conv.is_owned = false;
44352         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
44353         uint64_t ret_ref = 0;
44354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44356         return ret_ref;
44357 }
44358
44359 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
44360         LDKNodeAlias a_conv;
44361         a_conv.inner = untag_ptr(a);
44362         a_conv.is_owned = ptr_is_owned(a);
44363         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44364         a_conv.is_owned = false;
44365         LDKNodeAlias b_conv;
44366         b_conv.inner = untag_ptr(b);
44367         b_conv.is_owned = ptr_is_owned(b);
44368         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44369         b_conv.is_owned = false;
44370         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
44371         return ret_conv;
44372 }
44373
44374 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
44375         LDKNodeAlias obj_conv;
44376         obj_conv.inner = untag_ptr(obj);
44377         obj_conv.is_owned = ptr_is_owned(obj);
44378         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44379         obj_conv.is_owned = false;
44380         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
44381         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44382         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44383         CVec_u8Z_free(ret_var);
44384         return ret_arr;
44385 }
44386
44387 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
44388         LDKu8slice ser_ref;
44389         ser_ref.datalen = ser->arr_len;
44390         ser_ref.data = ser->elems;
44391         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
44392         *ret_conv = NodeAlias_read(ser_ref);
44393         FREE(ser);
44394         return tag_ptr(ret_conv, true);
44395 }
44396
44397 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
44398         LDKNodeInfo this_obj_conv;
44399         this_obj_conv.inner = untag_ptr(this_obj);
44400         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44402         NodeInfo_free(this_obj_conv);
44403 }
44404
44405 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
44406         LDKNodeInfo this_ptr_conv;
44407         this_ptr_conv.inner = untag_ptr(this_ptr);
44408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44410         this_ptr_conv.is_owned = false;
44411         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
44412         int64_tArray ret_arr = NULL;
44413         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44414         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44415         for (size_t i = 0; i < ret_var.datalen; i++) {
44416                 int64_t ret_conv_8_conv = ret_var.data[i];
44417                 ret_arr_ptr[i] = ret_conv_8_conv;
44418         }
44419         
44420         FREE(ret_var.data);
44421         return ret_arr;
44422 }
44423
44424 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
44425         LDKNodeInfo this_ptr_conv;
44426         this_ptr_conv.inner = untag_ptr(this_ptr);
44427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44429         this_ptr_conv.is_owned = false;
44430         LDKCVec_u64Z val_constr;
44431         val_constr.datalen = val->arr_len;
44432         if (val_constr.datalen > 0)
44433                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44434         else
44435                 val_constr.data = NULL;
44436         int64_t* val_vals = val->elems;
44437         for (size_t i = 0; i < val_constr.datalen; i++) {
44438                 int64_t val_conv_8 = val_vals[i];
44439                 val_constr.data[i] = val_conv_8;
44440         }
44441         FREE(val);
44442         NodeInfo_set_channels(&this_ptr_conv, val_constr);
44443 }
44444
44445 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
44446         LDKNodeInfo this_ptr_conv;
44447         this_ptr_conv.inner = untag_ptr(this_ptr);
44448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44450         this_ptr_conv.is_owned = false;
44451         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_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 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
44459         LDKNodeInfo this_ptr_conv;
44460         this_ptr_conv.inner = untag_ptr(this_ptr);
44461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44463         this_ptr_conv.is_owned = false;
44464         LDKNodeAnnouncementInfo val_conv;
44465         val_conv.inner = untag_ptr(val);
44466         val_conv.is_owned = ptr_is_owned(val);
44467         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44468         val_conv = NodeAnnouncementInfo_clone(&val_conv);
44469         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
44470 }
44471
44472 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
44473         LDKCVec_u64Z channels_arg_constr;
44474         channels_arg_constr.datalen = channels_arg->arr_len;
44475         if (channels_arg_constr.datalen > 0)
44476                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44477         else
44478                 channels_arg_constr.data = NULL;
44479         int64_t* channels_arg_vals = channels_arg->elems;
44480         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
44481                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
44482                 channels_arg_constr.data[i] = channels_arg_conv_8;
44483         }
44484         FREE(channels_arg);
44485         LDKNodeAnnouncementInfo announcement_info_arg_conv;
44486         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
44487         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
44488         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
44489         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
44490         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
44491         uint64_t ret_ref = 0;
44492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44494         return ret_ref;
44495 }
44496
44497 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
44498         LDKNodeInfo ret_var = NodeInfo_clone(arg);
44499         uint64_t ret_ref = 0;
44500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44502         return ret_ref;
44503 }
44504 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
44505         LDKNodeInfo arg_conv;
44506         arg_conv.inner = untag_ptr(arg);
44507         arg_conv.is_owned = ptr_is_owned(arg);
44508         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44509         arg_conv.is_owned = false;
44510         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
44511         return ret_conv;
44512 }
44513
44514 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
44515         LDKNodeInfo orig_conv;
44516         orig_conv.inner = untag_ptr(orig);
44517         orig_conv.is_owned = ptr_is_owned(orig);
44518         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44519         orig_conv.is_owned = false;
44520         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
44521         uint64_t ret_ref = 0;
44522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44524         return ret_ref;
44525 }
44526
44527 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
44528         LDKNodeInfo a_conv;
44529         a_conv.inner = untag_ptr(a);
44530         a_conv.is_owned = ptr_is_owned(a);
44531         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44532         a_conv.is_owned = false;
44533         LDKNodeInfo b_conv;
44534         b_conv.inner = untag_ptr(b);
44535         b_conv.is_owned = ptr_is_owned(b);
44536         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44537         b_conv.is_owned = false;
44538         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
44539         return ret_conv;
44540 }
44541
44542 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
44543         LDKNodeInfo obj_conv;
44544         obj_conv.inner = untag_ptr(obj);
44545         obj_conv.is_owned = ptr_is_owned(obj);
44546         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44547         obj_conv.is_owned = false;
44548         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
44549         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44550         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44551         CVec_u8Z_free(ret_var);
44552         return ret_arr;
44553 }
44554
44555 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
44556         LDKu8slice ser_ref;
44557         ser_ref.datalen = ser->arr_len;
44558         ser_ref.data = ser->elems;
44559         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
44560         *ret_conv = NodeInfo_read(ser_ref);
44561         FREE(ser);
44562         return tag_ptr(ret_conv, true);
44563 }
44564
44565 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
44566         LDKNetworkGraph obj_conv;
44567         obj_conv.inner = untag_ptr(obj);
44568         obj_conv.is_owned = ptr_is_owned(obj);
44569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44570         obj_conv.is_owned = false;
44571         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
44572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44574         CVec_u8Z_free(ret_var);
44575         return ret_arr;
44576 }
44577
44578 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
44579         LDKu8slice ser_ref;
44580         ser_ref.datalen = ser->arr_len;
44581         ser_ref.data = ser->elems;
44582         void* arg_ptr = untag_ptr(arg);
44583         CHECK_ACCESS(arg_ptr);
44584         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
44585         if (arg_conv.free == LDKLogger_JCalls_free) {
44586                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44587                 LDKLogger_JCalls_cloned(&arg_conv);
44588         }
44589         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
44590         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
44591         FREE(ser);
44592         return tag_ptr(ret_conv, true);
44593 }
44594
44595 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
44596         LDKNetwork network_conv = LDKNetwork_from_js(network);
44597         void* logger_ptr = untag_ptr(logger);
44598         CHECK_ACCESS(logger_ptr);
44599         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44600         if (logger_conv.free == LDKLogger_JCalls_free) {
44601                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44602                 LDKLogger_JCalls_cloned(&logger_conv);
44603         }
44604         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
44605         uint64_t ret_ref = 0;
44606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44608         return ret_ref;
44609 }
44610
44611 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
44612         LDKNetworkGraph this_arg_conv;
44613         this_arg_conv.inner = untag_ptr(this_arg);
44614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44616         this_arg_conv.is_owned = false;
44617         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
44618         uint64_t ret_ref = 0;
44619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44621         return ret_ref;
44622 }
44623
44624 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) {
44625         LDKNetworkGraph this_arg_conv;
44626         this_arg_conv.inner = untag_ptr(this_arg);
44627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44629         this_arg_conv.is_owned = false;
44630         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
44631         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
44632         uint64_t ret_ref = tag_ptr(ret_copy, true);
44633         return ret_ref;
44634 }
44635
44636 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) {
44637         LDKNetworkGraph this_arg_conv;
44638         this_arg_conv.inner = untag_ptr(this_arg);
44639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44641         this_arg_conv.is_owned = false;
44642         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
44643 }
44644
44645 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
44646         LDKNetworkGraph this_arg_conv;
44647         this_arg_conv.inner = untag_ptr(this_arg);
44648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44650         this_arg_conv.is_owned = false;
44651         LDKNodeAnnouncement msg_conv;
44652         msg_conv.inner = untag_ptr(msg);
44653         msg_conv.is_owned = ptr_is_owned(msg);
44654         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44655         msg_conv.is_owned = false;
44656         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44657         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
44658         return tag_ptr(ret_conv, true);
44659 }
44660
44661 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) {
44662         LDKNetworkGraph this_arg_conv;
44663         this_arg_conv.inner = untag_ptr(this_arg);
44664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44666         this_arg_conv.is_owned = false;
44667         LDKUnsignedNodeAnnouncement msg_conv;
44668         msg_conv.inner = untag_ptr(msg);
44669         msg_conv.is_owned = ptr_is_owned(msg);
44670         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44671         msg_conv.is_owned = false;
44672         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44673         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
44674         return tag_ptr(ret_conv, true);
44675 }
44676
44677 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) {
44678         LDKNetworkGraph this_arg_conv;
44679         this_arg_conv.inner = untag_ptr(this_arg);
44680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44682         this_arg_conv.is_owned = false;
44683         LDKChannelAnnouncement msg_conv;
44684         msg_conv.inner = untag_ptr(msg);
44685         msg_conv.is_owned = ptr_is_owned(msg);
44686         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44687         msg_conv.is_owned = false;
44688         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44689         CHECK_ACCESS(utxo_lookup_ptr);
44690         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44691         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44692         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44693                 // Manually implement clone for Java trait instances
44694                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44695                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44696                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44697                 }
44698         }
44699         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44700         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
44701         return tag_ptr(ret_conv, true);
44702 }
44703
44704 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) {
44705         LDKNetworkGraph this_arg_conv;
44706         this_arg_conv.inner = untag_ptr(this_arg);
44707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44709         this_arg_conv.is_owned = false;
44710         LDKUnsignedChannelAnnouncement msg_conv;
44711         msg_conv.inner = untag_ptr(msg);
44712         msg_conv.is_owned = ptr_is_owned(msg);
44713         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44714         msg_conv.is_owned = false;
44715         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44716         CHECK_ACCESS(utxo_lookup_ptr);
44717         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44718         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44719         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44720                 // Manually implement clone for Java trait instances
44721                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44722                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44723                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44724                 }
44725         }
44726         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44727         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
44728         return tag_ptr(ret_conv, true);
44729 }
44730
44731 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) {
44732         LDKNetworkGraph this_arg_conv;
44733         this_arg_conv.inner = untag_ptr(this_arg);
44734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44736         this_arg_conv.is_owned = false;
44737         LDKChannelFeatures features_conv;
44738         features_conv.inner = untag_ptr(features);
44739         features_conv.is_owned = ptr_is_owned(features);
44740         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
44741         features_conv = ChannelFeatures_clone(&features_conv);
44742         LDKPublicKey node_id_1_ref;
44743         CHECK(node_id_1->arr_len == 33);
44744         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
44745         LDKPublicKey node_id_2_ref;
44746         CHECK(node_id_2->arr_len == 33);
44747         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
44748         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44749         *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);
44750         return tag_ptr(ret_conv, true);
44751 }
44752
44753 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
44754         LDKNetworkGraph this_arg_conv;
44755         this_arg_conv.inner = untag_ptr(this_arg);
44756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44758         this_arg_conv.is_owned = false;
44759         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
44760 }
44761
44762 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
44763         LDKNetworkGraph this_arg_conv;
44764         this_arg_conv.inner = untag_ptr(this_arg);
44765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44767         this_arg_conv.is_owned = false;
44768         LDKPublicKey node_id_ref;
44769         CHECK(node_id->arr_len == 33);
44770         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
44771         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
44772 }
44773
44774 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) {
44775         LDKNetworkGraph this_arg_conv;
44776         this_arg_conv.inner = untag_ptr(this_arg);
44777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44779         this_arg_conv.is_owned = false;
44780         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
44781 }
44782
44783 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
44784         LDKNetworkGraph this_arg_conv;
44785         this_arg_conv.inner = untag_ptr(this_arg);
44786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44788         this_arg_conv.is_owned = false;
44789         LDKChannelUpdate msg_conv;
44790         msg_conv.inner = untag_ptr(msg);
44791         msg_conv.is_owned = ptr_is_owned(msg);
44792         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44793         msg_conv.is_owned = false;
44794         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44795         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
44796         return tag_ptr(ret_conv, true);
44797 }
44798
44799 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
44800         LDKNetworkGraph this_arg_conv;
44801         this_arg_conv.inner = untag_ptr(this_arg);
44802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44804         this_arg_conv.is_owned = false;
44805         LDKUnsignedChannelUpdate msg_conv;
44806         msg_conv.inner = untag_ptr(msg);
44807         msg_conv.is_owned = ptr_is_owned(msg);
44808         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44809         msg_conv.is_owned = false;
44810         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44811         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
44812         return tag_ptr(ret_conv, true);
44813 }
44814
44815 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
44816         LDKReadOnlyNetworkGraph this_arg_conv;
44817         this_arg_conv.inner = untag_ptr(this_arg);
44818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44820         this_arg_conv.is_owned = false;
44821         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
44822         uint64_t ret_ref = 0;
44823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44825         return ret_ref;
44826 }
44827
44828 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
44829         LDKReadOnlyNetworkGraph this_arg_conv;
44830         this_arg_conv.inner = untag_ptr(this_arg);
44831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44833         this_arg_conv.is_owned = false;
44834         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
44835         int64_tArray ret_arr = NULL;
44836         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44837         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44838         for (size_t i = 0; i < ret_var.datalen; i++) {
44839                 int64_t ret_conv_8_conv = ret_var.data[i];
44840                 ret_arr_ptr[i] = ret_conv_8_conv;
44841         }
44842         
44843         FREE(ret_var.data);
44844         return ret_arr;
44845 }
44846
44847 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
44848         LDKReadOnlyNetworkGraph this_arg_conv;
44849         this_arg_conv.inner = untag_ptr(this_arg);
44850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44852         this_arg_conv.is_owned = false;
44853         LDKNodeId node_id_conv;
44854         node_id_conv.inner = untag_ptr(node_id);
44855         node_id_conv.is_owned = ptr_is_owned(node_id);
44856         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44857         node_id_conv.is_owned = false;
44858         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
44859         uint64_t ret_ref = 0;
44860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44862         return ret_ref;
44863 }
44864
44865 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
44866         LDKReadOnlyNetworkGraph this_arg_conv;
44867         this_arg_conv.inner = untag_ptr(this_arg);
44868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44870         this_arg_conv.is_owned = false;
44871         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
44872         uint64_tArray ret_arr = NULL;
44873         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44874         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44875         for (size_t i = 0; i < ret_var.datalen; i++) {
44876                 LDKNodeId ret_conv_8_var = ret_var.data[i];
44877                 uint64_t ret_conv_8_ref = 0;
44878                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
44879                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
44880                 ret_arr_ptr[i] = ret_conv_8_ref;
44881         }
44882         
44883         FREE(ret_var.data);
44884         return ret_arr;
44885 }
44886
44887 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
44888         LDKReadOnlyNetworkGraph this_arg_conv;
44889         this_arg_conv.inner = untag_ptr(this_arg);
44890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44892         this_arg_conv.is_owned = false;
44893         LDKPublicKey pubkey_ref;
44894         CHECK(pubkey->arr_len == 33);
44895         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
44896         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
44897         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
44898         uint64_t ret_ref = tag_ptr(ret_copy, true);
44899         return ret_ref;
44900 }
44901
44902 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
44903         LDKDefaultRouter this_obj_conv;
44904         this_obj_conv.inner = untag_ptr(this_obj);
44905         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44907         DefaultRouter_free(this_obj_conv);
44908 }
44909
44910 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) {
44911         LDKNetworkGraph network_graph_conv;
44912         network_graph_conv.inner = untag_ptr(network_graph);
44913         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44914         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44915         network_graph_conv.is_owned = false;
44916         void* logger_ptr = untag_ptr(logger);
44917         CHECK_ACCESS(logger_ptr);
44918         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44919         if (logger_conv.free == LDKLogger_JCalls_free) {
44920                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44921                 LDKLogger_JCalls_cloned(&logger_conv);
44922         }
44923         LDKThirtyTwoBytes random_seed_bytes_ref;
44924         CHECK(random_seed_bytes->arr_len == 32);
44925         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
44926         void* scorer_ptr = untag_ptr(scorer);
44927         CHECK_ACCESS(scorer_ptr);
44928         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
44929         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
44930                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44931                 LDKLockableScore_JCalls_cloned(&scorer_conv);
44932         }
44933         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
44934         uint64_t ret_ref = 0;
44935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44937         return ret_ref;
44938 }
44939
44940 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
44941         LDKDefaultRouter this_arg_conv;
44942         this_arg_conv.inner = untag_ptr(this_arg);
44943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44945         this_arg_conv.is_owned = false;
44946         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
44947         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
44948         return tag_ptr(ret_ret, true);
44949 }
44950
44951 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
44952         if (!ptr_is_owned(this_ptr)) return;
44953         void* this_ptr_ptr = untag_ptr(this_ptr);
44954         CHECK_ACCESS(this_ptr_ptr);
44955         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
44956         FREE(untag_ptr(this_ptr));
44957         Router_free(this_ptr_conv);
44958 }
44959
44960 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
44961         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
44962         this_obj_conv.inner = untag_ptr(this_obj);
44963         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44965         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
44966 }
44967
44968 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
44969         void* scorer_ptr = untag_ptr(scorer);
44970         CHECK_ACCESS(scorer_ptr);
44971         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
44972         if (scorer_conv.free == LDKScore_JCalls_free) {
44973                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44974                 LDKScore_JCalls_cloned(&scorer_conv);
44975         }
44976         LDKInFlightHtlcs inflight_htlcs_conv;
44977         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
44978         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
44979         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
44980         inflight_htlcs_conv.is_owned = false;
44981         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
44982         uint64_t ret_ref = 0;
44983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44985         return ret_ref;
44986 }
44987
44988 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
44989         LDKScorerAccountingForInFlightHtlcs obj_conv;
44990         obj_conv.inner = untag_ptr(obj);
44991         obj_conv.is_owned = ptr_is_owned(obj);
44992         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44993         obj_conv.is_owned = false;
44994         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
44995         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44996         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44997         CVec_u8Z_free(ret_var);
44998         return ret_arr;
44999 }
45000
45001 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
45002         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
45003         this_arg_conv.inner = untag_ptr(this_arg);
45004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45006         this_arg_conv.is_owned = false;
45007         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45008         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
45009         return tag_ptr(ret_ret, true);
45010 }
45011
45012 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
45013         LDKInFlightHtlcs this_obj_conv;
45014         this_obj_conv.inner = untag_ptr(this_obj);
45015         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45017         InFlightHtlcs_free(this_obj_conv);
45018 }
45019
45020 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
45021         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
45022         uint64_t ret_ref = 0;
45023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45025         return ret_ref;
45026 }
45027 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
45028         LDKInFlightHtlcs arg_conv;
45029         arg_conv.inner = untag_ptr(arg);
45030         arg_conv.is_owned = ptr_is_owned(arg);
45031         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45032         arg_conv.is_owned = false;
45033         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
45034         return ret_conv;
45035 }
45036
45037 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
45038         LDKInFlightHtlcs orig_conv;
45039         orig_conv.inner = untag_ptr(orig);
45040         orig_conv.is_owned = ptr_is_owned(orig);
45041         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45042         orig_conv.is_owned = false;
45043         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
45044         uint64_t ret_ref = 0;
45045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45047         return ret_ref;
45048 }
45049
45050 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
45051         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
45052         uint64_t ret_ref = 0;
45053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45055         return ret_ref;
45056 }
45057
45058 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) {
45059         LDKInFlightHtlcs this_arg_conv;
45060         this_arg_conv.inner = untag_ptr(this_arg);
45061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45063         this_arg_conv.is_owned = false;
45064         LDKNodeId source_conv;
45065         source_conv.inner = untag_ptr(source);
45066         source_conv.is_owned = ptr_is_owned(source);
45067         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
45068         source_conv.is_owned = false;
45069         LDKNodeId target_conv;
45070         target_conv.inner = untag_ptr(target);
45071         target_conv.is_owned = ptr_is_owned(target);
45072         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
45073         target_conv.is_owned = false;
45074         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45075         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
45076         uint64_t ret_ref = tag_ptr(ret_copy, true);
45077         return ret_ref;
45078 }
45079
45080 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
45081         LDKInFlightHtlcs obj_conv;
45082         obj_conv.inner = untag_ptr(obj);
45083         obj_conv.is_owned = ptr_is_owned(obj);
45084         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45085         obj_conv.is_owned = false;
45086         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
45087         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45088         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45089         CVec_u8Z_free(ret_var);
45090         return ret_arr;
45091 }
45092
45093 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
45094         LDKu8slice ser_ref;
45095         ser_ref.datalen = ser->arr_len;
45096         ser_ref.data = ser->elems;
45097         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
45098         *ret_conv = InFlightHtlcs_read(ser_ref);
45099         FREE(ser);
45100         return tag_ptr(ret_conv, true);
45101 }
45102
45103 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
45104         LDKRouteHop this_obj_conv;
45105         this_obj_conv.inner = untag_ptr(this_obj);
45106         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45108         RouteHop_free(this_obj_conv);
45109 }
45110
45111 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
45112         LDKRouteHop this_ptr_conv;
45113         this_ptr_conv.inner = untag_ptr(this_ptr);
45114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45116         this_ptr_conv.is_owned = false;
45117         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45118         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
45119         return ret_arr;
45120 }
45121
45122 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
45123         LDKRouteHop this_ptr_conv;
45124         this_ptr_conv.inner = untag_ptr(this_ptr);
45125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45127         this_ptr_conv.is_owned = false;
45128         LDKPublicKey val_ref;
45129         CHECK(val->arr_len == 33);
45130         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45131         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
45132 }
45133
45134 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
45135         LDKRouteHop this_ptr_conv;
45136         this_ptr_conv.inner = untag_ptr(this_ptr);
45137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45139         this_ptr_conv.is_owned = false;
45140         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
45141         uint64_t ret_ref = 0;
45142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45144         return ret_ref;
45145 }
45146
45147 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
45148         LDKRouteHop this_ptr_conv;
45149         this_ptr_conv.inner = untag_ptr(this_ptr);
45150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45152         this_ptr_conv.is_owned = false;
45153         LDKNodeFeatures val_conv;
45154         val_conv.inner = untag_ptr(val);
45155         val_conv.is_owned = ptr_is_owned(val);
45156         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45157         val_conv = NodeFeatures_clone(&val_conv);
45158         RouteHop_set_node_features(&this_ptr_conv, val_conv);
45159 }
45160
45161 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
45162         LDKRouteHop this_ptr_conv;
45163         this_ptr_conv.inner = untag_ptr(this_ptr);
45164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45166         this_ptr_conv.is_owned = false;
45167         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
45168         return ret_conv;
45169 }
45170
45171 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
45172         LDKRouteHop this_ptr_conv;
45173         this_ptr_conv.inner = untag_ptr(this_ptr);
45174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45176         this_ptr_conv.is_owned = false;
45177         RouteHop_set_short_channel_id(&this_ptr_conv, val);
45178 }
45179
45180 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
45181         LDKRouteHop this_ptr_conv;
45182         this_ptr_conv.inner = untag_ptr(this_ptr);
45183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45185         this_ptr_conv.is_owned = false;
45186         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
45187         uint64_t ret_ref = 0;
45188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45190         return ret_ref;
45191 }
45192
45193 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
45194         LDKRouteHop this_ptr_conv;
45195         this_ptr_conv.inner = untag_ptr(this_ptr);
45196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45198         this_ptr_conv.is_owned = false;
45199         LDKChannelFeatures val_conv;
45200         val_conv.inner = untag_ptr(val);
45201         val_conv.is_owned = ptr_is_owned(val);
45202         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45203         val_conv = ChannelFeatures_clone(&val_conv);
45204         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
45205 }
45206
45207 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
45208         LDKRouteHop this_ptr_conv;
45209         this_ptr_conv.inner = untag_ptr(this_ptr);
45210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45212         this_ptr_conv.is_owned = false;
45213         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
45214         return ret_conv;
45215 }
45216
45217 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
45218         LDKRouteHop this_ptr_conv;
45219         this_ptr_conv.inner = untag_ptr(this_ptr);
45220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45222         this_ptr_conv.is_owned = false;
45223         RouteHop_set_fee_msat(&this_ptr_conv, val);
45224 }
45225
45226 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
45227         LDKRouteHop this_ptr_conv;
45228         this_ptr_conv.inner = untag_ptr(this_ptr);
45229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45231         this_ptr_conv.is_owned = false;
45232         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
45233         return ret_conv;
45234 }
45235
45236 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
45237         LDKRouteHop this_ptr_conv;
45238         this_ptr_conv.inner = untag_ptr(this_ptr);
45239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45241         this_ptr_conv.is_owned = false;
45242         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
45243 }
45244
45245 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) {
45246         LDKPublicKey pubkey_arg_ref;
45247         CHECK(pubkey_arg->arr_len == 33);
45248         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
45249         LDKNodeFeatures node_features_arg_conv;
45250         node_features_arg_conv.inner = untag_ptr(node_features_arg);
45251         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
45252         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
45253         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
45254         LDKChannelFeatures channel_features_arg_conv;
45255         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
45256         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
45257         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
45258         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
45259         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);
45260         uint64_t ret_ref = 0;
45261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45263         return ret_ref;
45264 }
45265
45266 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
45267         LDKRouteHop ret_var = RouteHop_clone(arg);
45268         uint64_t ret_ref = 0;
45269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45271         return ret_ref;
45272 }
45273 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
45274         LDKRouteHop arg_conv;
45275         arg_conv.inner = untag_ptr(arg);
45276         arg_conv.is_owned = ptr_is_owned(arg);
45277         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45278         arg_conv.is_owned = false;
45279         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
45280         return ret_conv;
45281 }
45282
45283 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
45284         LDKRouteHop orig_conv;
45285         orig_conv.inner = untag_ptr(orig);
45286         orig_conv.is_owned = ptr_is_owned(orig);
45287         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45288         orig_conv.is_owned = false;
45289         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
45290         uint64_t ret_ref = 0;
45291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45293         return ret_ref;
45294 }
45295
45296 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
45297         LDKRouteHop o_conv;
45298         o_conv.inner = untag_ptr(o);
45299         o_conv.is_owned = ptr_is_owned(o);
45300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45301         o_conv.is_owned = false;
45302         int64_t ret_conv = RouteHop_hash(&o_conv);
45303         return ret_conv;
45304 }
45305
45306 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
45307         LDKRouteHop a_conv;
45308         a_conv.inner = untag_ptr(a);
45309         a_conv.is_owned = ptr_is_owned(a);
45310         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45311         a_conv.is_owned = false;
45312         LDKRouteHop b_conv;
45313         b_conv.inner = untag_ptr(b);
45314         b_conv.is_owned = ptr_is_owned(b);
45315         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45316         b_conv.is_owned = false;
45317         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
45318         return ret_conv;
45319 }
45320
45321 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
45322         LDKRouteHop obj_conv;
45323         obj_conv.inner = untag_ptr(obj);
45324         obj_conv.is_owned = ptr_is_owned(obj);
45325         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45326         obj_conv.is_owned = false;
45327         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
45328         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45329         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45330         CVec_u8Z_free(ret_var);
45331         return ret_arr;
45332 }
45333
45334 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
45335         LDKu8slice ser_ref;
45336         ser_ref.datalen = ser->arr_len;
45337         ser_ref.data = ser->elems;
45338         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
45339         *ret_conv = RouteHop_read(ser_ref);
45340         FREE(ser);
45341         return tag_ptr(ret_conv, true);
45342 }
45343
45344 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
45345         LDKRoute this_obj_conv;
45346         this_obj_conv.inner = untag_ptr(this_obj);
45347         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45349         Route_free(this_obj_conv);
45350 }
45351
45352 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
45353         LDKRoute this_ptr_conv;
45354         this_ptr_conv.inner = untag_ptr(this_ptr);
45355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45357         this_ptr_conv.is_owned = false;
45358         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
45359         ptrArray ret_arr = NULL;
45360         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
45361         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
45362         for (size_t m = 0; m < ret_var.datalen; m++) {
45363                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
45364                 uint64_tArray ret_conv_12_arr = NULL;
45365                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
45366                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
45367                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
45368                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
45369                         uint64_t ret_conv_12_conv_10_ref = 0;
45370                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
45371                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
45372                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
45373                 }
45374                 
45375                 FREE(ret_conv_12_var.data);
45376                 ret_arr_ptr[m] = ret_conv_12_arr;
45377         }
45378         
45379         FREE(ret_var.data);
45380         return ret_arr;
45381 }
45382
45383 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
45384         LDKRoute this_ptr_conv;
45385         this_ptr_conv.inner = untag_ptr(this_ptr);
45386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45388         this_ptr_conv.is_owned = false;
45389         LDKCVec_CVec_RouteHopZZ val_constr;
45390         val_constr.datalen = val->arr_len;
45391         if (val_constr.datalen > 0)
45392                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45393         else
45394                 val_constr.data = NULL;
45395         uint64_tArray* val_vals = (void*) val->elems;
45396         for (size_t m = 0; m < val_constr.datalen; m++) {
45397                 uint64_tArray val_conv_12 = val_vals[m];
45398                 LDKCVec_RouteHopZ val_conv_12_constr;
45399                 val_conv_12_constr.datalen = val_conv_12->arr_len;
45400                 if (val_conv_12_constr.datalen > 0)
45401                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45402                 else
45403                         val_conv_12_constr.data = NULL;
45404                 uint64_t* val_conv_12_vals = val_conv_12->elems;
45405                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
45406                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
45407                         LDKRouteHop val_conv_12_conv_10_conv;
45408                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
45409                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
45410                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
45411                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
45412                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
45413                 }
45414                 FREE(val_conv_12);
45415                 val_constr.data[m] = val_conv_12_constr;
45416         }
45417         FREE(val);
45418         Route_set_paths(&this_ptr_conv, val_constr);
45419 }
45420
45421 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
45422         LDKRoute this_ptr_conv;
45423         this_ptr_conv.inner = untag_ptr(this_ptr);
45424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45426         this_ptr_conv.is_owned = false;
45427         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
45428         uint64_t ret_ref = 0;
45429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45431         return ret_ref;
45432 }
45433
45434 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
45435         LDKRoute this_ptr_conv;
45436         this_ptr_conv.inner = untag_ptr(this_ptr);
45437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45439         this_ptr_conv.is_owned = false;
45440         LDKPaymentParameters val_conv;
45441         val_conv.inner = untag_ptr(val);
45442         val_conv.is_owned = ptr_is_owned(val);
45443         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45444         val_conv = PaymentParameters_clone(&val_conv);
45445         Route_set_payment_params(&this_ptr_conv, val_conv);
45446 }
45447
45448 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
45449         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
45450         paths_arg_constr.datalen = paths_arg->arr_len;
45451         if (paths_arg_constr.datalen > 0)
45452                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45453         else
45454                 paths_arg_constr.data = NULL;
45455         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
45456         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
45457                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
45458                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
45459                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
45460                 if (paths_arg_conv_12_constr.datalen > 0)
45461                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45462                 else
45463                         paths_arg_conv_12_constr.data = NULL;
45464                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
45465                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
45466                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
45467                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
45468                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
45469                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
45470                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
45471                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
45472                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
45473                 }
45474                 FREE(paths_arg_conv_12);
45475                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
45476         }
45477         FREE(paths_arg);
45478         LDKPaymentParameters payment_params_arg_conv;
45479         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
45480         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
45481         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45482         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45483         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
45484         uint64_t ret_ref = 0;
45485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45487         return ret_ref;
45488 }
45489
45490 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
45491         LDKRoute ret_var = Route_clone(arg);
45492         uint64_t ret_ref = 0;
45493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45495         return ret_ref;
45496 }
45497 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
45498         LDKRoute arg_conv;
45499         arg_conv.inner = untag_ptr(arg);
45500         arg_conv.is_owned = ptr_is_owned(arg);
45501         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45502         arg_conv.is_owned = false;
45503         int64_t ret_conv = Route_clone_ptr(&arg_conv);
45504         return ret_conv;
45505 }
45506
45507 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
45508         LDKRoute orig_conv;
45509         orig_conv.inner = untag_ptr(orig);
45510         orig_conv.is_owned = ptr_is_owned(orig);
45511         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45512         orig_conv.is_owned = false;
45513         LDKRoute ret_var = Route_clone(&orig_conv);
45514         uint64_t ret_ref = 0;
45515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45517         return ret_ref;
45518 }
45519
45520 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
45521         LDKRoute o_conv;
45522         o_conv.inner = untag_ptr(o);
45523         o_conv.is_owned = ptr_is_owned(o);
45524         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45525         o_conv.is_owned = false;
45526         int64_t ret_conv = Route_hash(&o_conv);
45527         return ret_conv;
45528 }
45529
45530 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
45531         LDKRoute a_conv;
45532         a_conv.inner = untag_ptr(a);
45533         a_conv.is_owned = ptr_is_owned(a);
45534         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45535         a_conv.is_owned = false;
45536         LDKRoute b_conv;
45537         b_conv.inner = untag_ptr(b);
45538         b_conv.is_owned = ptr_is_owned(b);
45539         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45540         b_conv.is_owned = false;
45541         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
45542         return ret_conv;
45543 }
45544
45545 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
45546         LDKRoute this_arg_conv;
45547         this_arg_conv.inner = untag_ptr(this_arg);
45548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45550         this_arg_conv.is_owned = false;
45551         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
45552         return ret_conv;
45553 }
45554
45555 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
45556         LDKRoute this_arg_conv;
45557         this_arg_conv.inner = untag_ptr(this_arg);
45558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45560         this_arg_conv.is_owned = false;
45561         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
45562         return ret_conv;
45563 }
45564
45565 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
45566         LDKRoute obj_conv;
45567         obj_conv.inner = untag_ptr(obj);
45568         obj_conv.is_owned = ptr_is_owned(obj);
45569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45570         obj_conv.is_owned = false;
45571         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
45572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45574         CVec_u8Z_free(ret_var);
45575         return ret_arr;
45576 }
45577
45578 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
45579         LDKu8slice ser_ref;
45580         ser_ref.datalen = ser->arr_len;
45581         ser_ref.data = ser->elems;
45582         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
45583         *ret_conv = Route_read(ser_ref);
45584         FREE(ser);
45585         return tag_ptr(ret_conv, true);
45586 }
45587
45588 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
45589         LDKRouteParameters this_obj_conv;
45590         this_obj_conv.inner = untag_ptr(this_obj);
45591         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45593         RouteParameters_free(this_obj_conv);
45594 }
45595
45596 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
45597         LDKRouteParameters this_ptr_conv;
45598         this_ptr_conv.inner = untag_ptr(this_ptr);
45599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45601         this_ptr_conv.is_owned = false;
45602         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
45603         uint64_t ret_ref = 0;
45604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45606         return ret_ref;
45607 }
45608
45609 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
45610         LDKRouteParameters this_ptr_conv;
45611         this_ptr_conv.inner = untag_ptr(this_ptr);
45612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45614         this_ptr_conv.is_owned = false;
45615         LDKPaymentParameters val_conv;
45616         val_conv.inner = untag_ptr(val);
45617         val_conv.is_owned = ptr_is_owned(val);
45618         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45619         val_conv = PaymentParameters_clone(&val_conv);
45620         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
45621 }
45622
45623 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
45624         LDKRouteParameters this_ptr_conv;
45625         this_ptr_conv.inner = untag_ptr(this_ptr);
45626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45628         this_ptr_conv.is_owned = false;
45629         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
45630         return ret_conv;
45631 }
45632
45633 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
45634         LDKRouteParameters this_ptr_conv;
45635         this_ptr_conv.inner = untag_ptr(this_ptr);
45636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45638         this_ptr_conv.is_owned = false;
45639         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
45640 }
45641
45642 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) {
45643         LDKPaymentParameters payment_params_arg_conv;
45644         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
45645         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
45646         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45647         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45648         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
45649         uint64_t ret_ref = 0;
45650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45652         return ret_ref;
45653 }
45654
45655 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
45656         LDKRouteParameters ret_var = RouteParameters_clone(arg);
45657         uint64_t ret_ref = 0;
45658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45660         return ret_ref;
45661 }
45662 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
45663         LDKRouteParameters arg_conv;
45664         arg_conv.inner = untag_ptr(arg);
45665         arg_conv.is_owned = ptr_is_owned(arg);
45666         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45667         arg_conv.is_owned = false;
45668         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
45669         return ret_conv;
45670 }
45671
45672 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
45673         LDKRouteParameters orig_conv;
45674         orig_conv.inner = untag_ptr(orig);
45675         orig_conv.is_owned = ptr_is_owned(orig);
45676         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45677         orig_conv.is_owned = false;
45678         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
45679         uint64_t ret_ref = 0;
45680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45682         return ret_ref;
45683 }
45684
45685 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
45686         LDKRouteParameters a_conv;
45687         a_conv.inner = untag_ptr(a);
45688         a_conv.is_owned = ptr_is_owned(a);
45689         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45690         a_conv.is_owned = false;
45691         LDKRouteParameters b_conv;
45692         b_conv.inner = untag_ptr(b);
45693         b_conv.is_owned = ptr_is_owned(b);
45694         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45695         b_conv.is_owned = false;
45696         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
45697         return ret_conv;
45698 }
45699
45700 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
45701         LDKRouteParameters obj_conv;
45702         obj_conv.inner = untag_ptr(obj);
45703         obj_conv.is_owned = ptr_is_owned(obj);
45704         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45705         obj_conv.is_owned = false;
45706         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
45707         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45708         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45709         CVec_u8Z_free(ret_var);
45710         return ret_arr;
45711 }
45712
45713 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
45714         LDKu8slice ser_ref;
45715         ser_ref.datalen = ser->arr_len;
45716         ser_ref.data = ser->elems;
45717         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
45718         *ret_conv = RouteParameters_read(ser_ref);
45719         FREE(ser);
45720         return tag_ptr(ret_conv, true);
45721 }
45722
45723 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
45724         LDKPaymentParameters this_obj_conv;
45725         this_obj_conv.inner = untag_ptr(this_obj);
45726         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45728         PaymentParameters_free(this_obj_conv);
45729 }
45730
45731 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
45732         LDKPaymentParameters this_ptr_conv;
45733         this_ptr_conv.inner = untag_ptr(this_ptr);
45734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45736         this_ptr_conv.is_owned = false;
45737         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45738         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
45739         return ret_arr;
45740 }
45741
45742 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
45743         LDKPaymentParameters this_ptr_conv;
45744         this_ptr_conv.inner = untag_ptr(this_ptr);
45745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45747         this_ptr_conv.is_owned = false;
45748         LDKPublicKey val_ref;
45749         CHECK(val->arr_len == 33);
45750         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45751         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
45752 }
45753
45754 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
45755         LDKPaymentParameters this_ptr_conv;
45756         this_ptr_conv.inner = untag_ptr(this_ptr);
45757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45759         this_ptr_conv.is_owned = false;
45760         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
45761         uint64_t ret_ref = 0;
45762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45764         return ret_ref;
45765 }
45766
45767 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
45768         LDKPaymentParameters this_ptr_conv;
45769         this_ptr_conv.inner = untag_ptr(this_ptr);
45770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45772         this_ptr_conv.is_owned = false;
45773         LDKInvoiceFeatures val_conv;
45774         val_conv.inner = untag_ptr(val);
45775         val_conv.is_owned = ptr_is_owned(val);
45776         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45777         val_conv = InvoiceFeatures_clone(&val_conv);
45778         PaymentParameters_set_features(&this_ptr_conv, val_conv);
45779 }
45780
45781 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
45782         LDKPaymentParameters this_ptr_conv;
45783         this_ptr_conv.inner = untag_ptr(this_ptr);
45784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45786         this_ptr_conv.is_owned = false;
45787         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
45788         uint64_tArray ret_arr = NULL;
45789         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45790         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45791         for (size_t l = 0; l < ret_var.datalen; l++) {
45792                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
45793                 uint64_t ret_conv_11_ref = 0;
45794                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
45795                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
45796                 ret_arr_ptr[l] = ret_conv_11_ref;
45797         }
45798         
45799         FREE(ret_var.data);
45800         return ret_arr;
45801 }
45802
45803 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
45804         LDKPaymentParameters this_ptr_conv;
45805         this_ptr_conv.inner = untag_ptr(this_ptr);
45806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45808         this_ptr_conv.is_owned = false;
45809         LDKCVec_RouteHintZ val_constr;
45810         val_constr.datalen = val->arr_len;
45811         if (val_constr.datalen > 0)
45812                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
45813         else
45814                 val_constr.data = NULL;
45815         uint64_t* val_vals = val->elems;
45816         for (size_t l = 0; l < val_constr.datalen; l++) {
45817                 uint64_t val_conv_11 = val_vals[l];
45818                 LDKRouteHint val_conv_11_conv;
45819                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
45820                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
45821                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
45822                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
45823                 val_constr.data[l] = val_conv_11_conv;
45824         }
45825         FREE(val);
45826         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
45827 }
45828
45829 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
45830         LDKPaymentParameters this_ptr_conv;
45831         this_ptr_conv.inner = untag_ptr(this_ptr);
45832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45834         this_ptr_conv.is_owned = false;
45835         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45836         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
45837         uint64_t ret_ref = tag_ptr(ret_copy, true);
45838         return ret_ref;
45839 }
45840
45841 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
45842         LDKPaymentParameters this_ptr_conv;
45843         this_ptr_conv.inner = untag_ptr(this_ptr);
45844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45846         this_ptr_conv.is_owned = false;
45847         void* val_ptr = untag_ptr(val);
45848         CHECK_ACCESS(val_ptr);
45849         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45850         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45851         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
45852 }
45853
45854 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) {
45855         LDKPaymentParameters this_ptr_conv;
45856         this_ptr_conv.inner = untag_ptr(this_ptr);
45857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45859         this_ptr_conv.is_owned = false;
45860         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
45861         return ret_conv;
45862 }
45863
45864 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) {
45865         LDKPaymentParameters this_ptr_conv;
45866         this_ptr_conv.inner = untag_ptr(this_ptr);
45867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45869         this_ptr_conv.is_owned = false;
45870         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
45871 }
45872
45873 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
45874         LDKPaymentParameters this_ptr_conv;
45875         this_ptr_conv.inner = untag_ptr(this_ptr);
45876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45878         this_ptr_conv.is_owned = false;
45879         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
45880         return ret_conv;
45881 }
45882
45883 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
45884         LDKPaymentParameters this_ptr_conv;
45885         this_ptr_conv.inner = untag_ptr(this_ptr);
45886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45888         this_ptr_conv.is_owned = false;
45889         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
45890 }
45891
45892 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) {
45893         LDKPaymentParameters this_ptr_conv;
45894         this_ptr_conv.inner = untag_ptr(this_ptr);
45895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45897         this_ptr_conv.is_owned = false;
45898         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
45899         return ret_conv;
45900 }
45901
45902 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) {
45903         LDKPaymentParameters this_ptr_conv;
45904         this_ptr_conv.inner = untag_ptr(this_ptr);
45905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45907         this_ptr_conv.is_owned = false;
45908         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
45909 }
45910
45911 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
45912         LDKPaymentParameters this_ptr_conv;
45913         this_ptr_conv.inner = untag_ptr(this_ptr);
45914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45916         this_ptr_conv.is_owned = false;
45917         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
45918         int64_tArray ret_arr = NULL;
45919         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45920         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45921         for (size_t i = 0; i < ret_var.datalen; i++) {
45922                 int64_t ret_conv_8_conv = ret_var.data[i];
45923                 ret_arr_ptr[i] = ret_conv_8_conv;
45924         }
45925         
45926         FREE(ret_var.data);
45927         return ret_arr;
45928 }
45929
45930 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
45931         LDKPaymentParameters this_ptr_conv;
45932         this_ptr_conv.inner = untag_ptr(this_ptr);
45933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45935         this_ptr_conv.is_owned = false;
45936         LDKCVec_u64Z val_constr;
45937         val_constr.datalen = val->arr_len;
45938         if (val_constr.datalen > 0)
45939                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45940         else
45941                 val_constr.data = NULL;
45942         int64_t* val_vals = val->elems;
45943         for (size_t i = 0; i < val_constr.datalen; i++) {
45944                 int64_t val_conv_8 = val_vals[i];
45945                 val_constr.data[i] = val_conv_8;
45946         }
45947         FREE(val);
45948         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
45949 }
45950
45951 int32_t  __attribute__((export_name("TS_PaymentParameters_get_final_cltv_expiry_delta"))) TS_PaymentParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
45952         LDKPaymentParameters this_ptr_conv;
45953         this_ptr_conv.inner = untag_ptr(this_ptr);
45954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45956         this_ptr_conv.is_owned = false;
45957         int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
45958         return ret_conv;
45959 }
45960
45961 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) {
45962         LDKPaymentParameters this_ptr_conv;
45963         this_ptr_conv.inner = untag_ptr(this_ptr);
45964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45966         this_ptr_conv.is_owned = false;
45967         PaymentParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
45968 }
45969
45970 uint64_t  __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentParameters_new(int8_tArray payee_pubkey_arg, uint64_t features_arg, uint64_tArray route_hints_arg, uint64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg, int32_t final_cltv_expiry_delta_arg) {
45971         LDKPublicKey payee_pubkey_arg_ref;
45972         CHECK(payee_pubkey_arg->arr_len == 33);
45973         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
45974         LDKInvoiceFeatures features_arg_conv;
45975         features_arg_conv.inner = untag_ptr(features_arg);
45976         features_arg_conv.is_owned = ptr_is_owned(features_arg);
45977         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45978         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
45979         LDKCVec_RouteHintZ route_hints_arg_constr;
45980         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
45981         if (route_hints_arg_constr.datalen > 0)
45982                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
45983         else
45984                 route_hints_arg_constr.data = NULL;
45985         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
45986         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
45987                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
45988                 LDKRouteHint route_hints_arg_conv_11_conv;
45989                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
45990                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
45991                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
45992                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
45993                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
45994         }
45995         FREE(route_hints_arg);
45996         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
45997         CHECK_ACCESS(expiry_time_arg_ptr);
45998         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
45999         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
46000         LDKCVec_u64Z previously_failed_channels_arg_constr;
46001         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
46002         if (previously_failed_channels_arg_constr.datalen > 0)
46003                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
46004         else
46005                 previously_failed_channels_arg_constr.data = NULL;
46006         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
46007         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
46008                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
46009                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
46010         }
46011         FREE(previously_failed_channels_arg);
46012         LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr, final_cltv_expiry_delta_arg);
46013         uint64_t ret_ref = 0;
46014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46016         return ret_ref;
46017 }
46018
46019 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
46020         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
46021         uint64_t ret_ref = 0;
46022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46024         return ret_ref;
46025 }
46026 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
46027         LDKPaymentParameters arg_conv;
46028         arg_conv.inner = untag_ptr(arg);
46029         arg_conv.is_owned = ptr_is_owned(arg);
46030         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46031         arg_conv.is_owned = false;
46032         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
46033         return ret_conv;
46034 }
46035
46036 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
46037         LDKPaymentParameters orig_conv;
46038         orig_conv.inner = untag_ptr(orig);
46039         orig_conv.is_owned = ptr_is_owned(orig);
46040         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46041         orig_conv.is_owned = false;
46042         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
46043         uint64_t ret_ref = 0;
46044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46046         return ret_ref;
46047 }
46048
46049 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
46050         LDKPaymentParameters o_conv;
46051         o_conv.inner = untag_ptr(o);
46052         o_conv.is_owned = ptr_is_owned(o);
46053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46054         o_conv.is_owned = false;
46055         int64_t ret_conv = PaymentParameters_hash(&o_conv);
46056         return ret_conv;
46057 }
46058
46059 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
46060         LDKPaymentParameters a_conv;
46061         a_conv.inner = untag_ptr(a);
46062         a_conv.is_owned = ptr_is_owned(a);
46063         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46064         a_conv.is_owned = false;
46065         LDKPaymentParameters b_conv;
46066         b_conv.inner = untag_ptr(b);
46067         b_conv.is_owned = ptr_is_owned(b);
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46069         b_conv.is_owned = false;
46070         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
46071         return ret_conv;
46072 }
46073
46074 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
46075         LDKPaymentParameters obj_conv;
46076         obj_conv.inner = untag_ptr(obj);
46077         obj_conv.is_owned = ptr_is_owned(obj);
46078         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46079         obj_conv.is_owned = false;
46080         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
46081         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46082         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46083         CVec_u8Z_free(ret_var);
46084         return ret_arr;
46085 }
46086
46087 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
46088         LDKu8slice ser_ref;
46089         ser_ref.datalen = ser->arr_len;
46090         ser_ref.data = ser->elems;
46091         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
46092         *ret_conv = PaymentParameters_read(ser_ref, arg);
46093         FREE(ser);
46094         return tag_ptr(ret_conv, true);
46095 }
46096
46097 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) {
46098         LDKPublicKey payee_pubkey_ref;
46099         CHECK(payee_pubkey->arr_len == 33);
46100         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
46101         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
46102         uint64_t ret_ref = 0;
46103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46105         return ret_ref;
46106 }
46107
46108 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
46109         LDKPublicKey payee_pubkey_ref;
46110         CHECK(payee_pubkey->arr_len == 33);
46111         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
46112         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta);
46113         uint64_t ret_ref = 0;
46114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46116         return ret_ref;
46117 }
46118
46119 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
46120         LDKRouteHint this_obj_conv;
46121         this_obj_conv.inner = untag_ptr(this_obj);
46122         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46124         RouteHint_free(this_obj_conv);
46125 }
46126
46127 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
46128         LDKRouteHint this_ptr_conv;
46129         this_ptr_conv.inner = untag_ptr(this_ptr);
46130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46132         this_ptr_conv.is_owned = false;
46133         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
46134         uint64_tArray ret_arr = NULL;
46135         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46136         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46137         for (size_t o = 0; o < ret_var.datalen; o++) {
46138                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
46139                 uint64_t ret_conv_14_ref = 0;
46140                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46141                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46142                 ret_arr_ptr[o] = ret_conv_14_ref;
46143         }
46144         
46145         FREE(ret_var.data);
46146         return ret_arr;
46147 }
46148
46149 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
46150         LDKRouteHint this_ptr_conv;
46151         this_ptr_conv.inner = untag_ptr(this_ptr);
46152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46154         this_ptr_conv.is_owned = false;
46155         LDKCVec_RouteHintHopZ val_constr;
46156         val_constr.datalen = val->arr_len;
46157         if (val_constr.datalen > 0)
46158                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46159         else
46160                 val_constr.data = NULL;
46161         uint64_t* val_vals = val->elems;
46162         for (size_t o = 0; o < val_constr.datalen; o++) {
46163                 uint64_t val_conv_14 = val_vals[o];
46164                 LDKRouteHintHop val_conv_14_conv;
46165                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
46166                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
46167                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
46168                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
46169                 val_constr.data[o] = val_conv_14_conv;
46170         }
46171         FREE(val);
46172         RouteHint_set_a(&this_ptr_conv, val_constr);
46173 }
46174
46175 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
46176         LDKCVec_RouteHintHopZ a_arg_constr;
46177         a_arg_constr.datalen = a_arg->arr_len;
46178         if (a_arg_constr.datalen > 0)
46179                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46180         else
46181                 a_arg_constr.data = NULL;
46182         uint64_t* a_arg_vals = a_arg->elems;
46183         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
46184                 uint64_t a_arg_conv_14 = a_arg_vals[o];
46185                 LDKRouteHintHop a_arg_conv_14_conv;
46186                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
46187                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
46188                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
46189                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
46190                 a_arg_constr.data[o] = a_arg_conv_14_conv;
46191         }
46192         FREE(a_arg);
46193         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
46194         uint64_t ret_ref = 0;
46195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46197         return ret_ref;
46198 }
46199
46200 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
46201         LDKRouteHint ret_var = RouteHint_clone(arg);
46202         uint64_t ret_ref = 0;
46203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46205         return ret_ref;
46206 }
46207 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
46208         LDKRouteHint arg_conv;
46209         arg_conv.inner = untag_ptr(arg);
46210         arg_conv.is_owned = ptr_is_owned(arg);
46211         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46212         arg_conv.is_owned = false;
46213         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
46214         return ret_conv;
46215 }
46216
46217 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
46218         LDKRouteHint orig_conv;
46219         orig_conv.inner = untag_ptr(orig);
46220         orig_conv.is_owned = ptr_is_owned(orig);
46221         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46222         orig_conv.is_owned = false;
46223         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
46224         uint64_t ret_ref = 0;
46225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46227         return ret_ref;
46228 }
46229
46230 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
46231         LDKRouteHint o_conv;
46232         o_conv.inner = untag_ptr(o);
46233         o_conv.is_owned = ptr_is_owned(o);
46234         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46235         o_conv.is_owned = false;
46236         int64_t ret_conv = RouteHint_hash(&o_conv);
46237         return ret_conv;
46238 }
46239
46240 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
46241         LDKRouteHint a_conv;
46242         a_conv.inner = untag_ptr(a);
46243         a_conv.is_owned = ptr_is_owned(a);
46244         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46245         a_conv.is_owned = false;
46246         LDKRouteHint b_conv;
46247         b_conv.inner = untag_ptr(b);
46248         b_conv.is_owned = ptr_is_owned(b);
46249         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46250         b_conv.is_owned = false;
46251         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
46252         return ret_conv;
46253 }
46254
46255 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
46256         LDKRouteHint obj_conv;
46257         obj_conv.inner = untag_ptr(obj);
46258         obj_conv.is_owned = ptr_is_owned(obj);
46259         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46260         obj_conv.is_owned = false;
46261         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
46262         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46263         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46264         CVec_u8Z_free(ret_var);
46265         return ret_arr;
46266 }
46267
46268 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
46269         LDKu8slice ser_ref;
46270         ser_ref.datalen = ser->arr_len;
46271         ser_ref.data = ser->elems;
46272         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
46273         *ret_conv = RouteHint_read(ser_ref);
46274         FREE(ser);
46275         return tag_ptr(ret_conv, true);
46276 }
46277
46278 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
46279         LDKRouteHintHop this_obj_conv;
46280         this_obj_conv.inner = untag_ptr(this_obj);
46281         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46283         RouteHintHop_free(this_obj_conv);
46284 }
46285
46286 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
46287         LDKRouteHintHop this_ptr_conv;
46288         this_ptr_conv.inner = untag_ptr(this_ptr);
46289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46291         this_ptr_conv.is_owned = false;
46292         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46293         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
46294         return ret_arr;
46295 }
46296
46297 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
46298         LDKRouteHintHop this_ptr_conv;
46299         this_ptr_conv.inner = untag_ptr(this_ptr);
46300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46302         this_ptr_conv.is_owned = false;
46303         LDKPublicKey val_ref;
46304         CHECK(val->arr_len == 33);
46305         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46306         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
46307 }
46308
46309 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
46310         LDKRouteHintHop this_ptr_conv;
46311         this_ptr_conv.inner = untag_ptr(this_ptr);
46312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46314         this_ptr_conv.is_owned = false;
46315         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
46316         return ret_conv;
46317 }
46318
46319 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
46320         LDKRouteHintHop this_ptr_conv;
46321         this_ptr_conv.inner = untag_ptr(this_ptr);
46322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46324         this_ptr_conv.is_owned = false;
46325         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
46326 }
46327
46328 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
46329         LDKRouteHintHop this_ptr_conv;
46330         this_ptr_conv.inner = untag_ptr(this_ptr);
46331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46333         this_ptr_conv.is_owned = false;
46334         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
46335         uint64_t ret_ref = 0;
46336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46338         return ret_ref;
46339 }
46340
46341 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
46342         LDKRouteHintHop this_ptr_conv;
46343         this_ptr_conv.inner = untag_ptr(this_ptr);
46344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46346         this_ptr_conv.is_owned = false;
46347         LDKRoutingFees val_conv;
46348         val_conv.inner = untag_ptr(val);
46349         val_conv.is_owned = ptr_is_owned(val);
46350         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46351         val_conv = RoutingFees_clone(&val_conv);
46352         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
46353 }
46354
46355 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
46356         LDKRouteHintHop this_ptr_conv;
46357         this_ptr_conv.inner = untag_ptr(this_ptr);
46358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46360         this_ptr_conv.is_owned = false;
46361         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
46362         return ret_conv;
46363 }
46364
46365 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
46366         LDKRouteHintHop this_ptr_conv;
46367         this_ptr_conv.inner = untag_ptr(this_ptr);
46368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46370         this_ptr_conv.is_owned = false;
46371         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
46372 }
46373
46374 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
46375         LDKRouteHintHop this_ptr_conv;
46376         this_ptr_conv.inner = untag_ptr(this_ptr);
46377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46379         this_ptr_conv.is_owned = false;
46380         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46381         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
46382         uint64_t ret_ref = tag_ptr(ret_copy, true);
46383         return ret_ref;
46384 }
46385
46386 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
46387         LDKRouteHintHop this_ptr_conv;
46388         this_ptr_conv.inner = untag_ptr(this_ptr);
46389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46391         this_ptr_conv.is_owned = false;
46392         void* val_ptr = untag_ptr(val);
46393         CHECK_ACCESS(val_ptr);
46394         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46395         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46396         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
46397 }
46398
46399 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
46400         LDKRouteHintHop this_ptr_conv;
46401         this_ptr_conv.inner = untag_ptr(this_ptr);
46402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46404         this_ptr_conv.is_owned = false;
46405         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46406         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
46407         uint64_t ret_ref = tag_ptr(ret_copy, true);
46408         return ret_ref;
46409 }
46410
46411 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
46412         LDKRouteHintHop this_ptr_conv;
46413         this_ptr_conv.inner = untag_ptr(this_ptr);
46414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46416         this_ptr_conv.is_owned = false;
46417         void* val_ptr = untag_ptr(val);
46418         CHECK_ACCESS(val_ptr);
46419         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46420         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46421         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
46422 }
46423
46424 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) {
46425         LDKPublicKey src_node_id_arg_ref;
46426         CHECK(src_node_id_arg->arr_len == 33);
46427         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
46428         LDKRoutingFees fees_arg_conv;
46429         fees_arg_conv.inner = untag_ptr(fees_arg);
46430         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
46431         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
46432         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
46433         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
46434         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
46435         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
46436         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
46437         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
46438         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
46439         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
46440         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
46441         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);
46442         uint64_t ret_ref = 0;
46443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46445         return ret_ref;
46446 }
46447
46448 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
46449         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
46450         uint64_t ret_ref = 0;
46451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46453         return ret_ref;
46454 }
46455 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
46456         LDKRouteHintHop arg_conv;
46457         arg_conv.inner = untag_ptr(arg);
46458         arg_conv.is_owned = ptr_is_owned(arg);
46459         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46460         arg_conv.is_owned = false;
46461         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
46462         return ret_conv;
46463 }
46464
46465 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
46466         LDKRouteHintHop orig_conv;
46467         orig_conv.inner = untag_ptr(orig);
46468         orig_conv.is_owned = ptr_is_owned(orig);
46469         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46470         orig_conv.is_owned = false;
46471         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
46472         uint64_t ret_ref = 0;
46473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46475         return ret_ref;
46476 }
46477
46478 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
46479         LDKRouteHintHop o_conv;
46480         o_conv.inner = untag_ptr(o);
46481         o_conv.is_owned = ptr_is_owned(o);
46482         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46483         o_conv.is_owned = false;
46484         int64_t ret_conv = RouteHintHop_hash(&o_conv);
46485         return ret_conv;
46486 }
46487
46488 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
46489         LDKRouteHintHop a_conv;
46490         a_conv.inner = untag_ptr(a);
46491         a_conv.is_owned = ptr_is_owned(a);
46492         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46493         a_conv.is_owned = false;
46494         LDKRouteHintHop b_conv;
46495         b_conv.inner = untag_ptr(b);
46496         b_conv.is_owned = ptr_is_owned(b);
46497         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46498         b_conv.is_owned = false;
46499         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
46500         return ret_conv;
46501 }
46502
46503 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
46504         LDKRouteHintHop obj_conv;
46505         obj_conv.inner = untag_ptr(obj);
46506         obj_conv.is_owned = ptr_is_owned(obj);
46507         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46508         obj_conv.is_owned = false;
46509         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
46510         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46511         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46512         CVec_u8Z_free(ret_var);
46513         return ret_arr;
46514 }
46515
46516 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
46517         LDKu8slice ser_ref;
46518         ser_ref.datalen = ser->arr_len;
46519         ser_ref.data = ser->elems;
46520         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
46521         *ret_conv = RouteHintHop_read(ser_ref);
46522         FREE(ser);
46523         return tag_ptr(ret_conv, true);
46524 }
46525
46526 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) {
46527         LDKPublicKey our_node_pubkey_ref;
46528         CHECK(our_node_pubkey->arr_len == 33);
46529         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
46530         LDKRouteParameters route_params_conv;
46531         route_params_conv.inner = untag_ptr(route_params);
46532         route_params_conv.is_owned = ptr_is_owned(route_params);
46533         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46534         route_params_conv.is_owned = false;
46535         LDKNetworkGraph network_graph_conv;
46536         network_graph_conv.inner = untag_ptr(network_graph);
46537         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46538         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46539         network_graph_conv.is_owned = false;
46540         LDKCVec_ChannelDetailsZ first_hops_constr;
46541         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
46542         if (first_hops != 0) {
46543                 first_hops_constr.datalen = first_hops->arr_len;
46544                 if (first_hops_constr.datalen > 0)
46545                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
46546                 else
46547                         first_hops_constr.data = NULL;
46548                 uint64_t* first_hops_vals = first_hops->elems;
46549                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
46550                         uint64_t first_hops_conv_16 = first_hops_vals[q];
46551                         LDKChannelDetails first_hops_conv_16_conv;
46552                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
46553                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
46554                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
46555                         first_hops_conv_16_conv.is_owned = false;
46556                         first_hops_constr.data[q] = first_hops_conv_16_conv;
46557                 }
46558                 FREE(first_hops);
46559                 first_hops_ptr = &first_hops_constr;
46560         }
46561         void* logger_ptr = untag_ptr(logger);
46562         CHECK_ACCESS(logger_ptr);
46563         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46564         if (logger_conv.free == LDKLogger_JCalls_free) {
46565                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46566                 LDKLogger_JCalls_cloned(&logger_conv);
46567         }
46568         void* scorer_ptr = untag_ptr(scorer);
46569         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
46570         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
46571         uint8_t random_seed_bytes_arr[32];
46572         CHECK(random_seed_bytes->arr_len == 32);
46573         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
46574         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46575         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46576         *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);
46577         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
46578         return tag_ptr(ret_conv, true);
46579 }
46580
46581 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) {
46582         LDKPublicKey our_node_pubkey_ref;
46583         CHECK(our_node_pubkey->arr_len == 33);
46584         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
46585         LDKCVec_PublicKeyZ hops_constr;
46586         hops_constr.datalen = hops->arr_len;
46587         if (hops_constr.datalen > 0)
46588                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
46589         else
46590                 hops_constr.data = NULL;
46591         int8_tArray* hops_vals = (void*) hops->elems;
46592         for (size_t m = 0; m < hops_constr.datalen; m++) {
46593                 int8_tArray hops_conv_12 = hops_vals[m];
46594                 LDKPublicKey hops_conv_12_ref;
46595                 CHECK(hops_conv_12->arr_len == 33);
46596                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
46597                 hops_constr.data[m] = hops_conv_12_ref;
46598         }
46599         FREE(hops);
46600         LDKRouteParameters route_params_conv;
46601         route_params_conv.inner = untag_ptr(route_params);
46602         route_params_conv.is_owned = ptr_is_owned(route_params);
46603         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46604         route_params_conv.is_owned = false;
46605         LDKNetworkGraph network_graph_conv;
46606         network_graph_conv.inner = untag_ptr(network_graph);
46607         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46608         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46609         network_graph_conv.is_owned = false;
46610         void* logger_ptr = untag_ptr(logger);
46611         CHECK_ACCESS(logger_ptr);
46612         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46613         if (logger_conv.free == LDKLogger_JCalls_free) {
46614                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46615                 LDKLogger_JCalls_cloned(&logger_conv);
46616         }
46617         uint8_t random_seed_bytes_arr[32];
46618         CHECK(random_seed_bytes->arr_len == 32);
46619         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
46620         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46621         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46622         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
46623         return tag_ptr(ret_conv, true);
46624 }
46625
46626 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
46627         if (!ptr_is_owned(this_ptr)) return;
46628         void* this_ptr_ptr = untag_ptr(this_ptr);
46629         CHECK_ACCESS(this_ptr_ptr);
46630         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
46631         FREE(untag_ptr(this_ptr));
46632         Score_free(this_ptr_conv);
46633 }
46634
46635 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
46636         if (!ptr_is_owned(this_ptr)) return;
46637         void* this_ptr_ptr = untag_ptr(this_ptr);
46638         CHECK_ACCESS(this_ptr_ptr);
46639         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
46640         FREE(untag_ptr(this_ptr));
46641         LockableScore_free(this_ptr_conv);
46642 }
46643
46644 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
46645         if (!ptr_is_owned(this_ptr)) return;
46646         void* this_ptr_ptr = untag_ptr(this_ptr);
46647         CHECK_ACCESS(this_ptr_ptr);
46648         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
46649         FREE(untag_ptr(this_ptr));
46650         WriteableScore_free(this_ptr_conv);
46651 }
46652
46653 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
46654         LDKMultiThreadedLockableScore this_obj_conv;
46655         this_obj_conv.inner = untag_ptr(this_obj);
46656         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46658         MultiThreadedLockableScore_free(this_obj_conv);
46659 }
46660
46661 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
46662         LDKMultiThreadedScoreLock this_obj_conv;
46663         this_obj_conv.inner = untag_ptr(this_obj);
46664         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46666         MultiThreadedScoreLock_free(this_obj_conv);
46667 }
46668
46669 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
46670         LDKMultiThreadedScoreLock this_arg_conv;
46671         this_arg_conv.inner = untag_ptr(this_arg);
46672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46674         this_arg_conv.is_owned = false;
46675         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
46676         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
46677         return tag_ptr(ret_ret, true);
46678 }
46679
46680 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
46681         LDKMultiThreadedScoreLock obj_conv;
46682         obj_conv.inner = untag_ptr(obj);
46683         obj_conv.is_owned = ptr_is_owned(obj);
46684         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46685         obj_conv.is_owned = false;
46686         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
46687         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46688         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46689         CVec_u8Z_free(ret_var);
46690         return ret_arr;
46691 }
46692
46693 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
46694         LDKMultiThreadedLockableScore this_arg_conv;
46695         this_arg_conv.inner = untag_ptr(this_arg);
46696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46698         this_arg_conv.is_owned = false;
46699         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
46700         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
46701         return tag_ptr(ret_ret, true);
46702 }
46703
46704 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
46705         LDKMultiThreadedLockableScore obj_conv;
46706         obj_conv.inner = untag_ptr(obj);
46707         obj_conv.is_owned = ptr_is_owned(obj);
46708         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46709         obj_conv.is_owned = false;
46710         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
46711         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46712         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46713         CVec_u8Z_free(ret_var);
46714         return ret_arr;
46715 }
46716
46717 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
46718         LDKMultiThreadedLockableScore this_arg_conv;
46719         this_arg_conv.inner = untag_ptr(this_arg);
46720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46722         this_arg_conv.is_owned = false;
46723         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
46724         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
46725         return tag_ptr(ret_ret, true);
46726 }
46727
46728 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
46729         void* score_ptr = untag_ptr(score);
46730         CHECK_ACCESS(score_ptr);
46731         LDKScore score_conv = *(LDKScore*)(score_ptr);
46732         if (score_conv.free == LDKScore_JCalls_free) {
46733                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46734                 LDKScore_JCalls_cloned(&score_conv);
46735         }
46736         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
46737         uint64_t ret_ref = 0;
46738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46740         return ret_ref;
46741 }
46742
46743 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
46744         LDKChannelUsage this_obj_conv;
46745         this_obj_conv.inner = untag_ptr(this_obj);
46746         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46748         ChannelUsage_free(this_obj_conv);
46749 }
46750
46751 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
46752         LDKChannelUsage this_ptr_conv;
46753         this_ptr_conv.inner = untag_ptr(this_ptr);
46754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46756         this_ptr_conv.is_owned = false;
46757         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
46758         return ret_conv;
46759 }
46760
46761 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
46762         LDKChannelUsage this_ptr_conv;
46763         this_ptr_conv.inner = untag_ptr(this_ptr);
46764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46766         this_ptr_conv.is_owned = false;
46767         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
46768 }
46769
46770 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
46771         LDKChannelUsage this_ptr_conv;
46772         this_ptr_conv.inner = untag_ptr(this_ptr);
46773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46775         this_ptr_conv.is_owned = false;
46776         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
46777         return ret_conv;
46778 }
46779
46780 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
46781         LDKChannelUsage this_ptr_conv;
46782         this_ptr_conv.inner = untag_ptr(this_ptr);
46783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46785         this_ptr_conv.is_owned = false;
46786         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
46787 }
46788
46789 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
46790         LDKChannelUsage this_ptr_conv;
46791         this_ptr_conv.inner = untag_ptr(this_ptr);
46792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46794         this_ptr_conv.is_owned = false;
46795         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
46796         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
46797         uint64_t ret_ref = tag_ptr(ret_copy, true);
46798         return ret_ref;
46799 }
46800
46801 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
46802         LDKChannelUsage this_ptr_conv;
46803         this_ptr_conv.inner = untag_ptr(this_ptr);
46804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46806         this_ptr_conv.is_owned = false;
46807         void* val_ptr = untag_ptr(val);
46808         CHECK_ACCESS(val_ptr);
46809         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
46810         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
46811         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
46812 }
46813
46814 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) {
46815         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
46816         CHECK_ACCESS(effective_capacity_arg_ptr);
46817         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
46818         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
46819         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
46820         uint64_t ret_ref = 0;
46821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46823         return ret_ref;
46824 }
46825
46826 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
46827         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
46828         uint64_t ret_ref = 0;
46829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46831         return ret_ref;
46832 }
46833 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
46834         LDKChannelUsage arg_conv;
46835         arg_conv.inner = untag_ptr(arg);
46836         arg_conv.is_owned = ptr_is_owned(arg);
46837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46838         arg_conv.is_owned = false;
46839         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
46840         return ret_conv;
46841 }
46842
46843 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
46844         LDKChannelUsage orig_conv;
46845         orig_conv.inner = untag_ptr(orig);
46846         orig_conv.is_owned = ptr_is_owned(orig);
46847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46848         orig_conv.is_owned = false;
46849         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
46850         uint64_t ret_ref = 0;
46851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46853         return ret_ref;
46854 }
46855
46856 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
46857         LDKFixedPenaltyScorer this_obj_conv;
46858         this_obj_conv.inner = untag_ptr(this_obj);
46859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46861         FixedPenaltyScorer_free(this_obj_conv);
46862 }
46863
46864 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
46865         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
46866         uint64_t ret_ref = 0;
46867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46869         return ret_ref;
46870 }
46871 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
46872         LDKFixedPenaltyScorer arg_conv;
46873         arg_conv.inner = untag_ptr(arg);
46874         arg_conv.is_owned = ptr_is_owned(arg);
46875         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46876         arg_conv.is_owned = false;
46877         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
46878         return ret_conv;
46879 }
46880
46881 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
46882         LDKFixedPenaltyScorer orig_conv;
46883         orig_conv.inner = untag_ptr(orig);
46884         orig_conv.is_owned = ptr_is_owned(orig);
46885         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46886         orig_conv.is_owned = false;
46887         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
46888         uint64_t ret_ref = 0;
46889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46891         return ret_ref;
46892 }
46893
46894 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
46895         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
46896         uint64_t ret_ref = 0;
46897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46899         return ret_ref;
46900 }
46901
46902 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
46903         LDKFixedPenaltyScorer this_arg_conv;
46904         this_arg_conv.inner = untag_ptr(this_arg);
46905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46907         this_arg_conv.is_owned = false;
46908         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
46909         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
46910         return tag_ptr(ret_ret, true);
46911 }
46912
46913 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
46914         LDKFixedPenaltyScorer obj_conv;
46915         obj_conv.inner = untag_ptr(obj);
46916         obj_conv.is_owned = ptr_is_owned(obj);
46917         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46918         obj_conv.is_owned = false;
46919         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
46920         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46921         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46922         CVec_u8Z_free(ret_var);
46923         return ret_arr;
46924 }
46925
46926 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
46927         LDKu8slice ser_ref;
46928         ser_ref.datalen = ser->arr_len;
46929         ser_ref.data = ser->elems;
46930         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
46931         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
46932         FREE(ser);
46933         return tag_ptr(ret_conv, true);
46934 }
46935
46936 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
46937         LDKProbabilisticScorer this_obj_conv;
46938         this_obj_conv.inner = untag_ptr(this_obj);
46939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46941         ProbabilisticScorer_free(this_obj_conv);
46942 }
46943
46944 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
46945         LDKProbabilisticScoringParameters this_obj_conv;
46946         this_obj_conv.inner = untag_ptr(this_obj);
46947         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46949         ProbabilisticScoringParameters_free(this_obj_conv);
46950 }
46951
46952 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
46953         LDKProbabilisticScoringParameters this_ptr_conv;
46954         this_ptr_conv.inner = untag_ptr(this_ptr);
46955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46957         this_ptr_conv.is_owned = false;
46958         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
46959         return ret_conv;
46960 }
46961
46962 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
46963         LDKProbabilisticScoringParameters this_ptr_conv;
46964         this_ptr_conv.inner = untag_ptr(this_ptr);
46965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46967         this_ptr_conv.is_owned = false;
46968         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
46969 }
46970
46971 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) {
46972         LDKProbabilisticScoringParameters this_ptr_conv;
46973         this_ptr_conv.inner = untag_ptr(this_ptr);
46974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46976         this_ptr_conv.is_owned = false;
46977         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
46978         return ret_conv;
46979 }
46980
46981 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) {
46982         LDKProbabilisticScoringParameters this_ptr_conv;
46983         this_ptr_conv.inner = untag_ptr(this_ptr);
46984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46986         this_ptr_conv.is_owned = false;
46987         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
46988 }
46989
46990 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
46991         LDKProbabilisticScoringParameters this_ptr_conv;
46992         this_ptr_conv.inner = untag_ptr(this_ptr);
46993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46995         this_ptr_conv.is_owned = false;
46996         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
46997         return ret_conv;
46998 }
46999
47000 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) {
47001         LDKProbabilisticScoringParameters this_ptr_conv;
47002         this_ptr_conv.inner = untag_ptr(this_ptr);
47003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47005         this_ptr_conv.is_owned = false;
47006         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
47007 }
47008
47009 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
47010         LDKProbabilisticScoringParameters 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         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
47016         return ret_conv;
47017 }
47018
47019 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) {
47020         LDKProbabilisticScoringParameters this_ptr_conv;
47021         this_ptr_conv.inner = untag_ptr(this_ptr);
47022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47024         this_ptr_conv.is_owned = false;
47025         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
47026 }
47027
47028 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) {
47029         LDKProbabilisticScoringParameters this_ptr_conv;
47030         this_ptr_conv.inner = untag_ptr(this_ptr);
47031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47033         this_ptr_conv.is_owned = false;
47034         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
47035         return ret_conv;
47036 }
47037
47038 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) {
47039         LDKProbabilisticScoringParameters this_ptr_conv;
47040         this_ptr_conv.inner = untag_ptr(this_ptr);
47041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47043         this_ptr_conv.is_owned = false;
47044         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
47045 }
47046
47047 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) {
47048         LDKProbabilisticScoringParameters this_ptr_conv;
47049         this_ptr_conv.inner = untag_ptr(this_ptr);
47050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47052         this_ptr_conv.is_owned = false;
47053         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
47054         return ret_conv;
47055 }
47056
47057 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) {
47058         LDKProbabilisticScoringParameters this_ptr_conv;
47059         this_ptr_conv.inner = untag_ptr(this_ptr);
47060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47062         this_ptr_conv.is_owned = false;
47063         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
47064 }
47065
47066 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) {
47067         LDKProbabilisticScoringParameters this_ptr_conv;
47068         this_ptr_conv.inner = untag_ptr(this_ptr);
47069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47071         this_ptr_conv.is_owned = false;
47072         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
47073         return ret_conv;
47074 }
47075
47076 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) {
47077         LDKProbabilisticScoringParameters this_ptr_conv;
47078         this_ptr_conv.inner = untag_ptr(this_ptr);
47079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47081         this_ptr_conv.is_owned = false;
47082         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
47083 }
47084
47085 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) {
47086         LDKProbabilisticScoringParameters this_ptr_conv;
47087         this_ptr_conv.inner = untag_ptr(this_ptr);
47088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47090         this_ptr_conv.is_owned = false;
47091         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
47092         return ret_conv;
47093 }
47094
47095 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) {
47096         LDKProbabilisticScoringParameters this_ptr_conv;
47097         this_ptr_conv.inner = untag_ptr(this_ptr);
47098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47100         this_ptr_conv.is_owned = false;
47101         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
47102 }
47103
47104 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
47105         LDKProbabilisticScoringParameters this_ptr_conv;
47106         this_ptr_conv.inner = untag_ptr(this_ptr);
47107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47109         this_ptr_conv.is_owned = false;
47110         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
47111         return ret_conv;
47112 }
47113
47114 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) {
47115         LDKProbabilisticScoringParameters this_ptr_conv;
47116         this_ptr_conv.inner = untag_ptr(this_ptr);
47117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47119         this_ptr_conv.is_owned = false;
47120         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
47121 }
47122
47123 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
47124         LDKProbabilisticScoringParameters this_ptr_conv;
47125         this_ptr_conv.inner = untag_ptr(this_ptr);
47126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47128         this_ptr_conv.is_owned = false;
47129         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
47130         return ret_conv;
47131 }
47132
47133 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) {
47134         LDKProbabilisticScoringParameters this_ptr_conv;
47135         this_ptr_conv.inner = untag_ptr(this_ptr);
47136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47138         this_ptr_conv.is_owned = false;
47139         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
47140 }
47141
47142 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
47143         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
47144         uint64_t ret_ref = 0;
47145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47147         return ret_ref;
47148 }
47149 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
47150         LDKProbabilisticScoringParameters arg_conv;
47151         arg_conv.inner = untag_ptr(arg);
47152         arg_conv.is_owned = ptr_is_owned(arg);
47153         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47154         arg_conv.is_owned = false;
47155         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
47156         return ret_conv;
47157 }
47158
47159 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
47160         LDKProbabilisticScoringParameters orig_conv;
47161         orig_conv.inner = untag_ptr(orig);
47162         orig_conv.is_owned = ptr_is_owned(orig);
47163         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47164         orig_conv.is_owned = false;
47165         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
47166         uint64_t ret_ref = 0;
47167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47169         return ret_ref;
47170 }
47171
47172 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
47173         LDKProbabilisticScoringParameters params_conv;
47174         params_conv.inner = untag_ptr(params);
47175         params_conv.is_owned = ptr_is_owned(params);
47176         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
47177         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
47178         LDKNetworkGraph network_graph_conv;
47179         network_graph_conv.inner = untag_ptr(network_graph);
47180         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47181         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47182         network_graph_conv.is_owned = false;
47183         void* logger_ptr = untag_ptr(logger);
47184         CHECK_ACCESS(logger_ptr);
47185         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47186         if (logger_conv.free == LDKLogger_JCalls_free) {
47187                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47188                 LDKLogger_JCalls_cloned(&logger_conv);
47189         }
47190         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
47191         uint64_t ret_ref = 0;
47192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47194         return ret_ref;
47195 }
47196
47197 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
47198         LDKProbabilisticScorer this_arg_conv;
47199         this_arg_conv.inner = untag_ptr(this_arg);
47200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47202         this_arg_conv.is_owned = false;
47203         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
47204 }
47205
47206 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) {
47207         LDKProbabilisticScorer this_arg_conv;
47208         this_arg_conv.inner = untag_ptr(this_arg);
47209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47211         this_arg_conv.is_owned = false;
47212         LDKNodeId target_conv;
47213         target_conv.inner = untag_ptr(target);
47214         target_conv.is_owned = ptr_is_owned(target);
47215         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
47216         target_conv.is_owned = false;
47217         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
47218         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
47219         uint64_t ret_ref = tag_ptr(ret_copy, true);
47220         return ret_ref;
47221 }
47222
47223 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) {
47224         LDKProbabilisticScorer this_arg_conv;
47225         this_arg_conv.inner = untag_ptr(this_arg);
47226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47228         this_arg_conv.is_owned = false;
47229         LDKNodeId target_conv;
47230         target_conv.inner = untag_ptr(target);
47231         target_conv.is_owned = ptr_is_owned(target);
47232         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
47233         target_conv.is_owned = false;
47234         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
47235         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
47236         uint64_t ret_ref = tag_ptr(ret_copy, true);
47237         return ret_ref;
47238 }
47239
47240 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
47241         LDKProbabilisticScorer this_arg_conv;
47242         this_arg_conv.inner = untag_ptr(this_arg);
47243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47245         this_arg_conv.is_owned = false;
47246         LDKNodeId node_id_conv;
47247         node_id_conv.inner = untag_ptr(node_id);
47248         node_id_conv.is_owned = ptr_is_owned(node_id);
47249         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47250         node_id_conv.is_owned = false;
47251         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
47252 }
47253
47254 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
47255         LDKProbabilisticScorer this_arg_conv;
47256         this_arg_conv.inner = untag_ptr(this_arg);
47257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47259         this_arg_conv.is_owned = false;
47260         LDKNodeId node_id_conv;
47261         node_id_conv.inner = untag_ptr(node_id);
47262         node_id_conv.is_owned = ptr_is_owned(node_id);
47263         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47264         node_id_conv.is_owned = false;
47265         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
47266 }
47267
47268 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) {
47269         LDKProbabilisticScorer this_arg_conv;
47270         this_arg_conv.inner = untag_ptr(this_arg);
47271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47273         this_arg_conv.is_owned = false;
47274         LDKNodeId node_id_conv;
47275         node_id_conv.inner = untag_ptr(node_id);
47276         node_id_conv.is_owned = ptr_is_owned(node_id);
47277         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47278         node_id_conv.is_owned = false;
47279         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
47280 }
47281
47282 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
47283         LDKProbabilisticScorer this_arg_conv;
47284         this_arg_conv.inner = untag_ptr(this_arg);
47285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47287         this_arg_conv.is_owned = false;
47288         LDKNodeId node_id_conv;
47289         node_id_conv.inner = untag_ptr(node_id);
47290         node_id_conv.is_owned = ptr_is_owned(node_id);
47291         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47292         node_id_conv.is_owned = false;
47293         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
47294 }
47295
47296 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
47297         LDKProbabilisticScorer this_arg_conv;
47298         this_arg_conv.inner = untag_ptr(this_arg);
47299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47301         this_arg_conv.is_owned = false;
47302         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
47303 }
47304
47305 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
47306         LDKProbabilisticScoringParameters this_arg_conv;
47307         this_arg_conv.inner = untag_ptr(this_arg);
47308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47310         this_arg_conv.is_owned = false;
47311         LDKCVec_NodeIdZ node_ids_constr;
47312         node_ids_constr.datalen = node_ids->arr_len;
47313         if (node_ids_constr.datalen > 0)
47314                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
47315         else
47316                 node_ids_constr.data = NULL;
47317         uint64_t* node_ids_vals = node_ids->elems;
47318         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
47319                 uint64_t node_ids_conv_8 = node_ids_vals[i];
47320                 LDKNodeId node_ids_conv_8_conv;
47321                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
47322                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
47323                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
47324                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
47325                 node_ids_constr.data[i] = node_ids_conv_8_conv;
47326         }
47327         FREE(node_ids);
47328         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
47329 }
47330
47331 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
47332         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
47333         uint64_t ret_ref = 0;
47334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47336         return ret_ref;
47337 }
47338
47339 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
47340         LDKProbabilisticScorer this_arg_conv;
47341         this_arg_conv.inner = untag_ptr(this_arg);
47342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47344         this_arg_conv.is_owned = false;
47345         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
47346         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
47347         return tag_ptr(ret_ret, true);
47348 }
47349
47350 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
47351         LDKProbabilisticScorer obj_conv;
47352         obj_conv.inner = untag_ptr(obj);
47353         obj_conv.is_owned = ptr_is_owned(obj);
47354         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47355         obj_conv.is_owned = false;
47356         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
47357         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47358         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47359         CVec_u8Z_free(ret_var);
47360         return ret_arr;
47361 }
47362
47363 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) {
47364         LDKu8slice ser_ref;
47365         ser_ref.datalen = ser->arr_len;
47366         ser_ref.data = ser->elems;
47367         LDKProbabilisticScoringParameters arg_a_conv;
47368         arg_a_conv.inner = untag_ptr(arg_a);
47369         arg_a_conv.is_owned = ptr_is_owned(arg_a);
47370         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
47371         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
47372         LDKNetworkGraph arg_b_conv;
47373         arg_b_conv.inner = untag_ptr(arg_b);
47374         arg_b_conv.is_owned = ptr_is_owned(arg_b);
47375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
47376         arg_b_conv.is_owned = false;
47377         void* arg_c_ptr = untag_ptr(arg_c);
47378         CHECK_ACCESS(arg_c_ptr);
47379         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
47380         if (arg_c_conv.free == LDKLogger_JCalls_free) {
47381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47382                 LDKLogger_JCalls_cloned(&arg_c_conv);
47383         }
47384         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
47385         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
47386         FREE(ser);
47387         return tag_ptr(ret_conv, true);
47388 }
47389
47390 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
47391         LDKBlindedPath this_obj_conv;
47392         this_obj_conv.inner = untag_ptr(this_obj);
47393         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47395         BlindedPath_free(this_obj_conv);
47396 }
47397
47398 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
47399         LDKBlindedPath ret_var = BlindedPath_clone(arg);
47400         uint64_t ret_ref = 0;
47401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47403         return ret_ref;
47404 }
47405 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
47406         LDKBlindedPath arg_conv;
47407         arg_conv.inner = untag_ptr(arg);
47408         arg_conv.is_owned = ptr_is_owned(arg);
47409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47410         arg_conv.is_owned = false;
47411         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
47412         return ret_conv;
47413 }
47414
47415 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
47416         LDKBlindedPath orig_conv;
47417         orig_conv.inner = untag_ptr(orig);
47418         orig_conv.is_owned = ptr_is_owned(orig);
47419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47420         orig_conv.is_owned = false;
47421         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
47422         uint64_t ret_ref = 0;
47423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47425         return ret_ref;
47426 }
47427
47428 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
47429         LDKBlindedHop this_obj_conv;
47430         this_obj_conv.inner = untag_ptr(this_obj);
47431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47433         BlindedHop_free(this_obj_conv);
47434 }
47435
47436 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
47437         LDKBlindedHop ret_var = BlindedHop_clone(arg);
47438         uint64_t ret_ref = 0;
47439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47441         return ret_ref;
47442 }
47443 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
47444         LDKBlindedHop arg_conv;
47445         arg_conv.inner = untag_ptr(arg);
47446         arg_conv.is_owned = ptr_is_owned(arg);
47447         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47448         arg_conv.is_owned = false;
47449         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
47450         return ret_conv;
47451 }
47452
47453 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
47454         LDKBlindedHop orig_conv;
47455         orig_conv.inner = untag_ptr(orig);
47456         orig_conv.is_owned = ptr_is_owned(orig);
47457         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47458         orig_conv.is_owned = false;
47459         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
47460         uint64_t ret_ref = 0;
47461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47463         return ret_ref;
47464 }
47465
47466 uint64_t  __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(ptrArray node_pks, uint64_t entropy_source) {
47467         LDKCVec_PublicKeyZ node_pks_constr;
47468         node_pks_constr.datalen = node_pks->arr_len;
47469         if (node_pks_constr.datalen > 0)
47470                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
47471         else
47472                 node_pks_constr.data = NULL;
47473         int8_tArray* node_pks_vals = (void*) node_pks->elems;
47474         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
47475                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
47476                 LDKPublicKey node_pks_conv_12_ref;
47477                 CHECK(node_pks_conv_12->arr_len == 33);
47478                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
47479                 node_pks_constr.data[m] = node_pks_conv_12_ref;
47480         }
47481         FREE(node_pks);
47482         void* entropy_source_ptr = untag_ptr(entropy_source);
47483         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
47484         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
47485         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
47486         *ret_conv = BlindedPath_new(node_pks_constr, entropy_source_conv);
47487         return tag_ptr(ret_conv, true);
47488 }
47489
47490 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
47491         LDKBlindedPath obj_conv;
47492         obj_conv.inner = untag_ptr(obj);
47493         obj_conv.is_owned = ptr_is_owned(obj);
47494         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47495         obj_conv.is_owned = false;
47496         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
47497         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47498         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47499         CVec_u8Z_free(ret_var);
47500         return ret_arr;
47501 }
47502
47503 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
47504         LDKu8slice ser_ref;
47505         ser_ref.datalen = ser->arr_len;
47506         ser_ref.data = ser->elems;
47507         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
47508         *ret_conv = BlindedPath_read(ser_ref);
47509         FREE(ser);
47510         return tag_ptr(ret_conv, true);
47511 }
47512
47513 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
47514         LDKBlindedHop obj_conv;
47515         obj_conv.inner = untag_ptr(obj);
47516         obj_conv.is_owned = ptr_is_owned(obj);
47517         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47518         obj_conv.is_owned = false;
47519         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
47520         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47521         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47522         CVec_u8Z_free(ret_var);
47523         return ret_arr;
47524 }
47525
47526 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
47527         LDKu8slice ser_ref;
47528         ser_ref.datalen = ser->arr_len;
47529         ser_ref.data = ser->elems;
47530         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
47531         *ret_conv = BlindedHop_read(ser_ref);
47532         FREE(ser);
47533         return tag_ptr(ret_conv, true);
47534 }
47535
47536 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
47537         LDKOnionMessenger this_obj_conv;
47538         this_obj_conv.inner = untag_ptr(this_obj);
47539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47541         OnionMessenger_free(this_obj_conv);
47542 }
47543
47544 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
47545         if (!ptr_is_owned(this_ptr)) return;
47546         void* this_ptr_ptr = untag_ptr(this_ptr);
47547         CHECK_ACCESS(this_ptr_ptr);
47548         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
47549         FREE(untag_ptr(this_ptr));
47550         Destination_free(this_ptr_conv);
47551 }
47552
47553 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
47554         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47555         *ret_copy = Destination_clone(arg);
47556         uint64_t ret_ref = tag_ptr(ret_copy, true);
47557         return ret_ref;
47558 }
47559 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
47560         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
47561         int64_t ret_conv = Destination_clone_ptr(arg_conv);
47562         return ret_conv;
47563 }
47564
47565 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
47566         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
47567         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47568         *ret_copy = Destination_clone(orig_conv);
47569         uint64_t ret_ref = tag_ptr(ret_copy, true);
47570         return ret_ref;
47571 }
47572
47573 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
47574         LDKPublicKey a_ref;
47575         CHECK(a->arr_len == 33);
47576         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
47577         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47578         *ret_copy = Destination_node(a_ref);
47579         uint64_t ret_ref = tag_ptr(ret_copy, true);
47580         return ret_ref;
47581 }
47582
47583 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
47584         LDKBlindedPath a_conv;
47585         a_conv.inner = untag_ptr(a);
47586         a_conv.is_owned = ptr_is_owned(a);
47587         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47588         a_conv = BlindedPath_clone(&a_conv);
47589         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47590         *ret_copy = Destination_blinded_path(a_conv);
47591         uint64_t ret_ref = tag_ptr(ret_copy, true);
47592         return ret_ref;
47593 }
47594
47595 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
47596         if (!ptr_is_owned(this_ptr)) return;
47597         void* this_ptr_ptr = untag_ptr(this_ptr);
47598         CHECK_ACCESS(this_ptr_ptr);
47599         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
47600         FREE(untag_ptr(this_ptr));
47601         SendError_free(this_ptr_conv);
47602 }
47603
47604 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
47605         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47606         *ret_copy = SendError_clone(arg);
47607         uint64_t ret_ref = tag_ptr(ret_copy, true);
47608         return ret_ref;
47609 }
47610 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
47611         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
47612         int64_t ret_conv = SendError_clone_ptr(arg_conv);
47613         return ret_conv;
47614 }
47615
47616 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
47617         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
47618         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47619         *ret_copy = SendError_clone(orig_conv);
47620         uint64_t ret_ref = tag_ptr(ret_copy, true);
47621         return ret_ref;
47622 }
47623
47624 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
47625         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
47626         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47627         *ret_copy = SendError_secp256k1(a_conv);
47628         uint64_t ret_ref = tag_ptr(ret_copy, true);
47629         return ret_ref;
47630 }
47631
47632 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
47633         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47634         *ret_copy = SendError_too_big_packet();
47635         uint64_t ret_ref = tag_ptr(ret_copy, true);
47636         return ret_ref;
47637 }
47638
47639 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
47640         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47641         *ret_copy = SendError_too_few_blinded_hops();
47642         uint64_t ret_ref = tag_ptr(ret_copy, true);
47643         return ret_ref;
47644 }
47645
47646 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
47647         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47648         *ret_copy = SendError_invalid_first_hop();
47649         uint64_t ret_ref = tag_ptr(ret_copy, true);
47650         return ret_ref;
47651 }
47652
47653 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
47654         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47655         *ret_copy = SendError_invalid_message();
47656         uint64_t ret_ref = tag_ptr(ret_copy, true);
47657         return ret_ref;
47658 }
47659
47660 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
47661         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47662         *ret_copy = SendError_buffer_full();
47663         uint64_t ret_ref = tag_ptr(ret_copy, true);
47664         return ret_ref;
47665 }
47666
47667 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
47668         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47669         *ret_copy = SendError_get_node_id_failed();
47670         uint64_t ret_ref = tag_ptr(ret_copy, true);
47671         return ret_ref;
47672 }
47673
47674 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
47675         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47676         *ret_copy = SendError_blinded_path_advance_failed();
47677         uint64_t ret_ref = tag_ptr(ret_copy, true);
47678         return ret_ref;
47679 }
47680
47681 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
47682         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
47683         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
47684         jboolean ret_conv = SendError_eq(a_conv, b_conv);
47685         return ret_conv;
47686 }
47687
47688 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
47689         if (!ptr_is_owned(this_ptr)) return;
47690         void* this_ptr_ptr = untag_ptr(this_ptr);
47691         CHECK_ACCESS(this_ptr_ptr);
47692         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
47693         FREE(untag_ptr(this_ptr));
47694         CustomOnionMessageHandler_free(this_ptr_conv);
47695 }
47696
47697 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) {
47698         void* entropy_source_ptr = untag_ptr(entropy_source);
47699         CHECK_ACCESS(entropy_source_ptr);
47700         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
47701         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
47702                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47703                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
47704         }
47705         void* node_signer_ptr = untag_ptr(node_signer);
47706         CHECK_ACCESS(node_signer_ptr);
47707         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
47708         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
47709                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47710                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
47711         }
47712         void* logger_ptr = untag_ptr(logger);
47713         CHECK_ACCESS(logger_ptr);
47714         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47715         if (logger_conv.free == LDKLogger_JCalls_free) {
47716                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47717                 LDKLogger_JCalls_cloned(&logger_conv);
47718         }
47719         void* custom_handler_ptr = untag_ptr(custom_handler);
47720         CHECK_ACCESS(custom_handler_ptr);
47721         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
47722         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
47723                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47724                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
47725         }
47726         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_conv);
47727         uint64_t ret_ref = 0;
47728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47730         return ret_ref;
47731 }
47732
47733 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) {
47734         LDKOnionMessenger this_arg_conv;
47735         this_arg_conv.inner = untag_ptr(this_arg);
47736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47738         this_arg_conv.is_owned = false;
47739         LDKCVec_PublicKeyZ intermediate_nodes_constr;
47740         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
47741         if (intermediate_nodes_constr.datalen > 0)
47742                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
47743         else
47744                 intermediate_nodes_constr.data = NULL;
47745         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
47746         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
47747                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
47748                 LDKPublicKey intermediate_nodes_conv_12_ref;
47749                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
47750                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
47751                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
47752         }
47753         FREE(intermediate_nodes);
47754         void* destination_ptr = untag_ptr(destination);
47755         CHECK_ACCESS(destination_ptr);
47756         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
47757         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
47758         void* message_ptr = untag_ptr(message);
47759         CHECK_ACCESS(message_ptr);
47760         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
47761         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
47762         LDKBlindedPath reply_path_conv;
47763         reply_path_conv.inner = untag_ptr(reply_path);
47764         reply_path_conv.is_owned = ptr_is_owned(reply_path);
47765         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
47766         reply_path_conv = BlindedPath_clone(&reply_path_conv);
47767         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
47768         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
47769         return tag_ptr(ret_conv, true);
47770 }
47771
47772 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
47773         LDKOnionMessenger this_arg_conv;
47774         this_arg_conv.inner = untag_ptr(this_arg);
47775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47777         this_arg_conv.is_owned = false;
47778         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
47779         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
47780         return tag_ptr(ret_ret, true);
47781 }
47782
47783 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
47784         LDKOnionMessenger this_arg_conv;
47785         this_arg_conv.inner = untag_ptr(this_arg);
47786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47788         this_arg_conv.is_owned = false;
47789         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
47790         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
47791         return tag_ptr(ret_ret, true);
47792 }
47793
47794 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
47795         if (!ptr_is_owned(this_ptr)) return;
47796         void* this_ptr_ptr = untag_ptr(this_ptr);
47797         CHECK_ACCESS(this_ptr_ptr);
47798         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
47799         FREE(untag_ptr(this_ptr));
47800         OnionMessageContents_free(this_ptr_conv);
47801 }
47802
47803 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
47804         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
47805         *ret_copy = OnionMessageContents_clone(arg);
47806         uint64_t ret_ref = tag_ptr(ret_copy, true);
47807         return ret_ref;
47808 }
47809 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
47810         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
47811         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
47812         return ret_conv;
47813 }
47814
47815 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
47816         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
47817         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
47818         *ret_copy = OnionMessageContents_clone(orig_conv);
47819         uint64_t ret_ref = tag_ptr(ret_copy, true);
47820         return ret_ref;
47821 }
47822
47823 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
47824         void* a_ptr = untag_ptr(a);
47825         CHECK_ACCESS(a_ptr);
47826         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
47827         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
47828                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47829                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
47830         }
47831         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
47832         *ret_copy = OnionMessageContents_custom(a_conv);
47833         uint64_t ret_ref = tag_ptr(ret_copy, true);
47834         return ret_ref;
47835 }
47836
47837 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
47838         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
47839         *ret_ret = CustomOnionMessageContents_clone(arg);
47840         return tag_ptr(ret_ret, true);
47841 }
47842 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
47843         void* arg_ptr = untag_ptr(arg);
47844         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
47845         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
47846         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
47847         return ret_conv;
47848 }
47849
47850 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
47851         void* orig_ptr = untag_ptr(orig);
47852         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
47853         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
47854         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
47855         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
47856         return tag_ptr(ret_ret, true);
47857 }
47858
47859 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
47860         if (!ptr_is_owned(this_ptr)) return;
47861         void* this_ptr_ptr = untag_ptr(this_ptr);
47862         CHECK_ACCESS(this_ptr_ptr);
47863         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
47864         FREE(untag_ptr(this_ptr));
47865         CustomOnionMessageContents_free(this_ptr_conv);
47866 }
47867
47868 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
47869         if (!ptr_is_owned(this_ptr)) return;
47870         void* this_ptr_ptr = untag_ptr(this_ptr);
47871         CHECK_ACCESS(this_ptr_ptr);
47872         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
47873         FREE(untag_ptr(this_ptr));
47874         GossipSync_free(this_ptr_conv);
47875 }
47876
47877 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
47878         LDKP2PGossipSync a_conv;
47879         a_conv.inner = untag_ptr(a);
47880         a_conv.is_owned = ptr_is_owned(a);
47881         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47882         a_conv.is_owned = false;
47883         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47884         *ret_copy = GossipSync_p2_p(&a_conv);
47885         uint64_t ret_ref = tag_ptr(ret_copy, true);
47886         return ret_ref;
47887 }
47888
47889 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
47890         LDKRapidGossipSync a_conv;
47891         a_conv.inner = untag_ptr(a);
47892         a_conv.is_owned = ptr_is_owned(a);
47893         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47894         a_conv.is_owned = false;
47895         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47896         *ret_copy = GossipSync_rapid(&a_conv);
47897         uint64_t ret_ref = tag_ptr(ret_copy, true);
47898         return ret_ref;
47899 }
47900
47901 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
47902         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47903         *ret_copy = GossipSync_none();
47904         uint64_t ret_ref = tag_ptr(ret_copy, true);
47905         return ret_ref;
47906 }
47907
47908 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
47909         LDKRapidGossipSync this_obj_conv;
47910         this_obj_conv.inner = untag_ptr(this_obj);
47911         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47913         RapidGossipSync_free(this_obj_conv);
47914 }
47915
47916 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
47917         LDKNetworkGraph network_graph_conv;
47918         network_graph_conv.inner = untag_ptr(network_graph);
47919         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47920         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47921         network_graph_conv.is_owned = false;
47922         void* logger_ptr = untag_ptr(logger);
47923         CHECK_ACCESS(logger_ptr);
47924         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47925         if (logger_conv.free == LDKLogger_JCalls_free) {
47926                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47927                 LDKLogger_JCalls_cloned(&logger_conv);
47928         }
47929         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
47930         uint64_t ret_ref = 0;
47931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47933         return ret_ref;
47934 }
47935
47936 uint64_t  __attribute__((export_name("TS_RapidGossipSync_update_network_graph"))) TS_RapidGossipSync_update_network_graph(uint64_t this_arg, int8_tArray update_data) {
47937         LDKRapidGossipSync this_arg_conv;
47938         this_arg_conv.inner = untag_ptr(this_arg);
47939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47941         this_arg_conv.is_owned = false;
47942         LDKu8slice update_data_ref;
47943         update_data_ref.datalen = update_data->arr_len;
47944         update_data_ref.data = update_data->elems;
47945         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
47946         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
47947         FREE(update_data);
47948         return tag_ptr(ret_conv, true);
47949 }
47950
47951 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) {
47952         LDKRapidGossipSync this_arg_conv;
47953         this_arg_conv.inner = untag_ptr(this_arg);
47954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47956         this_arg_conv.is_owned = false;
47957         LDKu8slice update_data_ref;
47958         update_data_ref.datalen = update_data->arr_len;
47959         update_data_ref.data = update_data->elems;
47960         void* current_time_unix_ptr = untag_ptr(current_time_unix);
47961         CHECK_ACCESS(current_time_unix_ptr);
47962         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
47963         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
47964         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
47965         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
47966         FREE(update_data);
47967         return tag_ptr(ret_conv, true);
47968 }
47969
47970 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
47971         LDKRapidGossipSync this_arg_conv;
47972         this_arg_conv.inner = untag_ptr(this_arg);
47973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47975         this_arg_conv.is_owned = false;
47976         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
47977         return ret_conv;
47978 }
47979
47980 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
47981         if (!ptr_is_owned(this_ptr)) return;
47982         void* this_ptr_ptr = untag_ptr(this_ptr);
47983         CHECK_ACCESS(this_ptr_ptr);
47984         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
47985         FREE(untag_ptr(this_ptr));
47986         GraphSyncError_free(this_ptr_conv);
47987 }
47988
47989 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
47990         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
47991         *ret_copy = GraphSyncError_clone(arg);
47992         uint64_t ret_ref = tag_ptr(ret_copy, true);
47993         return ret_ref;
47994 }
47995 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
47996         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
47997         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
47998         return ret_conv;
47999 }
48000
48001 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
48002         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
48003         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48004         *ret_copy = GraphSyncError_clone(orig_conv);
48005         uint64_t ret_ref = tag_ptr(ret_copy, true);
48006         return ret_ref;
48007 }
48008
48009 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
48010         void* a_ptr = untag_ptr(a);
48011         CHECK_ACCESS(a_ptr);
48012         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
48013         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
48014         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48015         *ret_copy = GraphSyncError_decode_error(a_conv);
48016         uint64_t ret_ref = tag_ptr(ret_copy, true);
48017         return ret_ref;
48018 }
48019
48020 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
48021         LDKLightningError a_conv;
48022         a_conv.inner = untag_ptr(a);
48023         a_conv.is_owned = ptr_is_owned(a);
48024         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48025         a_conv = LightningError_clone(&a_conv);
48026         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48027         *ret_copy = GraphSyncError_lightning_error(a_conv);
48028         uint64_t ret_ref = tag_ptr(ret_copy, true);
48029         return ret_ref;
48030 }
48031
48032 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
48033         if (!ptr_is_owned(this_ptr)) return;
48034         void* this_ptr_ptr = untag_ptr(this_ptr);
48035         CHECK_ACCESS(this_ptr_ptr);
48036         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
48037         FREE(untag_ptr(this_ptr));
48038         ParseError_free(this_ptr_conv);
48039 }
48040
48041 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
48042         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48043         *ret_copy = ParseError_clone(arg);
48044         uint64_t ret_ref = tag_ptr(ret_copy, true);
48045         return ret_ref;
48046 }
48047 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
48048         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
48049         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
48050         return ret_conv;
48051 }
48052
48053 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
48054         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
48055         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48056         *ret_copy = ParseError_clone(orig_conv);
48057         uint64_t ret_ref = tag_ptr(ret_copy, true);
48058         return ret_ref;
48059 }
48060
48061 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
48062         void* a_ptr = untag_ptr(a);
48063         CHECK_ACCESS(a_ptr);
48064         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
48065         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
48066         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48067         *ret_copy = ParseError_bech32_error(a_conv);
48068         uint64_t ret_ref = tag_ptr(ret_copy, true);
48069         return ret_ref;
48070 }
48071
48072 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
48073         
48074         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48075         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
48076         uint64_t ret_ref = tag_ptr(ret_copy, true);
48077         return ret_ref;
48078 }
48079
48080 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
48081         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
48082         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48083         *ret_copy = ParseError_malformed_signature(a_conv);
48084         uint64_t ret_ref = tag_ptr(ret_copy, true);
48085         return ret_ref;
48086 }
48087
48088 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
48089         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48090         *ret_copy = ParseError_bad_prefix();
48091         uint64_t ret_ref = tag_ptr(ret_copy, true);
48092         return ret_ref;
48093 }
48094
48095 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
48096         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48097         *ret_copy = ParseError_unknown_currency();
48098         uint64_t ret_ref = tag_ptr(ret_copy, true);
48099         return ret_ref;
48100 }
48101
48102 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
48103         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48104         *ret_copy = ParseError_unknown_si_prefix();
48105         uint64_t ret_ref = tag_ptr(ret_copy, true);
48106         return ret_ref;
48107 }
48108
48109 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
48110         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48111         *ret_copy = ParseError_malformed_hrp();
48112         uint64_t ret_ref = tag_ptr(ret_copy, true);
48113         return ret_ref;
48114 }
48115
48116 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
48117         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48118         *ret_copy = ParseError_too_short_data_part();
48119         uint64_t ret_ref = tag_ptr(ret_copy, true);
48120         return ret_ref;
48121 }
48122
48123 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
48124         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48125         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
48126         uint64_t ret_ref = tag_ptr(ret_copy, true);
48127         return ret_ref;
48128 }
48129
48130 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
48131         
48132         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48133         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
48134         uint64_t ret_ref = tag_ptr(ret_copy, true);
48135         return ret_ref;
48136 }
48137
48138 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
48139         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48140         *ret_copy = ParseError_padding_error();
48141         uint64_t ret_ref = tag_ptr(ret_copy, true);
48142         return ret_ref;
48143 }
48144
48145 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
48146         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48147         *ret_copy = ParseError_integer_overflow_error();
48148         uint64_t ret_ref = tag_ptr(ret_copy, true);
48149         return ret_ref;
48150 }
48151
48152 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
48153         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48154         *ret_copy = ParseError_invalid_seg_wit_program_length();
48155         uint64_t ret_ref = tag_ptr(ret_copy, true);
48156         return ret_ref;
48157 }
48158
48159 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
48160         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48161         *ret_copy = ParseError_invalid_pub_key_hash_length();
48162         uint64_t ret_ref = tag_ptr(ret_copy, true);
48163         return ret_ref;
48164 }
48165
48166 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
48167         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48168         *ret_copy = ParseError_invalid_script_hash_length();
48169         uint64_t ret_ref = tag_ptr(ret_copy, true);
48170         return ret_ref;
48171 }
48172
48173 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
48174         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48175         *ret_copy = ParseError_invalid_recovery_id();
48176         uint64_t ret_ref = tag_ptr(ret_copy, true);
48177         return ret_ref;
48178 }
48179
48180 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
48181         LDKStr a_conv = str_ref_to_owned_c(a);
48182         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48183         *ret_copy = ParseError_invalid_slice_length(a_conv);
48184         uint64_t ret_ref = tag_ptr(ret_copy, true);
48185         return ret_ref;
48186 }
48187
48188 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
48189         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48190         *ret_copy = ParseError_skip();
48191         uint64_t ret_ref = tag_ptr(ret_copy, true);
48192         return ret_ref;
48193 }
48194
48195 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
48196         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
48197         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
48198         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
48199         return ret_conv;
48200 }
48201
48202 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
48203         if (!ptr_is_owned(this_ptr)) return;
48204         void* this_ptr_ptr = untag_ptr(this_ptr);
48205         CHECK_ACCESS(this_ptr_ptr);
48206         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
48207         FREE(untag_ptr(this_ptr));
48208         ParseOrSemanticError_free(this_ptr_conv);
48209 }
48210
48211 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
48212         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48213         *ret_copy = ParseOrSemanticError_clone(arg);
48214         uint64_t ret_ref = tag_ptr(ret_copy, true);
48215         return ret_ref;
48216 }
48217 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
48218         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
48219         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
48220         return ret_conv;
48221 }
48222
48223 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
48224         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
48225         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48226         *ret_copy = ParseOrSemanticError_clone(orig_conv);
48227         uint64_t ret_ref = tag_ptr(ret_copy, true);
48228         return ret_ref;
48229 }
48230
48231 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
48232         void* a_ptr = untag_ptr(a);
48233         CHECK_ACCESS(a_ptr);
48234         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
48235         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
48236         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48237         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
48238         uint64_t ret_ref = tag_ptr(ret_copy, true);
48239         return ret_ref;
48240 }
48241
48242 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
48243         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
48244         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48245         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
48246         uint64_t ret_ref = tag_ptr(ret_copy, true);
48247         return ret_ref;
48248 }
48249
48250 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
48251         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
48252         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
48253         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
48254         return ret_conv;
48255 }
48256
48257 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
48258         LDKInvoice this_obj_conv;
48259         this_obj_conv.inner = untag_ptr(this_obj);
48260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48262         Invoice_free(this_obj_conv);
48263 }
48264
48265 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
48266         LDKInvoice a_conv;
48267         a_conv.inner = untag_ptr(a);
48268         a_conv.is_owned = ptr_is_owned(a);
48269         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48270         a_conv.is_owned = false;
48271         LDKInvoice b_conv;
48272         b_conv.inner = untag_ptr(b);
48273         b_conv.is_owned = ptr_is_owned(b);
48274         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48275         b_conv.is_owned = false;
48276         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
48277         return ret_conv;
48278 }
48279
48280 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
48281         LDKInvoice ret_var = Invoice_clone(arg);
48282         uint64_t ret_ref = 0;
48283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48285         return ret_ref;
48286 }
48287 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
48288         LDKInvoice arg_conv;
48289         arg_conv.inner = untag_ptr(arg);
48290         arg_conv.is_owned = ptr_is_owned(arg);
48291         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48292         arg_conv.is_owned = false;
48293         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
48294         return ret_conv;
48295 }
48296
48297 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
48298         LDKInvoice orig_conv;
48299         orig_conv.inner = untag_ptr(orig);
48300         orig_conv.is_owned = ptr_is_owned(orig);
48301         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48302         orig_conv.is_owned = false;
48303         LDKInvoice ret_var = Invoice_clone(&orig_conv);
48304         uint64_t ret_ref = 0;
48305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48307         return ret_ref;
48308 }
48309
48310 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
48311         LDKInvoice o_conv;
48312         o_conv.inner = untag_ptr(o);
48313         o_conv.is_owned = ptr_is_owned(o);
48314         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48315         o_conv.is_owned = false;
48316         int64_t ret_conv = Invoice_hash(&o_conv);
48317         return ret_conv;
48318 }
48319
48320 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
48321         LDKSignedRawInvoice this_obj_conv;
48322         this_obj_conv.inner = untag_ptr(this_obj);
48323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48325         SignedRawInvoice_free(this_obj_conv);
48326 }
48327
48328 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
48329         LDKSignedRawInvoice a_conv;
48330         a_conv.inner = untag_ptr(a);
48331         a_conv.is_owned = ptr_is_owned(a);
48332         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48333         a_conv.is_owned = false;
48334         LDKSignedRawInvoice b_conv;
48335         b_conv.inner = untag_ptr(b);
48336         b_conv.is_owned = ptr_is_owned(b);
48337         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48338         b_conv.is_owned = false;
48339         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
48340         return ret_conv;
48341 }
48342
48343 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
48344         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
48345         uint64_t ret_ref = 0;
48346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48348         return ret_ref;
48349 }
48350 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
48351         LDKSignedRawInvoice arg_conv;
48352         arg_conv.inner = untag_ptr(arg);
48353         arg_conv.is_owned = ptr_is_owned(arg);
48354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48355         arg_conv.is_owned = false;
48356         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
48357         return ret_conv;
48358 }
48359
48360 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
48361         LDKSignedRawInvoice orig_conv;
48362         orig_conv.inner = untag_ptr(orig);
48363         orig_conv.is_owned = ptr_is_owned(orig);
48364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48365         orig_conv.is_owned = false;
48366         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
48367         uint64_t ret_ref = 0;
48368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48370         return ret_ref;
48371 }
48372
48373 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
48374         LDKSignedRawInvoice o_conv;
48375         o_conv.inner = untag_ptr(o);
48376         o_conv.is_owned = ptr_is_owned(o);
48377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48378         o_conv.is_owned = false;
48379         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
48380         return ret_conv;
48381 }
48382
48383 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
48384         LDKRawInvoice this_obj_conv;
48385         this_obj_conv.inner = untag_ptr(this_obj);
48386         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48388         RawInvoice_free(this_obj_conv);
48389 }
48390
48391 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
48392         LDKRawInvoice this_ptr_conv;
48393         this_ptr_conv.inner = untag_ptr(this_ptr);
48394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48396         this_ptr_conv.is_owned = false;
48397         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
48398         uint64_t ret_ref = 0;
48399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48401         return ret_ref;
48402 }
48403
48404 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
48405         LDKRawInvoice this_ptr_conv;
48406         this_ptr_conv.inner = untag_ptr(this_ptr);
48407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48409         this_ptr_conv.is_owned = false;
48410         LDKRawDataPart val_conv;
48411         val_conv.inner = untag_ptr(val);
48412         val_conv.is_owned = ptr_is_owned(val);
48413         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48414         val_conv = RawDataPart_clone(&val_conv);
48415         RawInvoice_set_data(&this_ptr_conv, val_conv);
48416 }
48417
48418 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
48419         LDKRawInvoice a_conv;
48420         a_conv.inner = untag_ptr(a);
48421         a_conv.is_owned = ptr_is_owned(a);
48422         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48423         a_conv.is_owned = false;
48424         LDKRawInvoice b_conv;
48425         b_conv.inner = untag_ptr(b);
48426         b_conv.is_owned = ptr_is_owned(b);
48427         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48428         b_conv.is_owned = false;
48429         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
48430         return ret_conv;
48431 }
48432
48433 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
48434         LDKRawInvoice ret_var = RawInvoice_clone(arg);
48435         uint64_t ret_ref = 0;
48436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48438         return ret_ref;
48439 }
48440 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
48441         LDKRawInvoice arg_conv;
48442         arg_conv.inner = untag_ptr(arg);
48443         arg_conv.is_owned = ptr_is_owned(arg);
48444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48445         arg_conv.is_owned = false;
48446         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
48447         return ret_conv;
48448 }
48449
48450 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
48451         LDKRawInvoice orig_conv;
48452         orig_conv.inner = untag_ptr(orig);
48453         orig_conv.is_owned = ptr_is_owned(orig);
48454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48455         orig_conv.is_owned = false;
48456         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
48457         uint64_t ret_ref = 0;
48458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48460         return ret_ref;
48461 }
48462
48463 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
48464         LDKRawInvoice o_conv;
48465         o_conv.inner = untag_ptr(o);
48466         o_conv.is_owned = ptr_is_owned(o);
48467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48468         o_conv.is_owned = false;
48469         int64_t ret_conv = RawInvoice_hash(&o_conv);
48470         return ret_conv;
48471 }
48472
48473 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
48474         LDKRawDataPart this_obj_conv;
48475         this_obj_conv.inner = untag_ptr(this_obj);
48476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48478         RawDataPart_free(this_obj_conv);
48479 }
48480
48481 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
48482         LDKRawDataPart this_ptr_conv;
48483         this_ptr_conv.inner = untag_ptr(this_ptr);
48484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48486         this_ptr_conv.is_owned = false;
48487         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
48488         uint64_t ret_ref = 0;
48489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48491         return ret_ref;
48492 }
48493
48494 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
48495         LDKRawDataPart 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         LDKPositiveTimestamp val_conv;
48501         val_conv.inner = untag_ptr(val);
48502         val_conv.is_owned = ptr_is_owned(val);
48503         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48504         val_conv = PositiveTimestamp_clone(&val_conv);
48505         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
48506 }
48507
48508 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
48509         LDKRawDataPart a_conv;
48510         a_conv.inner = untag_ptr(a);
48511         a_conv.is_owned = ptr_is_owned(a);
48512         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48513         a_conv.is_owned = false;
48514         LDKRawDataPart b_conv;
48515         b_conv.inner = untag_ptr(b);
48516         b_conv.is_owned = ptr_is_owned(b);
48517         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48518         b_conv.is_owned = false;
48519         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
48520         return ret_conv;
48521 }
48522
48523 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
48524         LDKRawDataPart ret_var = RawDataPart_clone(arg);
48525         uint64_t ret_ref = 0;
48526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48528         return ret_ref;
48529 }
48530 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
48531         LDKRawDataPart arg_conv;
48532         arg_conv.inner = untag_ptr(arg);
48533         arg_conv.is_owned = ptr_is_owned(arg);
48534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48535         arg_conv.is_owned = false;
48536         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
48537         return ret_conv;
48538 }
48539
48540 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
48541         LDKRawDataPart orig_conv;
48542         orig_conv.inner = untag_ptr(orig);
48543         orig_conv.is_owned = ptr_is_owned(orig);
48544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48545         orig_conv.is_owned = false;
48546         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
48547         uint64_t ret_ref = 0;
48548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48550         return ret_ref;
48551 }
48552
48553 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
48554         LDKRawDataPart o_conv;
48555         o_conv.inner = untag_ptr(o);
48556         o_conv.is_owned = ptr_is_owned(o);
48557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48558         o_conv.is_owned = false;
48559         int64_t ret_conv = RawDataPart_hash(&o_conv);
48560         return ret_conv;
48561 }
48562
48563 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
48564         LDKPositiveTimestamp this_obj_conv;
48565         this_obj_conv.inner = untag_ptr(this_obj);
48566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48568         PositiveTimestamp_free(this_obj_conv);
48569 }
48570
48571 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
48572         LDKPositiveTimestamp a_conv;
48573         a_conv.inner = untag_ptr(a);
48574         a_conv.is_owned = ptr_is_owned(a);
48575         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48576         a_conv.is_owned = false;
48577         LDKPositiveTimestamp b_conv;
48578         b_conv.inner = untag_ptr(b);
48579         b_conv.is_owned = ptr_is_owned(b);
48580         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48581         b_conv.is_owned = false;
48582         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
48583         return ret_conv;
48584 }
48585
48586 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
48587         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
48588         uint64_t ret_ref = 0;
48589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48591         return ret_ref;
48592 }
48593 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
48594         LDKPositiveTimestamp arg_conv;
48595         arg_conv.inner = untag_ptr(arg);
48596         arg_conv.is_owned = ptr_is_owned(arg);
48597         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48598         arg_conv.is_owned = false;
48599         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
48600         return ret_conv;
48601 }
48602
48603 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
48604         LDKPositiveTimestamp orig_conv;
48605         orig_conv.inner = untag_ptr(orig);
48606         orig_conv.is_owned = ptr_is_owned(orig);
48607         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48608         orig_conv.is_owned = false;
48609         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
48610         uint64_t ret_ref = 0;
48611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48613         return ret_ref;
48614 }
48615
48616 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
48617         LDKPositiveTimestamp o_conv;
48618         o_conv.inner = untag_ptr(o);
48619         o_conv.is_owned = ptr_is_owned(o);
48620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48621         o_conv.is_owned = false;
48622         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
48623         return ret_conv;
48624 }
48625
48626 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
48627         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
48628         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
48629         return ret_conv;
48630 }
48631
48632 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
48633         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
48634         return ret_conv;
48635 }
48636
48637 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
48638         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
48639         return ret_conv;
48640 }
48641
48642 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
48643         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
48644         return ret_conv;
48645 }
48646
48647 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
48648         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
48649         return ret_conv;
48650 }
48651
48652 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
48653         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
48654         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
48655         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
48656         return ret_conv;
48657 }
48658
48659 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
48660         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
48661         int64_t ret_conv = SiPrefix_hash(o_conv);
48662         return ret_conv;
48663 }
48664
48665 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
48666         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
48667         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
48668         return ret_conv;
48669 }
48670
48671 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
48672         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
48673         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
48674         return ret_conv;
48675 }
48676
48677 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
48678         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
48679         return ret_conv;
48680 }
48681
48682 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
48683         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
48684         return ret_conv;
48685 }
48686
48687 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
48688         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
48689         return ret_conv;
48690 }
48691
48692 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
48693         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
48694         return ret_conv;
48695 }
48696
48697 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
48698         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
48699         return ret_conv;
48700 }
48701
48702 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
48703         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
48704         int64_t ret_conv = Currency_hash(o_conv);
48705         return ret_conv;
48706 }
48707
48708 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
48709         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
48710         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
48711         jboolean ret_conv = Currency_eq(a_conv, b_conv);
48712         return ret_conv;
48713 }
48714
48715 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
48716         LDKSha256 this_obj_conv;
48717         this_obj_conv.inner = untag_ptr(this_obj);
48718         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48720         Sha256_free(this_obj_conv);
48721 }
48722
48723 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
48724         LDKSha256 ret_var = Sha256_clone(arg);
48725         uint64_t ret_ref = 0;
48726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48728         return ret_ref;
48729 }
48730 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
48731         LDKSha256 arg_conv;
48732         arg_conv.inner = untag_ptr(arg);
48733         arg_conv.is_owned = ptr_is_owned(arg);
48734         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48735         arg_conv.is_owned = false;
48736         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
48737         return ret_conv;
48738 }
48739
48740 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
48741         LDKSha256 orig_conv;
48742         orig_conv.inner = untag_ptr(orig);
48743         orig_conv.is_owned = ptr_is_owned(orig);
48744         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48745         orig_conv.is_owned = false;
48746         LDKSha256 ret_var = Sha256_clone(&orig_conv);
48747         uint64_t ret_ref = 0;
48748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48750         return ret_ref;
48751 }
48752
48753 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
48754         LDKSha256 o_conv;
48755         o_conv.inner = untag_ptr(o);
48756         o_conv.is_owned = ptr_is_owned(o);
48757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48758         o_conv.is_owned = false;
48759         int64_t ret_conv = Sha256_hash(&o_conv);
48760         return ret_conv;
48761 }
48762
48763 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
48764         LDKSha256 a_conv;
48765         a_conv.inner = untag_ptr(a);
48766         a_conv.is_owned = ptr_is_owned(a);
48767         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48768         a_conv.is_owned = false;
48769         LDKSha256 b_conv;
48770         b_conv.inner = untag_ptr(b);
48771         b_conv.is_owned = ptr_is_owned(b);
48772         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48773         b_conv.is_owned = false;
48774         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
48775         return ret_conv;
48776 }
48777
48778 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
48779         LDKDescription this_obj_conv;
48780         this_obj_conv.inner = untag_ptr(this_obj);
48781         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48783         Description_free(this_obj_conv);
48784 }
48785
48786 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
48787         LDKDescription ret_var = Description_clone(arg);
48788         uint64_t ret_ref = 0;
48789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48791         return ret_ref;
48792 }
48793 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
48794         LDKDescription arg_conv;
48795         arg_conv.inner = untag_ptr(arg);
48796         arg_conv.is_owned = ptr_is_owned(arg);
48797         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48798         arg_conv.is_owned = false;
48799         int64_t ret_conv = Description_clone_ptr(&arg_conv);
48800         return ret_conv;
48801 }
48802
48803 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
48804         LDKDescription orig_conv;
48805         orig_conv.inner = untag_ptr(orig);
48806         orig_conv.is_owned = ptr_is_owned(orig);
48807         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48808         orig_conv.is_owned = false;
48809         LDKDescription ret_var = Description_clone(&orig_conv);
48810         uint64_t ret_ref = 0;
48811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48813         return ret_ref;
48814 }
48815
48816 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
48817         LDKDescription o_conv;
48818         o_conv.inner = untag_ptr(o);
48819         o_conv.is_owned = ptr_is_owned(o);
48820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48821         o_conv.is_owned = false;
48822         int64_t ret_conv = Description_hash(&o_conv);
48823         return ret_conv;
48824 }
48825
48826 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
48827         LDKDescription a_conv;
48828         a_conv.inner = untag_ptr(a);
48829         a_conv.is_owned = ptr_is_owned(a);
48830         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48831         a_conv.is_owned = false;
48832         LDKDescription b_conv;
48833         b_conv.inner = untag_ptr(b);
48834         b_conv.is_owned = ptr_is_owned(b);
48835         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48836         b_conv.is_owned = false;
48837         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
48838         return ret_conv;
48839 }
48840
48841 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
48842         LDKPayeePubKey this_obj_conv;
48843         this_obj_conv.inner = untag_ptr(this_obj);
48844         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48846         PayeePubKey_free(this_obj_conv);
48847 }
48848
48849 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
48850         LDKPayeePubKey this_ptr_conv;
48851         this_ptr_conv.inner = untag_ptr(this_ptr);
48852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48854         this_ptr_conv.is_owned = false;
48855         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48856         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
48857         return ret_arr;
48858 }
48859
48860 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
48861         LDKPayeePubKey this_ptr_conv;
48862         this_ptr_conv.inner = untag_ptr(this_ptr);
48863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48865         this_ptr_conv.is_owned = false;
48866         LDKPublicKey val_ref;
48867         CHECK(val->arr_len == 33);
48868         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48869         PayeePubKey_set_a(&this_ptr_conv, val_ref);
48870 }
48871
48872 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
48873         LDKPublicKey a_arg_ref;
48874         CHECK(a_arg->arr_len == 33);
48875         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
48876         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
48877         uint64_t ret_ref = 0;
48878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48880         return ret_ref;
48881 }
48882
48883 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
48884         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
48885         uint64_t ret_ref = 0;
48886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48888         return ret_ref;
48889 }
48890 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
48891         LDKPayeePubKey arg_conv;
48892         arg_conv.inner = untag_ptr(arg);
48893         arg_conv.is_owned = ptr_is_owned(arg);
48894         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48895         arg_conv.is_owned = false;
48896         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
48897         return ret_conv;
48898 }
48899
48900 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
48901         LDKPayeePubKey orig_conv;
48902         orig_conv.inner = untag_ptr(orig);
48903         orig_conv.is_owned = ptr_is_owned(orig);
48904         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48905         orig_conv.is_owned = false;
48906         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
48907         uint64_t ret_ref = 0;
48908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48910         return ret_ref;
48911 }
48912
48913 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
48914         LDKPayeePubKey o_conv;
48915         o_conv.inner = untag_ptr(o);
48916         o_conv.is_owned = ptr_is_owned(o);
48917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48918         o_conv.is_owned = false;
48919         int64_t ret_conv = PayeePubKey_hash(&o_conv);
48920         return ret_conv;
48921 }
48922
48923 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
48924         LDKPayeePubKey a_conv;
48925         a_conv.inner = untag_ptr(a);
48926         a_conv.is_owned = ptr_is_owned(a);
48927         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48928         a_conv.is_owned = false;
48929         LDKPayeePubKey b_conv;
48930         b_conv.inner = untag_ptr(b);
48931         b_conv.is_owned = ptr_is_owned(b);
48932         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48933         b_conv.is_owned = false;
48934         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
48935         return ret_conv;
48936 }
48937
48938 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
48939         LDKExpiryTime this_obj_conv;
48940         this_obj_conv.inner = untag_ptr(this_obj);
48941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48943         ExpiryTime_free(this_obj_conv);
48944 }
48945
48946 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
48947         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
48948         uint64_t ret_ref = 0;
48949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48951         return ret_ref;
48952 }
48953 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
48954         LDKExpiryTime arg_conv;
48955         arg_conv.inner = untag_ptr(arg);
48956         arg_conv.is_owned = ptr_is_owned(arg);
48957         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48958         arg_conv.is_owned = false;
48959         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
48960         return ret_conv;
48961 }
48962
48963 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
48964         LDKExpiryTime orig_conv;
48965         orig_conv.inner = untag_ptr(orig);
48966         orig_conv.is_owned = ptr_is_owned(orig);
48967         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48968         orig_conv.is_owned = false;
48969         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
48970         uint64_t ret_ref = 0;
48971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48973         return ret_ref;
48974 }
48975
48976 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
48977         LDKExpiryTime o_conv;
48978         o_conv.inner = untag_ptr(o);
48979         o_conv.is_owned = ptr_is_owned(o);
48980         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48981         o_conv.is_owned = false;
48982         int64_t ret_conv = ExpiryTime_hash(&o_conv);
48983         return ret_conv;
48984 }
48985
48986 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
48987         LDKExpiryTime a_conv;
48988         a_conv.inner = untag_ptr(a);
48989         a_conv.is_owned = ptr_is_owned(a);
48990         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48991         a_conv.is_owned = false;
48992         LDKExpiryTime b_conv;
48993         b_conv.inner = untag_ptr(b);
48994         b_conv.is_owned = ptr_is_owned(b);
48995         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48996         b_conv.is_owned = false;
48997         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
48998         return ret_conv;
48999 }
49000
49001 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
49002         LDKMinFinalCltvExpiryDelta this_obj_conv;
49003         this_obj_conv.inner = untag_ptr(this_obj);
49004         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49006         MinFinalCltvExpiryDelta_free(this_obj_conv);
49007 }
49008
49009 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
49010         LDKMinFinalCltvExpiryDelta this_ptr_conv;
49011         this_ptr_conv.inner = untag_ptr(this_ptr);
49012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49014         this_ptr_conv.is_owned = false;
49015         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
49016         return ret_conv;
49017 }
49018
49019 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
49020         LDKMinFinalCltvExpiryDelta this_ptr_conv;
49021         this_ptr_conv.inner = untag_ptr(this_ptr);
49022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49024         this_ptr_conv.is_owned = false;
49025         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
49026 }
49027
49028 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
49029         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
49030         uint64_t ret_ref = 0;
49031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49033         return ret_ref;
49034 }
49035
49036 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
49037         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
49038         uint64_t ret_ref = 0;
49039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49041         return ret_ref;
49042 }
49043 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
49044         LDKMinFinalCltvExpiryDelta arg_conv;
49045         arg_conv.inner = untag_ptr(arg);
49046         arg_conv.is_owned = ptr_is_owned(arg);
49047         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49048         arg_conv.is_owned = false;
49049         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
49050         return ret_conv;
49051 }
49052
49053 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
49054         LDKMinFinalCltvExpiryDelta orig_conv;
49055         orig_conv.inner = untag_ptr(orig);
49056         orig_conv.is_owned = ptr_is_owned(orig);
49057         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49058         orig_conv.is_owned = false;
49059         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
49060         uint64_t ret_ref = 0;
49061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49063         return ret_ref;
49064 }
49065
49066 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
49067         LDKMinFinalCltvExpiryDelta o_conv;
49068         o_conv.inner = untag_ptr(o);
49069         o_conv.is_owned = ptr_is_owned(o);
49070         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49071         o_conv.is_owned = false;
49072         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
49073         return ret_conv;
49074 }
49075
49076 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
49077         LDKMinFinalCltvExpiryDelta a_conv;
49078         a_conv.inner = untag_ptr(a);
49079         a_conv.is_owned = ptr_is_owned(a);
49080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49081         a_conv.is_owned = false;
49082         LDKMinFinalCltvExpiryDelta b_conv;
49083         b_conv.inner = untag_ptr(b);
49084         b_conv.is_owned = ptr_is_owned(b);
49085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49086         b_conv.is_owned = false;
49087         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
49088         return ret_conv;
49089 }
49090
49091 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
49092         if (!ptr_is_owned(this_ptr)) return;
49093         void* this_ptr_ptr = untag_ptr(this_ptr);
49094         CHECK_ACCESS(this_ptr_ptr);
49095         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
49096         FREE(untag_ptr(this_ptr));
49097         Fallback_free(this_ptr_conv);
49098 }
49099
49100 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
49101         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49102         *ret_copy = Fallback_clone(arg);
49103         uint64_t ret_ref = tag_ptr(ret_copy, true);
49104         return ret_ref;
49105 }
49106 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
49107         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
49108         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
49109         return ret_conv;
49110 }
49111
49112 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
49113         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
49114         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49115         *ret_copy = Fallback_clone(orig_conv);
49116         uint64_t ret_ref = tag_ptr(ret_copy, true);
49117         return ret_ref;
49118 }
49119
49120 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
49121         
49122         LDKCVec_u8Z program_ref;
49123         program_ref.datalen = program->arr_len;
49124         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
49125         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
49126         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49127         *ret_copy = Fallback_seg_wit_program((LDKU5){ ._0 = version }, program_ref);
49128         uint64_t ret_ref = tag_ptr(ret_copy, true);
49129         return ret_ref;
49130 }
49131
49132 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
49133         LDKTwentyBytes a_ref;
49134         CHECK(a->arr_len == 20);
49135         memcpy(a_ref.data, a->elems, 20); FREE(a);
49136         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49137         *ret_copy = Fallback_pub_key_hash(a_ref);
49138         uint64_t ret_ref = tag_ptr(ret_copy, true);
49139         return ret_ref;
49140 }
49141
49142 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
49143         LDKTwentyBytes a_ref;
49144         CHECK(a->arr_len == 20);
49145         memcpy(a_ref.data, a->elems, 20); FREE(a);
49146         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49147         *ret_copy = Fallback_script_hash(a_ref);
49148         uint64_t ret_ref = tag_ptr(ret_copy, true);
49149         return ret_ref;
49150 }
49151
49152 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
49153         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
49154         int64_t ret_conv = Fallback_hash(o_conv);
49155         return ret_conv;
49156 }
49157
49158 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
49159         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
49160         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
49161         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
49162         return ret_conv;
49163 }
49164
49165 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
49166         LDKInvoiceSignature this_obj_conv;
49167         this_obj_conv.inner = untag_ptr(this_obj);
49168         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49170         InvoiceSignature_free(this_obj_conv);
49171 }
49172
49173 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
49174         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
49175         uint64_t ret_ref = 0;
49176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49178         return ret_ref;
49179 }
49180 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
49181         LDKInvoiceSignature arg_conv;
49182         arg_conv.inner = untag_ptr(arg);
49183         arg_conv.is_owned = ptr_is_owned(arg);
49184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49185         arg_conv.is_owned = false;
49186         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
49187         return ret_conv;
49188 }
49189
49190 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
49191         LDKInvoiceSignature orig_conv;
49192         orig_conv.inner = untag_ptr(orig);
49193         orig_conv.is_owned = ptr_is_owned(orig);
49194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49195         orig_conv.is_owned = false;
49196         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
49197         uint64_t ret_ref = 0;
49198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49200         return ret_ref;
49201 }
49202
49203 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
49204         LDKInvoiceSignature o_conv;
49205         o_conv.inner = untag_ptr(o);
49206         o_conv.is_owned = ptr_is_owned(o);
49207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49208         o_conv.is_owned = false;
49209         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
49210         return ret_conv;
49211 }
49212
49213 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
49214         LDKInvoiceSignature a_conv;
49215         a_conv.inner = untag_ptr(a);
49216         a_conv.is_owned = ptr_is_owned(a);
49217         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49218         a_conv.is_owned = false;
49219         LDKInvoiceSignature b_conv;
49220         b_conv.inner = untag_ptr(b);
49221         b_conv.is_owned = ptr_is_owned(b);
49222         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49223         b_conv.is_owned = false;
49224         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
49225         return ret_conv;
49226 }
49227
49228 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
49229         LDKPrivateRoute this_obj_conv;
49230         this_obj_conv.inner = untag_ptr(this_obj);
49231         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49233         PrivateRoute_free(this_obj_conv);
49234 }
49235
49236 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
49237         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
49238         uint64_t ret_ref = 0;
49239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49241         return ret_ref;
49242 }
49243 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
49244         LDKPrivateRoute arg_conv;
49245         arg_conv.inner = untag_ptr(arg);
49246         arg_conv.is_owned = ptr_is_owned(arg);
49247         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49248         arg_conv.is_owned = false;
49249         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
49250         return ret_conv;
49251 }
49252
49253 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
49254         LDKPrivateRoute orig_conv;
49255         orig_conv.inner = untag_ptr(orig);
49256         orig_conv.is_owned = ptr_is_owned(orig);
49257         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49258         orig_conv.is_owned = false;
49259         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
49260         uint64_t ret_ref = 0;
49261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49263         return ret_ref;
49264 }
49265
49266 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
49267         LDKPrivateRoute o_conv;
49268         o_conv.inner = untag_ptr(o);
49269         o_conv.is_owned = ptr_is_owned(o);
49270         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49271         o_conv.is_owned = false;
49272         int64_t ret_conv = PrivateRoute_hash(&o_conv);
49273         return ret_conv;
49274 }
49275
49276 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
49277         LDKPrivateRoute a_conv;
49278         a_conv.inner = untag_ptr(a);
49279         a_conv.is_owned = ptr_is_owned(a);
49280         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49281         a_conv.is_owned = false;
49282         LDKPrivateRoute b_conv;
49283         b_conv.inner = untag_ptr(b);
49284         b_conv.is_owned = ptr_is_owned(b);
49285         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49286         b_conv.is_owned = false;
49287         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
49288         return ret_conv;
49289 }
49290
49291 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
49292         LDKSignedRawInvoice this_arg_conv;
49293         this_arg_conv.inner = untag_ptr(this_arg);
49294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49296         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
49297         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
49298         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
49299         return tag_ptr(ret_conv, true);
49300 }
49301
49302 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
49303         LDKSignedRawInvoice this_arg_conv;
49304         this_arg_conv.inner = untag_ptr(this_arg);
49305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49307         this_arg_conv.is_owned = false;
49308         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
49309         uint64_t ret_ref = 0;
49310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49312         return ret_ref;
49313 }
49314
49315 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
49316         LDKSignedRawInvoice this_arg_conv;
49317         this_arg_conv.inner = untag_ptr(this_arg);
49318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49320         this_arg_conv.is_owned = false;
49321         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49322         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
49323         return ret_arr;
49324 }
49325
49326 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
49327         LDKSignedRawInvoice this_arg_conv;
49328         this_arg_conv.inner = untag_ptr(this_arg);
49329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49331         this_arg_conv.is_owned = false;
49332         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
49333         uint64_t ret_ref = 0;
49334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49336         return ret_ref;
49337 }
49338
49339 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
49340         LDKSignedRawInvoice this_arg_conv;
49341         this_arg_conv.inner = untag_ptr(this_arg);
49342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49344         this_arg_conv.is_owned = false;
49345         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
49346         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
49347         return tag_ptr(ret_conv, true);
49348 }
49349
49350 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
49351         LDKSignedRawInvoice this_arg_conv;
49352         this_arg_conv.inner = untag_ptr(this_arg);
49353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49355         this_arg_conv.is_owned = false;
49356         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
49357         return ret_conv;
49358 }
49359
49360 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
49361         LDKRawInvoice this_arg_conv;
49362         this_arg_conv.inner = untag_ptr(this_arg);
49363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49365         this_arg_conv.is_owned = false;
49366         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49367         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
49368         return ret_arr;
49369 }
49370
49371 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
49372         LDKRawInvoice this_arg_conv;
49373         this_arg_conv.inner = untag_ptr(this_arg);
49374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49376         this_arg_conv.is_owned = false;
49377         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
49378         uint64_t ret_ref = 0;
49379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49381         return ret_ref;
49382 }
49383
49384 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
49385         LDKRawInvoice this_arg_conv;
49386         this_arg_conv.inner = untag_ptr(this_arg);
49387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49389         this_arg_conv.is_owned = false;
49390         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
49391         uint64_t ret_ref = 0;
49392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49394         return ret_ref;
49395 }
49396
49397 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
49398         LDKRawInvoice this_arg_conv;
49399         this_arg_conv.inner = untag_ptr(this_arg);
49400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49402         this_arg_conv.is_owned = false;
49403         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
49404         uint64_t ret_ref = 0;
49405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49407         return ret_ref;
49408 }
49409
49410 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
49411         LDKRawInvoice this_arg_conv;
49412         this_arg_conv.inner = untag_ptr(this_arg);
49413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49415         this_arg_conv.is_owned = false;
49416         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
49417         uint64_t ret_ref = 0;
49418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49420         return ret_ref;
49421 }
49422
49423 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
49424         LDKRawInvoice this_arg_conv;
49425         this_arg_conv.inner = untag_ptr(this_arg);
49426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49428         this_arg_conv.is_owned = false;
49429         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
49430         uint64_t ret_ref = 0;
49431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49433         return ret_ref;
49434 }
49435
49436 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry_delta"))) TS_RawInvoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
49437         LDKRawInvoice this_arg_conv;
49438         this_arg_conv.inner = untag_ptr(this_arg);
49439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49441         this_arg_conv.is_owned = false;
49442         LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&this_arg_conv);
49443         uint64_t ret_ref = 0;
49444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49446         return ret_ref;
49447 }
49448
49449 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
49450         LDKRawInvoice this_arg_conv;
49451         this_arg_conv.inner = untag_ptr(this_arg);
49452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49454         this_arg_conv.is_owned = false;
49455         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49456         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
49457         return ret_arr;
49458 }
49459
49460 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
49461         LDKRawInvoice this_arg_conv;
49462         this_arg_conv.inner = untag_ptr(this_arg);
49463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49465         this_arg_conv.is_owned = false;
49466         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
49467         uint64_t ret_ref = 0;
49468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49470         return ret_ref;
49471 }
49472
49473 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
49474         LDKRawInvoice this_arg_conv;
49475         this_arg_conv.inner = untag_ptr(this_arg);
49476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49478         this_arg_conv.is_owned = false;
49479         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
49480         uint64_tArray ret_arr = NULL;
49481         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
49482         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
49483         for (size_t o = 0; o < ret_var.datalen; o++) {
49484                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
49485                 uint64_t ret_conv_14_ref = 0;
49486                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
49487                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
49488                 ret_arr_ptr[o] = ret_conv_14_ref;
49489         }
49490         
49491         FREE(ret_var.data);
49492         return ret_arr;
49493 }
49494
49495 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
49496         LDKRawInvoice this_arg_conv;
49497         this_arg_conv.inner = untag_ptr(this_arg);
49498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49500         this_arg_conv.is_owned = false;
49501         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49502         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
49503         uint64_t ret_ref = tag_ptr(ret_copy, true);
49504         return ret_ref;
49505 }
49506
49507 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
49508         LDKRawInvoice this_arg_conv;
49509         this_arg_conv.inner = untag_ptr(this_arg);
49510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49512         this_arg_conv.is_owned = false;
49513         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
49514         return ret_conv;
49515 }
49516
49517 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
49518         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
49519         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
49520         return tag_ptr(ret_conv, true);
49521 }
49522
49523 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
49524         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
49525         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
49526         return tag_ptr(ret_conv, true);
49527 }
49528
49529 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
49530         LDKPositiveTimestamp this_arg_conv;
49531         this_arg_conv.inner = untag_ptr(this_arg);
49532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49534         this_arg_conv.is_owned = false;
49535         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
49536         return ret_conv;
49537 }
49538
49539 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
49540         LDKPositiveTimestamp this_arg_conv;
49541         this_arg_conv.inner = untag_ptr(this_arg);
49542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49544         this_arg_conv.is_owned = false;
49545         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
49546         return ret_conv;
49547 }
49548
49549 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
49550         LDKInvoice this_arg_conv;
49551         this_arg_conv.inner = untag_ptr(this_arg);
49552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49554         this_arg_conv = Invoice_clone(&this_arg_conv);
49555         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
49556         uint64_t ret_ref = 0;
49557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49559         return ret_ref;
49560 }
49561
49562 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
49563         LDKInvoice this_arg_conv;
49564         this_arg_conv.inner = untag_ptr(this_arg);
49565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49567         this_arg_conv.is_owned = false;
49568         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
49569         *ret_conv = Invoice_check_signature(&this_arg_conv);
49570         return tag_ptr(ret_conv, true);
49571 }
49572
49573 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
49574         LDKSignedRawInvoice signed_invoice_conv;
49575         signed_invoice_conv.inner = untag_ptr(signed_invoice);
49576         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
49577         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
49578         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
49579         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
49580         *ret_conv = Invoice_from_signed(signed_invoice_conv);
49581         return tag_ptr(ret_conv, true);
49582 }
49583
49584 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
49585         LDKInvoice this_arg_conv;
49586         this_arg_conv.inner = untag_ptr(this_arg);
49587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49589         this_arg_conv.is_owned = false;
49590         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
49591         return ret_conv;
49592 }
49593
49594 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
49595         LDKInvoice this_arg_conv;
49596         this_arg_conv.inner = untag_ptr(this_arg);
49597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49599         this_arg_conv.is_owned = false;
49600         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49601         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
49602         return ret_arr;
49603 }
49604
49605 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
49606         LDKInvoice this_arg_conv;
49607         this_arg_conv.inner = untag_ptr(this_arg);
49608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49610         this_arg_conv.is_owned = false;
49611         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49612         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
49613         return ret_arr;
49614 }
49615
49616 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
49617         LDKInvoice this_arg_conv;
49618         this_arg_conv.inner = untag_ptr(this_arg);
49619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49621         this_arg_conv.is_owned = false;
49622         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49623         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
49624         return ret_arr;
49625 }
49626
49627 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
49628         LDKInvoice this_arg_conv;
49629         this_arg_conv.inner = untag_ptr(this_arg);
49630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49632         this_arg_conv.is_owned = false;
49633         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
49634         uint64_t ret_ref = 0;
49635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49637         return ret_ref;
49638 }
49639
49640 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
49641         LDKInvoice this_arg_conv;
49642         this_arg_conv.inner = untag_ptr(this_arg);
49643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49645         this_arg_conv.is_owned = false;
49646         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49647         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
49648         return ret_arr;
49649 }
49650
49651 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
49652         LDKInvoice this_arg_conv;
49653         this_arg_conv.inner = untag_ptr(this_arg);
49654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49656         this_arg_conv.is_owned = false;
49657         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
49658         return ret_conv;
49659 }
49660
49661 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
49662         LDKInvoice this_arg_conv;
49663         this_arg_conv.inner = untag_ptr(this_arg);
49664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49666         this_arg_conv.is_owned = false;
49667         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
49668         return ret_conv;
49669 }
49670
49671 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry_delta"))) TS_Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
49672         LDKInvoice this_arg_conv;
49673         this_arg_conv.inner = untag_ptr(this_arg);
49674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49676         this_arg_conv.is_owned = false;
49677         int64_t ret_conv = Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
49678         return ret_conv;
49679 }
49680
49681 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
49682         LDKInvoice this_arg_conv;
49683         this_arg_conv.inner = untag_ptr(this_arg);
49684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49686         this_arg_conv.is_owned = false;
49687         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
49688         uint64_tArray ret_arr = NULL;
49689         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
49690         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
49691         for (size_t o = 0; o < ret_var.datalen; o++) {
49692                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
49693                 uint64_t ret_conv_14_ref = 0;
49694                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
49695                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
49696                 ret_arr_ptr[o] = ret_conv_14_ref;
49697         }
49698         
49699         FREE(ret_var.data);
49700         return ret_arr;
49701 }
49702
49703 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
49704         LDKInvoice this_arg_conv;
49705         this_arg_conv.inner = untag_ptr(this_arg);
49706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49708         this_arg_conv.is_owned = false;
49709         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
49710         uint64_tArray ret_arr = NULL;
49711         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
49712         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
49713         for (size_t l = 0; l < ret_var.datalen; l++) {
49714                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
49715                 uint64_t ret_conv_11_ref = 0;
49716                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
49717                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
49718                 ret_arr_ptr[l] = ret_conv_11_ref;
49719         }
49720         
49721         FREE(ret_var.data);
49722         return ret_arr;
49723 }
49724
49725 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
49726         LDKInvoice this_arg_conv;
49727         this_arg_conv.inner = untag_ptr(this_arg);
49728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49730         this_arg_conv.is_owned = false;
49731         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
49732         return ret_conv;
49733 }
49734
49735 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
49736         LDKInvoice this_arg_conv;
49737         this_arg_conv.inner = untag_ptr(this_arg);
49738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49740         this_arg_conv.is_owned = false;
49741         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49742         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
49743         uint64_t ret_ref = tag_ptr(ret_copy, true);
49744         return ret_ref;
49745 }
49746
49747 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
49748         LDKStr description_conv = str_ref_to_owned_c(description);
49749         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
49750         *ret_conv = Description_new(description_conv);
49751         return tag_ptr(ret_conv, true);
49752 }
49753
49754 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
49755         LDKDescription this_arg_conv;
49756         this_arg_conv.inner = untag_ptr(this_arg);
49757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49759         this_arg_conv = Description_clone(&this_arg_conv);
49760         LDKStr ret_str = Description_into_inner(this_arg_conv);
49761         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
49762         Str_free(ret_str);
49763         return ret_conv;
49764 }
49765
49766 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
49767         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
49768         uint64_t ret_ref = 0;
49769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49771         return ret_ref;
49772 }
49773
49774 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
49775         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
49776         uint64_t ret_ref = 0;
49777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49779         return ret_ref;
49780 }
49781
49782 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
49783         LDKExpiryTime this_arg_conv;
49784         this_arg_conv.inner = untag_ptr(this_arg);
49785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49787         this_arg_conv.is_owned = false;
49788         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
49789         return ret_conv;
49790 }
49791
49792 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
49793         LDKExpiryTime this_arg_conv;
49794         this_arg_conv.inner = untag_ptr(this_arg);
49795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49797         this_arg_conv.is_owned = false;
49798         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
49799         return ret_conv;
49800 }
49801
49802 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
49803         LDKRouteHint hops_conv;
49804         hops_conv.inner = untag_ptr(hops);
49805         hops_conv.is_owned = ptr_is_owned(hops);
49806         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
49807         hops_conv = RouteHint_clone(&hops_conv);
49808         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
49809         *ret_conv = PrivateRoute_new(hops_conv);
49810         return tag_ptr(ret_conv, true);
49811 }
49812
49813 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
49814         LDKPrivateRoute this_arg_conv;
49815         this_arg_conv.inner = untag_ptr(this_arg);
49816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49818         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
49819         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
49820         uint64_t ret_ref = 0;
49821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49823         return ret_ref;
49824 }
49825
49826 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
49827         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
49828         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
49829         return ret_conv;
49830 }
49831
49832 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
49833         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
49834         return ret_conv;
49835 }
49836
49837 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
49838         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
49839         return ret_conv;
49840 }
49841
49842 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
49843         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
49844         return ret_conv;
49845 }
49846
49847 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
49848         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
49849         return ret_conv;
49850 }
49851
49852 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
49853         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
49854         return ret_conv;
49855 }
49856
49857 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
49858         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
49859         return ret_conv;
49860 }
49861
49862 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
49863         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
49864         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
49865         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
49866         return ret_conv;
49867 }
49868
49869 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
49870         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
49871         LDKStr ret_str = CreationError_to_str(o_conv);
49872         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
49873         Str_free(ret_str);
49874         return ret_conv;
49875 }
49876
49877 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
49878         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
49879         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
49880         return ret_conv;
49881 }
49882
49883 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
49884         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
49885         return ret_conv;
49886 }
49887
49888 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
49889         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
49890         return ret_conv;
49891 }
49892
49893 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
49894         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
49895         return ret_conv;
49896 }
49897
49898 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
49899         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
49900         return ret_conv;
49901 }
49902
49903 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
49904         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
49905         return ret_conv;
49906 }
49907
49908 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
49909         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
49910         return ret_conv;
49911 }
49912
49913 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
49914         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
49915         return ret_conv;
49916 }
49917
49918 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
49919         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
49920         return ret_conv;
49921 }
49922
49923 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
49924         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
49925         return ret_conv;
49926 }
49927
49928 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
49929         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
49930         return ret_conv;
49931 }
49932
49933 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
49934         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
49935         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
49936         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
49937         return ret_conv;
49938 }
49939
49940 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
49941         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
49942         LDKStr ret_str = SemanticError_to_str(o_conv);
49943         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
49944         Str_free(ret_str);
49945         return ret_conv;
49946 }
49947
49948 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
49949         if (!ptr_is_owned(this_ptr)) return;
49950         void* this_ptr_ptr = untag_ptr(this_ptr);
49951         CHECK_ACCESS(this_ptr_ptr);
49952         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
49953         FREE(untag_ptr(this_ptr));
49954         SignOrCreationError_free(this_ptr_conv);
49955 }
49956
49957 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
49958         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49959         *ret_copy = SignOrCreationError_clone(arg);
49960         uint64_t ret_ref = tag_ptr(ret_copy, true);
49961         return ret_ref;
49962 }
49963 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
49964         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
49965         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
49966         return ret_conv;
49967 }
49968
49969 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
49970         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
49971         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49972         *ret_copy = SignOrCreationError_clone(orig_conv);
49973         uint64_t ret_ref = tag_ptr(ret_copy, true);
49974         return ret_ref;
49975 }
49976
49977 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
49978         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49979         *ret_copy = SignOrCreationError_sign_error();
49980         uint64_t ret_ref = tag_ptr(ret_copy, true);
49981         return ret_ref;
49982 }
49983
49984 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
49985         LDKCreationError a_conv = LDKCreationError_from_js(a);
49986         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49987         *ret_copy = SignOrCreationError_creation_error(a_conv);
49988         uint64_t ret_ref = tag_ptr(ret_copy, true);
49989         return ret_ref;
49990 }
49991
49992 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
49993         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
49994         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
49995         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
49996         return ret_conv;
49997 }
49998
49999 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
50000         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
50001         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
50002         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50003         Str_free(ret_str);
50004         return ret_conv;
50005 }
50006
50007 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
50008         LDKInvoice invoice_conv;
50009         invoice_conv.inner = untag_ptr(invoice);
50010         invoice_conv.is_owned = ptr_is_owned(invoice);
50011         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50012         invoice_conv.is_owned = false;
50013         void* retry_strategy_ptr = untag_ptr(retry_strategy);
50014         CHECK_ACCESS(retry_strategy_ptr);
50015         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
50016         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
50017         LDKChannelManager channelmanager_conv;
50018         channelmanager_conv.inner = untag_ptr(channelmanager);
50019         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50020         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50021         channelmanager_conv.is_owned = false;
50022         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
50023         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
50024         return tag_ptr(ret_conv, true);
50025 }
50026
50027 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) {
50028         LDKInvoice invoice_conv;
50029         invoice_conv.inner = untag_ptr(invoice);
50030         invoice_conv.is_owned = ptr_is_owned(invoice);
50031         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50032         invoice_conv.is_owned = false;
50033         LDKThirtyTwoBytes payment_id_ref;
50034         CHECK(payment_id->arr_len == 32);
50035         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
50036         void* retry_strategy_ptr = untag_ptr(retry_strategy);
50037         CHECK_ACCESS(retry_strategy_ptr);
50038         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
50039         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
50040         LDKChannelManager channelmanager_conv;
50041         channelmanager_conv.inner = untag_ptr(channelmanager);
50042         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50043         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50044         channelmanager_conv.is_owned = false;
50045         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
50046         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
50047         return tag_ptr(ret_conv, true);
50048 }
50049
50050 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) {
50051         LDKInvoice invoice_conv;
50052         invoice_conv.inner = untag_ptr(invoice);
50053         invoice_conv.is_owned = ptr_is_owned(invoice);
50054         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50055         invoice_conv.is_owned = false;
50056         void* retry_strategy_ptr = untag_ptr(retry_strategy);
50057         CHECK_ACCESS(retry_strategy_ptr);
50058         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
50059         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
50060         LDKChannelManager channelmanager_conv;
50061         channelmanager_conv.inner = untag_ptr(channelmanager);
50062         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50063         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50064         channelmanager_conv.is_owned = false;
50065         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
50066         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
50067         return tag_ptr(ret_conv, true);
50068 }
50069
50070 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) {
50071         LDKInvoice invoice_conv;
50072         invoice_conv.inner = untag_ptr(invoice);
50073         invoice_conv.is_owned = ptr_is_owned(invoice);
50074         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50075         invoice_conv.is_owned = false;
50076         LDKThirtyTwoBytes payment_id_ref;
50077         CHECK(payment_id->arr_len == 32);
50078         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
50079         void* retry_strategy_ptr = untag_ptr(retry_strategy);
50080         CHECK_ACCESS(retry_strategy_ptr);
50081         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
50082         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
50083         LDKChannelManager channelmanager_conv;
50084         channelmanager_conv.inner = untag_ptr(channelmanager);
50085         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50086         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50087         channelmanager_conv.is_owned = false;
50088         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
50089         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
50090         return tag_ptr(ret_conv, true);
50091 }
50092
50093 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
50094         if (!ptr_is_owned(this_ptr)) return;
50095         void* this_ptr_ptr = untag_ptr(this_ptr);
50096         CHECK_ACCESS(this_ptr_ptr);
50097         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
50098         FREE(untag_ptr(this_ptr));
50099         PaymentError_free(this_ptr_conv);
50100 }
50101
50102 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
50103         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50104         *ret_copy = PaymentError_clone(arg);
50105         uint64_t ret_ref = tag_ptr(ret_copy, true);
50106         return ret_ref;
50107 }
50108 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
50109         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
50110         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
50111         return ret_conv;
50112 }
50113
50114 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
50115         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
50116         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50117         *ret_copy = PaymentError_clone(orig_conv);
50118         uint64_t ret_ref = tag_ptr(ret_copy, true);
50119         return ret_ref;
50120 }
50121
50122 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
50123         LDKStr a_conv = str_ref_to_owned_c(a);
50124         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50125         *ret_copy = PaymentError_invoice(a_conv);
50126         uint64_t ret_ref = tag_ptr(ret_copy, true);
50127         return ret_ref;
50128 }
50129
50130 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
50131         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
50132         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50133         *ret_copy = PaymentError_sending(a_conv);
50134         uint64_t ret_ref = tag_ptr(ret_copy, true);
50135         return ret_ref;
50136 }
50137
50138 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) {
50139         void* amt_msat_ptr = untag_ptr(amt_msat);
50140         CHECK_ACCESS(amt_msat_ptr);
50141         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50142         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50143         LDKThirtyTwoBytes payment_hash_ref;
50144         CHECK(payment_hash->arr_len == 32);
50145         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50146         LDKStr description_conv = str_ref_to_owned_c(description);
50147         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
50148         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
50149         if (phantom_route_hints_constr.datalen > 0)
50150                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
50151         else
50152                 phantom_route_hints_constr.data = NULL;
50153         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
50154         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
50155                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
50156                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
50157                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
50158                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
50159                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
50160                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
50161                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
50162         }
50163         FREE(phantom_route_hints);
50164         void* entropy_source_ptr = untag_ptr(entropy_source);
50165         CHECK_ACCESS(entropy_source_ptr);
50166         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
50167         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
50168                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50169                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
50170         }
50171         void* node_signer_ptr = untag_ptr(node_signer);
50172         CHECK_ACCESS(node_signer_ptr);
50173         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50174         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50175                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50176                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50177         }
50178         void* logger_ptr = untag_ptr(logger);
50179         CHECK_ACCESS(logger_ptr);
50180         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50181         if (logger_conv.free == LDKLogger_JCalls_free) {
50182                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50183                 LDKLogger_JCalls_cloned(&logger_conv);
50184         }
50185         LDKCurrency network_conv = LDKCurrency_from_js(network);
50186         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50187         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50188         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50189         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50190         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50191         *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);
50192         return tag_ptr(ret_conv, true);
50193 }
50194
50195 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) {
50196         void* amt_msat_ptr = untag_ptr(amt_msat);
50197         CHECK_ACCESS(amt_msat_ptr);
50198         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50199         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50200         LDKThirtyTwoBytes payment_hash_ref;
50201         CHECK(payment_hash->arr_len == 32);
50202         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50203         LDKSha256 description_hash_conv;
50204         description_hash_conv.inner = untag_ptr(description_hash);
50205         description_hash_conv.is_owned = ptr_is_owned(description_hash);
50206         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
50207         description_hash_conv = Sha256_clone(&description_hash_conv);
50208         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
50209         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
50210         if (phantom_route_hints_constr.datalen > 0)
50211                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
50212         else
50213                 phantom_route_hints_constr.data = NULL;
50214         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
50215         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
50216                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
50217                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
50218                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
50219                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
50220                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
50221                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
50222                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
50223         }
50224         FREE(phantom_route_hints);
50225         void* entropy_source_ptr = untag_ptr(entropy_source);
50226         CHECK_ACCESS(entropy_source_ptr);
50227         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
50228         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
50229                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50230                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
50231         }
50232         void* node_signer_ptr = untag_ptr(node_signer);
50233         CHECK_ACCESS(node_signer_ptr);
50234         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50235         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50236                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50237                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50238         }
50239         void* logger_ptr = untag_ptr(logger);
50240         CHECK_ACCESS(logger_ptr);
50241         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50242         if (logger_conv.free == LDKLogger_JCalls_free) {
50243                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50244                 LDKLogger_JCalls_cloned(&logger_conv);
50245         }
50246         LDKCurrency network_conv = LDKCurrency_from_js(network);
50247         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50248         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50249         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50250         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50251         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50252         *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);
50253         return tag_ptr(ret_conv, true);
50254 }
50255
50256 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) {
50257         LDKChannelManager channelmanager_conv;
50258         channelmanager_conv.inner = untag_ptr(channelmanager);
50259         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50260         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50261         channelmanager_conv.is_owned = false;
50262         void* node_signer_ptr = untag_ptr(node_signer);
50263         CHECK_ACCESS(node_signer_ptr);
50264         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50265         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50266                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50267                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50268         }
50269         void* logger_ptr = untag_ptr(logger);
50270         CHECK_ACCESS(logger_ptr);
50271         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50272         if (logger_conv.free == LDKLogger_JCalls_free) {
50273                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50274                 LDKLogger_JCalls_cloned(&logger_conv);
50275         }
50276         LDKCurrency network_conv = LDKCurrency_from_js(network);
50277         void* amt_msat_ptr = untag_ptr(amt_msat);
50278         CHECK_ACCESS(amt_msat_ptr);
50279         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50280         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50281         LDKSha256 description_hash_conv;
50282         description_hash_conv.inner = untag_ptr(description_hash);
50283         description_hash_conv.is_owned = ptr_is_owned(description_hash);
50284         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
50285         description_hash_conv = Sha256_clone(&description_hash_conv);
50286         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50287         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50288         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50289         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50290         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50291         *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);
50292         return tag_ptr(ret_conv, true);
50293 }
50294
50295 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) {
50296         LDKChannelManager channelmanager_conv;
50297         channelmanager_conv.inner = untag_ptr(channelmanager);
50298         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50299         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50300         channelmanager_conv.is_owned = false;
50301         void* node_signer_ptr = untag_ptr(node_signer);
50302         CHECK_ACCESS(node_signer_ptr);
50303         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50304         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50305                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50306                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50307         }
50308         void* logger_ptr = untag_ptr(logger);
50309         CHECK_ACCESS(logger_ptr);
50310         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50311         if (logger_conv.free == LDKLogger_JCalls_free) {
50312                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50313                 LDKLogger_JCalls_cloned(&logger_conv);
50314         }
50315         LDKCurrency network_conv = LDKCurrency_from_js(network);
50316         void* amt_msat_ptr = untag_ptr(amt_msat);
50317         CHECK_ACCESS(amt_msat_ptr);
50318         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50319         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50320         LDKStr description_conv = str_ref_to_owned_c(description);
50321         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50322         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50323         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50324         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50325         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50326         *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);
50327         return tag_ptr(ret_conv, true);
50328 }
50329
50330 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) {
50331         LDKChannelManager channelmanager_conv;
50332         channelmanager_conv.inner = untag_ptr(channelmanager);
50333         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50334         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50335         channelmanager_conv.is_owned = false;
50336         void* node_signer_ptr = untag_ptr(node_signer);
50337         CHECK_ACCESS(node_signer_ptr);
50338         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50339         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50340                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50341                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50342         }
50343         void* logger_ptr = untag_ptr(logger);
50344         CHECK_ACCESS(logger_ptr);
50345         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50346         if (logger_conv.free == LDKLogger_JCalls_free) {
50347                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50348                 LDKLogger_JCalls_cloned(&logger_conv);
50349         }
50350         LDKCurrency network_conv = LDKCurrency_from_js(network);
50351         void* amt_msat_ptr = untag_ptr(amt_msat);
50352         CHECK_ACCESS(amt_msat_ptr);
50353         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50354         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50355         LDKStr description_conv = str_ref_to_owned_c(description);
50356         LDKThirtyTwoBytes payment_hash_ref;
50357         CHECK(payment_hash->arr_len == 32);
50358         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50359         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50360         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50361         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50362         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50363         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50364         *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);
50365         return tag_ptr(ret_conv, true);
50366 }
50367
50368 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
50369         LDKStr s_conv = str_ref_to_owned_c(s);
50370         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
50371         *ret_conv = SiPrefix_from_str(s_conv);
50372         return tag_ptr(ret_conv, true);
50373 }
50374
50375 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
50376         LDKStr s_conv = str_ref_to_owned_c(s);
50377         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
50378         *ret_conv = Invoice_from_str(s_conv);
50379         return tag_ptr(ret_conv, true);
50380 }
50381
50382 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
50383         LDKStr s_conv = str_ref_to_owned_c(s);
50384         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
50385         *ret_conv = SignedRawInvoice_from_str(s_conv);
50386         return tag_ptr(ret_conv, true);
50387 }
50388
50389 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
50390         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
50391         LDKStr ret_str = ParseError_to_str(o_conv);
50392         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50393         Str_free(ret_str);
50394         return ret_conv;
50395 }
50396
50397 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
50398         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
50399         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
50400         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50401         Str_free(ret_str);
50402         return ret_conv;
50403 }
50404
50405 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
50406         LDKInvoice o_conv;
50407         o_conv.inner = untag_ptr(o);
50408         o_conv.is_owned = ptr_is_owned(o);
50409         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50410         o_conv.is_owned = false;
50411         LDKStr ret_str = Invoice_to_str(&o_conv);
50412         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50413         Str_free(ret_str);
50414         return ret_conv;
50415 }
50416
50417 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
50418         LDKSignedRawInvoice o_conv;
50419         o_conv.inner = untag_ptr(o);
50420         o_conv.is_owned = ptr_is_owned(o);
50421         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50422         o_conv.is_owned = false;
50423         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
50424         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50425         Str_free(ret_str);
50426         return ret_conv;
50427 }
50428
50429 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
50430         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
50431         LDKStr ret_str = Currency_to_str(o_conv);
50432         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50433         Str_free(ret_str);
50434         return ret_conv;
50435 }
50436
50437 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
50438         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
50439         LDKStr ret_str = SiPrefix_to_str(o_conv);
50440         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50441         Str_free(ret_str);
50442         return ret_conv;
50443 }
50444